text:
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">

   <!--
   Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,
   which is notified when Caches are added or removed from the CacheManager.

   The attributes of CacheManagerEventListenerFactory are:
   * class - a fully qualified factory class name
   * properties - comma separated properties having meaning only to the factory.

   Sets the fully qualified class name to be registered as the CacheManager event listener.

   The events include:
   * adding a Cache
   * removing a Cache

   Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
   of the implementer to safely handle the potential performance and thread safety issues
   depending on what their listener is doing.

   If no class is specified, no listener is created. There is no default.
   -->
   <cacheManagerEventListenerFactory class="" properties=""/>

   <!--
   (Enable for distributed operation)

   Specifies a CacheManagerPeerProviderFactory which will be used to create a
   CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.

   The attributes of cacheManagerPeerProviderFactory are:
   * class - a fully qualified factory class name
   * properties - comma separated properties having meaning only to the factory.

   Ehcache comes with a built-in RMI-based distribution system with two means of discovery of
   CacheManager peers participating in the cluster:
   * automatic, using a multicast group. This one automatically discovers peers and detects
     changes such as peers entering and leaving the group
   * manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
     configuration time.

   Configuring Automatic Discovery:
   Automatic discovery is configured as per the following example:
   <cacheManagerPeerProviderFactory
                       class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
                       properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
                                   multicastGroupPort=4446, timeToLive=32"/>

   Valid properties are:
   * peerDiscovery (mandatory) - specify "automatic"
   * multicastGroupAddress (mandatory) - specify a valid multicast group address
   * multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
     traffic
   * timeToLive - specify a value between 0 and 255 which determines how far the packets will propagate.
     By convention, the restrictions are:
     0   - the same host
     1   - the same subnet
     32  - the same site
     64  - the same region
     128 - the same continent
     255 - unrestricted

   Configuring Manual Discovery:
   Manual discovery is configured as per the following example:
   <cacheManagerPeerProviderFactory class=
                         "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
                         properties="peerDiscovery=manual,
                         rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
                         | //server1:40000/sampleCache2|//server2:40000/sampleCache2"/>

   Valid properties are:
   * peerDiscovery (mandatory) - specify "manual"
   * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form
                           //hostname:port

   The hostname is the hostname of the remote CacheManager peer. The port is the listening
   port of the RMICacheManagerPeerListener of the remote CacheManager peer.

   An alternate CacheManagerPeerProviderFactory can be used for JNDI discovery of other
   CacheManagers in the cluster. Only manual discovery is supported.

   For cacheManagerPeerProviderFactory specify class
   net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.

   Correspondingly for cacheManagerPeerListenerFactory specify class
   net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactoryory.

   Configuring JNDI Manual Discovery:
   Manual JNDI discovery is configured as per the following example:
   <cacheManagerPeerProviderFactory class=
       "net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory"
       properties="peerDiscovery=manual, stashContexts=true, stashRemoteCachePeers=true,
             jndiUrls=t3//server1:40000/sampleCache1|t3//server2:40000/sampleCache1
             |t3//server1:40000/sampleCache2|t3//server2:40000/sampleCache2"/>

   Valid properties are:
   * peerDiscovery (mandatory) - specify "manual"
   * stashContexts (optional) - specify "true" or "false".  Defaults to true.
     java.naming.Context objects are stashed for performance.
   * stashRemoteCachePeers (optional) - specify "true" or "false".  Defaults to true.
     CachePeer objects are stashed for performance.
   * jndiUrls (mandatory) - specify a pipe separated list of jndiUrls,
     in the form protocol//hostname:port
   -->
   <cacheManagerPeerProviderFactory
         class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
         properties="peerDiscovery=automatic,
                       multicastGroupAddress=228.1.2.3,
                       multicastGroupPort=48866, timeToLive=64"/>

   <!--
   (Enable for distributed operation)

   Specifies a CacheManagerPeerListenerFactory which will be used to create a
   CacheManagerPeerListener, which
   listens for messages from cache replicators participating in the cluster.

   The attributes of cacheManagerPeerListenerFactory are:
   class - a fully qualified factory class name
   properties - comma separated properties having meaning only to the factory.

   Ehcache comes with a built-in RMI-based distribution system. The listener component is
   RMICacheManagerPeerListener which is configured using
   RMICacheManagerPeerListenerFactory. It is configured as per the following example:

   <cacheManagerPeerListenerFactory
       class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
       properties="hostName=fully_qualified_hostname_or_ip,
                   port=40001,
                   socketTimeoutMillis=120000"/>

   All properties are optional. They are:
   * hostName - the hostName of the host the listener is running on. Specify
     where the host is multihomed and you want to control the interface over which cluster
     messages are received. Defaults to the host name of the default interface if not
     specified.
   * port - the port the listener listens on. This defaults to a free port if not specified.
   * socketTimeoutMillis - the number of ms client sockets will stay open when sending
     messages to the listener. This should be long enough for the slowest message.
     If not specified it defaults 120000ms.

   An alternate CacheManagerPeerListenerFactory can be also be used for JNDI binding of
   listeners for messages from cache replicators participating in the cluster. For
   cacheManagerPeerListenerFactory specify
   class net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactory.
   Correspondingly for cacheManagerPeerProviderFactory specify class
   net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
   Properties for JNDIRMICacheManagerPeerListenerFactory are the same as
   RMICacheManagerPeerListenerFactory.

   -->
   <cacheManagerPeerListenerFactory
         class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
         properties="hostName=${bind.address}, socketTimeoutMillis=120000"/>

   <!-- Cache configuration.

   The following attributes are required.

   name:
   Sets the name of the cache. This is used to identify the cache. It must be unique.

   maxElementsInMemory:
   Sets the maximum number of objects that will be created in memory

  maxElementsOnDisk:
   Sets the maximum number of objects that will be maintained in the DiskStore
  The default value is zero, meaning unlimited.

   eternal:
   Sets whether elements are eternal. If eternal,  timeouts are ignored and the
   element is never expired.

   overflowToDisk:
   Sets whether elements can overflow to disk when the memory store
   has reached the maxInMemory limit.

   The following attributes are optional.

   timeToIdleSeconds:
   Sets the time to idle for an element before it expires.
   i.e. The maximum amount of time between accesses before an element expires
   Is only used if the element is not eternal.
   Optional attribute. A value of 0 means that an Element can idle for infinity.
   The default value is 0.

   timeToLiveSeconds:
   Sets the time to live for an element before it expires.
   i.e. The maximum time between creation time and when an element expires.
   Is only used if the element is not eternal.
   Optional attribute. A value of 0 means that and Element can live for infinity.
   The default value is 0.

   diskPersistent:
   Whether the disk store persists between restarts of the Virtual Machine.
   The default value is false.

   diskExpiryThreadIntervalSeconds:
   The number of seconds between runs of the disk expiry thread. The default value
   is 120 seconds.

   memoryStoreEvictionPolicy:
   Policy would be enforced upon reaching the maxElementsInMemory limit. Default
   policy is Least Recently Used (specified as LRU). Other policies available -
   First In First Out (specified as FIFO) and Less Frequently Used
   (specified as LFU)

   Cache elements can also contain sub elements which take the same format of a factory class
   and properties. Defined sub-elements are:

   * cacheEventListenerFactory - Enables registration of listeners for cache events, such as
     put, remove, update, and expire.

   * bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by a
     cache on initialisation to prepopulate itself.

   Each cache that will be distributed needs to set a cache event listener which replicates
   messages to the other CacheManager peers. For the built-in RMI implementation this is done
   by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each
   distributed cache's configuration as per the following example:

   <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
        properties="replicateAsynchronously=true,
        replicatePuts=true,
        replicateUpdates=true,
        replicateUpdatesViaCopy=true,
        replicateRemovals=true "/>

   The RMICacheReplicatorFactory recognises the following properties:

   * replicatePuts=true|false - whether new elements placed in a cache are
     replicated to others. Defaults to true.

   * replicateUpdates=true|false - whether new elements which override an
     element already existing with the same key are replicated. Defaults to true.

   * replicateRemovals=true - whether element removals are replicated. Defaults to true.

   * replicateAsynchronously=true | false - whether replications are
     asynchronous (true) or synchronous (false). Defaults to true.

   * replicateUpdatesViaCopy=true | false - whether the new elements are
     copied to other caches (true), or whether a remove message is sent. Defaults to true.

   * asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous
     replicator runs at a set interval of milliseconds. The default is 1000. The minimum
     is 10. This property is only applicable if replicateAsynchronously=true

   The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators are
   used. It is configured as per the following example:

   <bootstrapCacheLoaderFactory
       class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
       properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/>

   The RMIBootstrapCacheLoaderFactory recognises the following optional properties:

   * bootstrapAsynchronously=true|false - whether the bootstrap happens in the background
     after the cache has started. If false, bootstrapping must complete before the cache is
     made available. The default value is true.

   * maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than the
     memory limits of the VM. This property allows the bootstraper to fetched elements in
     chunks. The default chunk size is 5000000 (5MB).

   -->

   <!--
   Mandatory Default Cache configuration. These settings will be applied to caches
   created programmtically using CacheManager.add(String cacheName)
   -->
   <defaultCache
         maxElementsInMemory="1000000"
         eternal="true"
         overflowToDisk="false"
         diskPersistent="false"
         />

   <!--
   Sample caches. Following are some example caches. Remove these before use.
   -->

   <!--
      NOTE that the cache benchmarking fwk looks for a cache named "cache".
    -->

   <!--
   Sample distributed cache named sampleDistributedCache3.
   This cache replicates using defaults except that the asynchronous replication
   interval is set to 200ms.
   -->
   <cache name="cache"
          maxElementsInMemory="1000000"
          eternal="true"
          overflowToDisk="false">
      <cacheEventListenerFactory
            class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
            properties="replicateAsynchronously=true, replicatePuts=true,
                           replicateUpdates=true, replicateUpdatesViaCopy=false,
                           replicateRemovals=true"/>
   </cache>

</ehcache>


text:
package im.mange.backdoor

case class Debug(context: String)

redpajama_set_name: RedPajamaGithub


text:
package org.testifyproject.junit4.system;

import org.testifyproject.annotation.Discoverable;
import org.testifyproject.core.extension.instrument.InstrumentInstanceBuilder;
import org.testifyproject.extension.InstrumentInstance;
import org.testifyproject.extension.InstrumentProvider;

/**
 * An implementation of InstrumentProvider contract that configures rebasing and interception of
 * Jersey ApplicationHandler operations.
 *
 * @author saden
 */
@Discoverable
public class ApplicationHandlerInstrumentProvider implements InstrumentProvider {

    @Override
    public InstrumentInstance get() {
        return InstrumentInstanceBuilder.builder()
                .build("org.glassfish.jersey.server.ApplicationHandler",
                        new ApplicationHandlerInterceptor());
    }

}


text:
@interface UsefulLinkArray : PFObject <PFSubclassing>

+ (NSString *)parseClassName;

@property NSArray *linksArray;
@property NSString *headerTitle;
@property NSNumber *index;

@end


text:
ecovery script for streaming replication.
# This script assumes that DB node 0 is primary, and 1 is standby.
#
datadir=$1
desthost=$2
destdir=$3

psql -c "SELECT pg_start_backup('Streaming Replication', true)" postgres

ssh -T $desthost rm -rf $destdir/*

/usr/bin/rsync -C -a --delete -e ssh --exclude postmaster.pid \
--exclude postmaster.opts --exclude pg_log --exclude pg_xlog \
--exclude recovery.conf $datadir/ $desthost:$destdir/

ssh -T $desthost /bin/mv $destdir/recovery.done $destdir/recovery.conf
ssh -T $desthost /bin/mkdir $destdir/pg_xlog
ssh -T $desthost /bin/chmod 700 $destdir/pg_xlog

psql -c "SELECT pg_stop_backup()" postgres


text:
<?php

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

defined('MOODLE_INTERNAL') || die();

$string['pluginname'] = 'Archivo XML';
$string['useridnumberwarning'] = 'Los usuarios sin un número ID están excluídos de la exportación XML y tampoco pueden ser importados';
$string['xml:publish'] = 'Publicar exportación de calificaciones XML';
$string['xml:view'] = 'Usar exportación de calificaciones XML';


text:
namespace ngraph
{
    namespace op
    {
        namespace v1
        {
            /// \brief Performs a reduction using "logical and"
            ///
            /// The reduction is performed over slices of the first input. The slices shape depends
            /// on the values passed to the second input - the axes.
            class NGRAPH_API ReduceLogicalAnd : public util::LogicalReductionKeepDims
            {
            public:
                static constexpr NodeTypeInfo type_info{"ReduceLogicalAnd", 1};
                const NodeTypeInfo& get_type_info() const override { return type_info; }
                ReduceLogicalAnd() = default;
                /// \brief Constructs a ReduceLogicalAnd node.
                ///
                /// \param data - The input tensor with data to be reduced
                /// \param reduction_axes - The input tensor with information about axes over which
                /// the first tensor should be sliced prior to the reduction operation
                /// \param keep_dims - Indicates if the axes used for reduction should be held/kept
                ReduceLogicalAnd(const Output<Node>& data,
                                 const Output<Node>& reduction_axes,
                                 const bool keep_dims = false);

                virtual std::shared_ptr<Node>
                    clone_with_new_inputs(const OutputVector& new_args) const override;
            };
        }
    }
}


text:
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  devtool: 'eval-source-map',
  entry: path.resolve('src', 'main.js'),
  output: {
    path: path.resolve('dist'),
    filename: 'main.js',
    publicPath: '/'
  },
  plugins: [
    new HtmlWebpackPlugin({
      title: 'Cerebral demo application',
      template: path.resolve('src', 'index.template.ejs'),
      inject: 'body'
    }),
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify('development')
    })
  ],
  module: {
    loaders: [{
      test: /\.js?$/,
      include: path.resolve('src'),
      loader: 'babel',
      query: {
        presets: ['es2015', 'stage-0', 'react']
      }
    }]
  }
};


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <title>JSDoc: Suneditor</title>

    <link rel="stylesheet" href="../../css/github.css">
    <link rel="stylesheet" href="../../css/github-frameworks.css">

    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/prettify-jsdoc.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/3.0.1/github-markdown.min.css">

.core

It can be accessed from object's "core" property returned after editor creation.

Members

_w

                Window object.

_d

                Document object.

_ww

                Window object of the iframe if created as an iframe || _w

_wd

                Document object of the iframe if created as an iframe || _d

util

                Suneditor's "util" object

functions

                Functions object

notice

                Notice module object

                notice.open(), notice.close()

icons

                Default icons object

history

                History object for undo, redo

Properties:

                        Name
                        Type
                        Description

                        stack

                            Array

                        History stack

                        push(delay)

                            Function

                            Saving the current status to the history object stack

                            If "delay" is true, it will be saved after (options.historyStackDelayTime || 400) miliseconds

                            If the function is called again with the "delay" argument true before it is saved, the delay time is renewal.

                            You can specify the delay time by sending a number.

                        undo()

                            Function

                        Undo function

                        redo()

                            Function

                        Redo function

                        go(index)

                            Function

                            Go to the history stack for argument "index"

                            If "index" is -1, go to the last stack

                        getCurrentIndex()

                            Function

                            Get the current history stack index.

                        reset(ignoreChangeEvent)

                            Function

                            Reset the history object

                            If "ignoreChangeEvent" is true the onChange event will not be called after a reset

plugins

                Loaded plugins

pluginCallButtons

                Plugin buttons

initPlugins

                Whether the plugin is initialized

lang

                Loaded language

context {Object}

Properties:

                    Name
                    Type
                    Description

                    element

                        Object

                    editor elements (Contains sub-options)

                        originElement

                        Element

                    "Textarea" to be the base of the editor

                        topArea

                        Element

                    The top-level element of the editor

                        relative

                        Element

                    Element below top-level element in editor
                        (class="sun-editor-container") It wraps all other div tags

                        toolbar

                        Element

                    Toolbar element

                        resizebar

                        Element

                    Element of the resize bar

                        navigation

                        Element

                    Element of the current tag navigation

                        charWrapper

                        Element

                    Character counter wrapper tag

                        charCounter

                        Element

                    Character counter tag

                        editorArea

                        Element

                    Element containing an iframe

                        wysiwygFrame

                        Element

                    wysiwyg area (DIV or Iframe)

                        wysiwyg

                        Element

                    wysiwyg edit area (DIV or Iframe.document.body)

                        code

                        Element

                    textarea element used in code view mode

                        placeholder

                        Element

                    The placeholder span

                        loading

                        Element

                    The loding box

                        resizeBackground

                        Element

                    Background div used when resize behavior

                    tool

                        Object

                    tool bar elements (Contains sub-options)

                        cover

                        Element

                    Div that covers the toolbar when the button is "disable"

                        bold

                        Element

                    bold button element

                        underline

                        Element

                    underline button element

                        italic

                        Element

                    italic button element

                        strike

                        Element

                    strike button element

                        sub

                        Element

                    subscript button element

                        sup

                        Element

                    superscript button element

                        undo

                        Element

                    undo button element

                        redo

                        Element

                    redo button element

                        save

                        Element

                    save button element

                        outdent

                        Element

                    outdent button element

                    option, options

                        Object

                    inserted options (Contains sub-options)

effectNode

                This is a reference node to apply the activation effect of the buttons.

                If the node did not change after adding the custom plugin, if you need to reapply the button's activation effect, set this variable to "null".

submenu

                submenu element

container

                container element

submenuActiveButton

                active button element in submenu

containerActiveButton

                active button element in container

controllerArray

                The elements array to be processed unvisible when the controllersOff function is executed

                (resizing, link modified button, table controller)

currentControllerName

                The name of the plugin that called the currently active controller.

currentControllerTarget

                The target element of current controller.

currentFileComponentInfo

                The file component object of current selected file tag (getFileComponent(): {target, component, pluginName})

controllerFunction

                The functions array to be executed when the controllersOff function is executed

                ex) init function of table plugin

codeViewDisabledButtons

                An array of buttons whose class name is not "se-code-view-enabled"

resizingDisabledButtons

                An array of buttons whose class name is not "se-resizing-enabled"

editorTagsWhitelistRegExp

                Editor tags whitelist (RegExp object)

                util.createTagsWhitelist(options._editorTagsWhitelist)

editorTagsBlacklistRegExp

                Editor tags blacklist (RegExp object)

                util.createTagsBlacklist(options.tagsBlacklist)

pasteTagsWhitelistRegExp

                Tag whitelist when pasting (RegExp object)

                util.createTagsWhitelist(options.pasteTagsWhitelist)

pasteTagsBlacklistRegExp

                Tag blacklist when pasting (RegExp object)

                util.createTagsBlacklist(options.pasteTagsBlacklist)

hasFocus

                Boolean value of whether the editor has focus

activePlugins

                Plugins array with "active" method.

                "activePlugins" runs the "add" method when creating the editor.

managedTagsInfo

                @description Information of tags that should maintain HTML structure, style, class name, etc. (In use by "math" plugin)

                When inserting "html" such as paste, it is executed on the "html" to be inserted. (core.cleanHTML)

                Basic Editor Actions:

                1. All classes not starting with "__se__" or "se-" in the editor are removed.

                2. The style of all tags except the "span" tag is removed from the editor.

"managedTagsInfo" structure ex:

managedTagsInfo() {
    query: '.__se__xxx, se-xxx'
    map: {
    '__se__xxx': method.bind(core),
    'se-xxx': method.bind(core),
    }
}

@example

Define in the following return format in the "managedTagInfo" function of the plugin.

managedTagInfo() => {
    return {
        className: 'string', // Class name to identify the tag. ("__se__xxx", "se-xxx")
        // Change the html of the "element". ("element" is the element found with "className".)
        // "method" is executed by binding "core".
        method: function (element) {
            // this === core
            element.innerHTML = // (rendered html);
        }
    }
}

commandMap

                Elements that need to change text or className for each selection change.

                After creating the editor, activePlugins are added.

Properties:

                    Name
                    Type
                    Description

                    STRONG

                        Element

                    bold button

                    INS

                        Element

                    underline button

                    EM

                        Element

                    italic button

                    DEL

                        Element

                    strike button

                    SUB

                        Element

                    subscript button

                    SUP

                        Element

                    superscript button

                    OUTDENT

                        Element

                    outdent button

_variable

                    Variables used internally in editor operation

Properties:

                    Name
                    Type
                    Description

                    isChanged

                        Boolean

                    Editor content change status

                    isCodeView

                        Boolean

                    State of code view

                    isFullScreen

                        Boolean

                    State of full screen

                    innerHeight_fullScreen

                        Number

                    InnerHeight in editor when in full screen

                    resizeClientY

                        Number

                    Remember the vertical size of the editor before resizing the editor (Used when calculating during resize operation)

                    tabSize

                        Number

                    Indent size of tab (4)

                    codeIndent

                        Number

                    Indent size of Code view mode (2)

                    minResizingSize

                        Number

                    Minimum size of editing area when resized {Number} (.se-wrapper-inner {min-height: 65px;} || 65)

                    currentNodes

                        Array

                    An array of the current cursor's node structure

Methods

callPlugin(pluginName, callBackFunction, _target)

                If the plugin is not added, add the plugin and call the 'add' function.

                If the plugin is added call callBack function.

Parameters:

                    Name
                    Type
                    Description

                    pluginName

                        String

                    The name of the plugin to call

                    callBackFunction

                        Function

                    Function to be executed immediately after module call

                    _target

                        Element|null

                    Plugin target button (This is not necessary if you have a button list when creating the editor)

addModule(moduleObj)

                If the module is not added, add the module and call the 'add' function

Parameters:

                    Name
                    Type
                    Description

                    moduleObj

                        Array

                    module object's Array [dialog, resizing]

getGlobalScrollOffset()
                 → {Object}

                Gets the current editor-relative scroll offset.

                {top: number, left: number}

initMenuTarget(pluginName, target, menu)

                Method for managing submenu element.

                You must add the "submenu" element using the this method at custom plugin.

Parameters:

                    Name
                    Type
                    Description

                    pluginName

                        String

                    Plugin name

                    target

                        Element|null

                    Target button

                    menu

                        Element

                    Submenu element

submenuOn(element)

                Enable submenu

Parameters:

                    Name
                    Type
                    Description

                    element

                        Element

                    Submenu's button element to call

submenuOff()

                Disable submenu

containerOn(element)

                Enable container

Parameters:

                    Name
                    Type
                    Description

                    element

                        Element

                    Container's button element to call

containerOff()

                Disable container

controllersOn(arguments)

                Show controller at editor area (controller elements, function, "controller target element(@Required)", "controller name(@Required)", etc..)

Parameters:

                    Name
                    Type
                    Description

                    arguments

                        {*}

                    Controller elements, functions..

controllersOff()

                Hide controller at editor area (link button, image resize button..)

setControllerPosition(controller, referEl, position, addOffset)

                Specify the position of the controller.

Parameters:

                    Name
                    Type
                    Description

                    controller

                        Element

                    Controller element

                    referEl

                        Element

                    Element that is the basis of the controller's position

                    position

                        String

                        Type of position ("top" | "bottom")

                        When using the "top" position, there should not be an arrow on the controller.

                        When using the "bottom" position there should be an arrow on the controller.

                    addOffset

                        Object

                        These are the left and top values that need to be added specially.

                        This argument is required. - {left: 0, top: 0}

                        Please enter the value based on ltr mode.

                        Calculated automatically in rtl mode.

execCommand(command, showDefaultUI, value)

                javascript execCommand

Parameters:

                    Name
                    Type
                    Description

                    command

                        String

                    javascript execCommand function property

                    showDefaultUI

                        Boolean|undefined

                    javascript execCommand function property

                    value

                        String|undefined

                    javascript execCommand function property

nativeFocus()

                Focus to wysiwyg area using "native focus function"

focus()

                Focus to wysiwyg area

focusEdge(focusEl)

                If "focusEl" is a component, then that component is selected; if it is a format element, the last text is selected

                If "focusEdge" is null, then selected last element

Parameters:

                    Name
                    Type
                    Description

                    focusEl

                        Element | null

                    Focus element.

blur()

                Focusout to wysiwyg area (.blur())

setRange(startCon, startOff, endCon, endOff)
                 → {Object}

                Set range object and return.

Parameters:

                    Name
                    Type
                    Description

                    startCon

                        Node

                    The startContainer property of the selection object.

                    startOff

                        Number

                    The startOffset property of the selection object.

                    endCon

                        Node

                    The endContainer property of the selection object.

                    endOff

                        Number

                    The endOffset property of the selection object.

removeRange()

                Remove range object and button effect

getRange() → {Object}

                Get current range object

getRange_addLine(range, container) → {Object}

                If the "range" object is a non-editable area, add a line at the top of the editor and update the "range" object.

                Returns a new "range" or argument "range".

Parameters:

                    Name
                    Type
                    Description

                    range

                        Object

                    core.getRange()

                    container

                        Element|null

                    If there is "container" argument, it creates a line in front of the container.

getSelection() → {Object}

                Get window selection obejct

getSelectionNode() → {Node}

                Get current select node

getSelectedElements(validation) → {Array}

                Returns a "formatElement"(util.isFormatElement) array from the currently selected range.

Parameters:

                    Name
                    Type
                    Description

                    validation

                        Function|null

                    The validation function. (Replaces the default validation function-util.isFormatElement)

getSelectedElementsAndComponents(removeDuplicate) → {Array}

                Get format elements and components from the selected area. (P, DIV, H[1-6], OL, UL, TABLE..)

                If some of the component are included in the selection, get the entire that component.

Parameters:

                    Name
                    Type
                    Description

                    removeDuplicate

                        Boolean

                    If true, if there is a parent and child tag among the selected elements, the child tag is excluded.

isEdgePoint(container, offset, dir) → {Boolean}

                Determine if this offset is the edge offset of container

Parameters:

                    Name
                    Type
                    Description

                    container

                        Node

                    The node of the selection object. (range.startContainer..)

                    offset

                        Number

                    The offset of the selection object. (core.getRange().startOffset...)

                    dir

                        String|undefined

                    Select check point - Both edge, Front edge or End edge. ("front": Front edge, "end": End edge, undefined: Both edge)

showLoading()

                Show loading box

closeLoading()

                Close loading box

appendFormatTag(element, formatNode) → {Element}

                Append format element to sibling node of argument element.

                If the "formatNode" argument value is present, the tag of that argument value is inserted,

                If not, the currently selected format tag is inserted.

                Returns the inserted element.

Parameters:

                    Name
                    Type
                    Description

                    element

                        Element

                    Insert as siblings of that element

                    formatNode

                        String|Element|null

                    Node name or node obejct to be inserted

insertComponent(element, notHistoryPush, notSelect) → {Element}

                The method to insert a element and return. (used elements : table, hr, image, video)

                If "element" is "HR", insert and return the new line.

Parameters:

                    Name
                    Type
                    Description

                    element

                        Element

                    Element to be inserted

                    notHistoryPush

                        Boolean

                    When true, it does not update the history stack and the selection object and return EdgeNodes (util.getEdgeChildNodes)

                    checkCharCount

                        Boolean

                    If true, if "options.maxCharCount" is exceeded when "element" is added, null is returned without addition.

                    notSelect

                        Boolean

                    If true, Do not automatically select the inserted component.

getFileComponent(element) → {Object}

                Gets the file component and that plugin name

                return: {target, component, pluginName} | null

Parameters:

                    Name
                    Type
                    Description

                    element

                        Element

                    Target element (figure tag, component div, file tag)

selectComponent(element, pluginName)

                The component(image, video) is selected and the resizing module is called.

Parameters:

                    Name
                    Type
                    Description

                    element

                        Element

                    Element tag (img, iframe, video)

                    pluginName

                        String

                    Plugin name (image, video)

insertNode(oNode, afterNode) → {Object|Node|null}

                Deletes the selected area and inserts the node and return.

                If the "afterNode" exists, it is inserted after the "afterNode"

                Inserting a text node merges with both text nodes on both sides and returns a new "{ container, startOffset, endOffset }".

Parameters:

                    Name
                    Type
                    Description

                    oNode

                        Element

                    Element to be inserted

                    afterNode

                        Element|null

                    If the node exists, it is inserted after the node

removeNode → {Object}

                Delete the currently selected nodes and reset selection range

                Returns {

                    container: "the last element after deletion",

                    offset: "offset",

                    prevContainer: "previousElementSibling Of the deleted area"

                }

applyRangeFormatElement(rangeElement)

                Appended all selected format Element to the argument element and insert

Parameters:

                    Name
                    Type
                    Description

                    rangeElement

                        Element

                    Element of wrap the arguments (BLOCKQUOTE...)

detachRangeFormatElement(rangeElement, selectedFormats, newRangeElement, remove, notHistoryPush) → {Object}

                The elements of the "selectedFormats" array are detached from the "rangeElement" element. ("LI" tags are converted to "P" tags)

                When "selectedFormats" is null, all elements are detached and return {cc: parentNode, sc: previousSibling, ec: nextSibling, removeArray: [Array of removed elements]}.

Parameters:

                    Name
                    Type
                    Description

                    rangeElement

                        Element

                    Range format element (PRE, BLOCKQUOTE, OL, UL...)

                    selectedFormats

                        Array|null

                    Array of format elements (P, DIV, LI...) to remove.

                        If null, Applies to all elements and return {cc: parentNode, sc: previousSibling, ec: nextSibling}

                    newRangeElement

                        Element|null

                    The node(rangeElement) to replace the currently wrapped node.

                    remove

                        Boolean

                    If true, deleted without detached.

                    notHistoryPush

                        Boolean

                    When true, it does not update the history stack and the selection object and return EdgeNodes (util.getEdgeChildNodes)

detachList(selectedFormats, remove) → {Object} : {sc: <LI>, ec: <LI>}

                "selectedFormats" array are detached from the list element.

                The return value is applied when the first and last lines of "selectedFormats" are "LI" respectively.

Parameters:

                    Name
                    Type
                    Description

                    selectedFormats

                        Array

                    Array of format elements (LI, P...) to remove.

                    remove

                        Boolean

                    If true, deleted without detached.

nodeChange(appendNode, styleArray, removeNodeArray, strictRemove)

                Add, update, and delete nodes from selected text.

                1. If there is a node in the "appendNode" argument, a node with the same tags and attributes as "appendNode" is added to the selection text.

                2. If it is in the same tag, only the tag's attributes are changed without adding a tag.

                3. If the "appendNode" argument is null, the node of the selection is update or remove without adding a new node.

                4. The same style as the style attribute of the "styleArray" argument is deleted.

                    (Styles should be put with attribute names from css. ["background-color"])

                5. The same class name as the class attribute of the "styleArray" argument is deleted.

                    (The class name is preceded by "." [".className"])

                6. Use a list of styles and classes of "appendNode" in "styleArray" to avoid duplicate property values.

                7. If a node with all styles and classes removed has the same tag name as "appendNode" or "removeNodeArray", or "appendNode" is null, that node is deleted.

                8. Regardless of the style and class of the node, the tag with the same name as the "removeNodeArray" argument value is deleted.

                9. If the "strictRemove" argument is true, only nodes with all styles and classes removed from the nodes of "removeNodeArray" are removed.

               10. It won't work if the parent node has the same class and same value style.

                    However, if there is a value in "removeNodeArray", it works and the text node is separated even if there is no node to replace.

Parameters:

                    Name
                    Type
                    Description

                    appendNode

                        Element|null

                    The element to be added to the selection. If it is null, only delete the node.

                    styleArray

                        Array|null

                    The style or className attribute name Array to check (['font-family', 'color', '.className']...])

                    removeNodeArray

                        Array|null

                        An array of node names to remove types from,

                        remove all formats when "appendNode" is null and there is an empty array or null value. (['span'], ['strong', 'em'] ...])

                    strictRemove

                        Boolean|null

                    If true, only nodes with all styles and classes removed from the nodes of "removeNodeArray" are removed.

actionCall(command, display, target)

                Run plugin calls and basic commands.

Parameters:

                    Name
                    Type
                    Description

                    command

                        String

                    Command string

                    display

                        String

                    Display type string ('command', 'submenu', 'dialog', 'container')

                    target

                        Element

                    The element of command button

commandHandler(target, command)

                Execute command of command button(All Buttons except submenu and dialog)

                (selectAll, codeView, fullScreen, indent, outdent, undo, redo, removeFormat, print, preview, showBlocks, save, bold, underline, italic, strike, subscript, superscript)

Parameters:

                    Name
                    Type
                    Description

                    target|null

                        Element

                    The element of command button

                    command

                        String

                    Property of command button (data-value)

removeFormat()

                Remove format of the currently selected range (IE, Edge not working)

indent(command)

                This method implements indentation to selected range.

                Setted "margin-left" to "25px" in the top "P" tag of the parameter node.

Parameters:

                    Name
                    Type
                    Description

                    command

                        String

                    Separator ("indent" or "outdent")

toggleDisplayBlocks()

                Add or remove the class name of "body" so that the code block is visible

toggleCodeView()

                Changes to code view or wysiwyg view

toggleFullScreen(element)

                Changes to full screen or default screen

Parameters:

                    Name
                    Type
                    Description

                    element

                        Element

                    full screen button

print()

                Prints the current contents of the editor.

preview()

                Open the preview window.

setDir(dir)

                Set direction to "rtl" or "ltr".

Parameters:

                    Name
                    Type
                    Description

                    String

                        dir

                    "rtl" or "ltr"

setContents(html)

                Sets the HTML string

Parameters:

                    Name
                    Type
                    Description

                    html

                        String

                    HTML string

setIframeContents(ctx)

                Sets the contents of the iframe's head tag and body tag when using the "iframe" or "fullPage" option.

Parameters:

                    Name
                    Type
                    Description

                    ctx

                        Object

                    { head: HTML string, body: HTML string}

getContents(onlyContents) → {String}

                Gets the current contents

                * not working during enabled codeView mode

Parameters:

                    Name
                    Type
                    Description

                    onlyContents

                        Boolean

                    Return only the contents of the body without headers when the "fullPage" option is true

getFullContents(onlyContents) → {String}

                Gets the current contents with containing parent div(div.sun-editor-editable).
                <div class="sun-editor-editable">{contents}</div>

Parameters:

                    Name
                    Type
                    Description

                    onlyContents

                        Boolean

                    Return only the contents of the body without headers when the "fullPage" option is true

getText() → {String}

                Gets only the text of the suneditor contents

                * not working during enabled codeView mode

cleanHTML(html, whitelist, blacklist) → {String}

                Gets the clean HTML code for editor

Parameters:

                    Name
                    Type
                    Description

                    html

                        String

                    HTML string

                    whitelist

                        String|RegExp|null

                        Regular expression of allowed tags.

                        RegExp object is create by util.createTagsWhitelist method. (core.pasteTagsWhitelistRegExp)

                    blacklist

                        String|RegExp|null

                        Regular expression of disallowed tags.

                        RegExp object is create by util.createTagsBlacklist method. (core.pasteTagsBlacklistRegExp)

checkCharCount(element, charCounterType) → {Boolean}

                When "element" is added, if it is greater than "options.maxCharCount", false is returned.

Parameters:

                    Name
                    Type
                    Description

                    element

                        Node|String

                    Element node or String

                    charCounterType

                        String|null

                    charCounterType. If it is null, the options.charCounterType

getCharLength(content, charCounterType) → {Number}

                Get the length of the content.
                Depending on the option, the length of the character is taken. (charCounterType)

Parameters:

                    Name
                    Type
                    Description

                    content

                        String

                    Content to count

                    charCounterType

                        String

                    options.charCounterType

addDocEvent(type, listener, useCapture)

                Add an event to document.

                When created as an Iframe, the same event is added to the document in the Iframe.

Parameters:

                    Name
                    Type
                    Description

                    type

                        String

                    Event type

                    listener

                        Function

                    Event listener

                    useCapture

                        Boolean

                    Use event capture

removeDocEvent(type, listener)

                Remove events from document.

                When created as an Iframe, the event of the document inside the Iframe is also removed.

Parameters:

                    Name
                    Type
                    Description

                    type

                        String

                    Event type

                    listener

                        Function

                    Event listener

convertContentsForEditor(contents) → {String}

                Converts contents into a format that can be placed in an editor.

Parameters:

                    Name
                    Type
                    Description

                    contents

                        String

                    Contents

convertHTMLForCodeView(html, comp) → {String}

                Converts wysiwyg area element into a format that can be placed in an editor of code view mode

Parameters:

                    Name
                    Type
                    Description

                    html

                        Element|String

                    WYSIWYG element (context.element.wysiwyg) or HTML string

                    comp

                        Boolean

                    If true, does not line break and indentation of tags.

SunEditor

Index

core

Members

_w

_d

_ww

_wd

util

notice

icons

history

plugins

pluginCallButtons

initPlugins

lang

context

effectNode

submenu

container

submenuActiveButton

containerActiveButton

controllerArray

currentControllerName

currentControllerTarget

currentFileComponentInfo

controllerFunction

codeViewDisabledButtons

resizingDisabledButtons

editorTagsWhitelistRegExp

editorTagsBlacklistRegExp

pasteTagsWhitelistRegExp

pasteTagsBlacklistRegExp

hasFocus

activePlugins

managedTagsInfo

commandMap

_variable

Methods

callPlugin

addModule

getGlobalScrollOffset

initMenuTarget

submenuOn

submenuOff

containerOn

containerOff

controllersOn

controllersOff

setControllerPosition

execCommand

nativeFocus

focus

focusEdge

blur

setRange

removeRange

getRange

getRange_addLine

getSelection

getSelectionNode

getSelectedElements

getSelectedElementsAndComponents

isEdgePoint

showLoading

closeLoading

appendFormatTag

insertComponent

getFileComponent

selectComponent

insertNode

removeNode

applyRangeFormatElement

detachRangeFormatElement

detachList

nodeChange

actionCall

commandHandler

removeFormat

indent

toggleDisplayBlocks

toggleCodeView

toggleFullScreen

print

preview

setContents

setIframeContents

getContents

getFullContents

getText

cleanHTML

checkCharCount

getCharLength

addDocEvent

removeDocEvent

convertContentsForEditor

convertHTMLForCodeView

    Documentation generated by JSDoc 3.5.5 on Sun Jan 28 2018 01:58:16
    GMT+0900 (대한민국 표준시)


text:
<!doctype html>

    <title>Combo Show Area Fill Global Styles Tests</title>


text:
#import <UIKit/UIKit.h>

// Constants for identifying link types we can detect
typedef NS_OPTIONS(NSUInteger, KILinkType)
{
    KILinkTypeNone         = 0,

    KILinkTypeUserHandle   = 1 << 0,
    KILinkTypeHashtag      = 1 << 1,
    KILinkTypeURL          = 1 << 2,

    KILinkTypeAll          = NSUIntegerMax,
};

@class KILabel;

// Block method that is called when an interactive word is touched
typedef void (^KILinkTapHandler)(KILabel *label, NSString *string, NSRange range);

extern NSString * const KILabelLinkTypeKey;
extern NSString * const KILabelRangeKey;
extern NSString * const KILabelLinkKey;

/**
 * Smart UILabel subclass that detects links, hashtags and usernames.
 **/
@interface KILabel : UILabel <NSLayoutManagerDelegate>

/** ****************************************************************************************** **
 * @name Setting the link detector
 ** ****************************************************************************************** **/

/**
 * Automatic detection of links, hashtags and usernames.
 **/
@property (nonatomic, assign, getter = isAutomaticLinkDetectionEnabled) BOOL automaticLinkDetectionEnabled;

/**
 * The link types to detect. Default value is KILinkTypeAll.
 **/
@property (nonatomic, assign) KILinkType linkDetectionTypes;

/**
 * Set containing words to be ignored as links, hashtags or usernames.
 * @discussion The comparison between the matches and the ignored words is case insensitive.
 **/
@property (nonatomic, strong) NSSet *ignoredKeywords;

/** ****************************************************************************************** **
 * @name Format & Appearance
 ** ****************************************************************************************** **/

/**
 * Colour used to highlight selected link background. Default value is nil (none).
 **/
@property (nonatomic, copy) UIColor *selectedLinkBackgroundColour;

/**
 * Flag to use the sytem format for URLs (underlined + blue color). Default value is NO.
 **/
@property (nonatomic, assign) BOOL systemURLStyle;

/**
 * Get the current attributes for the given link type.
 * @param linkType The link type to get the attributes.
 * @return A dictionary of text attributes.
 * @discussion Default attributes contain colored font using the tintColor color property
 **/
- (NSDictionary*)attributesForLinkType:(KILinkType)linkType;

/**
 * Set the text attributes for each link type.
 * @param attributes The text attributes.
 * @param linkType The link type.
 * @discussion Default attributes contain colored font using the tintColor color property.
 **/
- (void)setAttributes:(NSDictionary*)attributes forLinkType:(KILinkType)linkType;

/** ****************************************************************************************** **
 * @name Callbacks
 ** ****************************************************************************************** **/

/**
 * Callback block for KILinkTypeUserHandle link tap.
 **/
@property (nonatomic, copy) KILinkTapHandler linkUserHandleTapHandler;

/**
 * Callback block for KILinkTypeHashtag link tap.
 **/
@property (nonatomic, copy) KILinkTapHandler linkHashtagTapHandler;

/**
 * Callback block for KILinkTypeURL link tap.
 **/
@property (nonatomic, copy) KILinkTapHandler linkURLTapHandler;

/** ****************************************************************************************** **
 * @name Geometry
 ** ****************************************************************************************** **/

/**
 * Returns a dictionary of data about the link that it at the location. Returns nil if there is no link.
 *
 * A link dictionary contains the following keys:
 *     KILabelLinkTypeKey: a TDLinkType that identifies the type of link.
 *     KILabelRangeKey: the range of the link within the label text.
 *     KILabelLinkKey: the link text. This could be an URL, handle or hashtag depending on the linkType value.
 *
 * @param point The point in the coordinates of the label view.
 * @return A dictionary containing the link.
 **/
- (NSDictionary*)linkAtPoint:(CGPoint)point;

- (NSArray *)getArrayOfURLs;

@end


text:
import pytest
from hypothesis import given, reject
from hypothesis import strategies as st

import isort
from isort import wrap_modes

def test_wrap_mode_interface():
    assert (
        wrap_modes._wrap_mode_interface("statement", [], "", "", 80, [], "", "", True, True) == ""
    )

def test_auto_saved():
    """hypothesis_auto tests cases that have been saved to ensure they run each test cycle"""
    assert (
        wrap_modes.noqa(
            **{
                "comment_prefix": "-\U000bf82c\x0c\U0004608f\x10%",
                "comments": [],
                "imports": [],
                "include_trailing_comma": False,
                "indent": "0\x19",
                "line_length": -19659,
                "line_separator": "\x15\x0b\U00086494\x1d\U000e00a2\U000ee216\U0006708a\x03\x1f",
                "remove_comments": False,
                "statement": "\U00092452",
                "white_space": "\U000a7322\U000c20e3-\U0010eae4\x07\x14\U0007d486",
            }
        )
        == "\U00092452-\U000bf82c\x0c\U0004608f\x10% NOQA"
    )
    assert (
        wrap_modes.noqa(
            **{
                "comment_prefix": '\x12\x07\U0009e994🁣"\U000ae787\x0e',
                "comments": ["\x00\U0001ae99\U0005c3e7\U0004d08e", "\x1e", "", ""],
                "imports": ["*"],
                "include_trailing_comma": True,
                "indent": "",
                "line_length": 31492,
                "line_separator": "\U00071610\U0005bfbc",
                "remove_comments": False,
                "statement": "",
                "white_space": "\x08\x01ⷓ\x16%\U0006cd8c",
            }
        )
        == '*\x12\x07\U0009e994🁣"\U000ae787\x0e \x00\U0001ae99\U0005c3e7\U0004d08e \x1e  '
    )
    assert (
        wrap_modes.noqa(
            **{
                "comment_prefix": "  #",
                "comments": ["NOQA", "THERE"],
                "imports": [],
                "include_trailing_comma": False,
                "indent": "0\x19",
                "line_length": -19659,
                "line_separator": "\n",
                "remove_comments": False,
                "statement": "hi",
                "white_space": " ",
            }
        )
        == "hi  # NOQA THERE"
    )

def test_backslash_grid():
    """Tests the backslash_grid grid wrap mode, ensuring it matches formatting expectations.
    See: https://github.com/PyCQA/isort/issues/1434
    """
    assert (
        isort.code(
            """
from kopf.engines import loggers, posting
from kopf.reactor import causation, daemons, effects, handling, lifecycles, registries
from kopf.storage import finalizers, states
from kopf.structs import (bodies, configuration, containers, diffs,
                          handlers as handlers_, patches, resources)
""",
            multi_line_output=11,
            line_length=88,
            combine_as_imports=True,
        )
        == """
from kopf.engines import loggers, posting
from kopf.reactor import causation, daemons, effects, handling, lifecycles, registries
from kopf.storage import finalizers, states
from kopf.structs import bodies, configuration, containers, diffs, \\
                         handlers as handlers_, patches, resources
"""
    )

@pytest.mark.parametrize("include_trailing_comma", (False, True))
@pytest.mark.parametrize("line_length", (18, 19))
@pytest.mark.parametrize("multi_line_output", (4, 5))
def test_vertical_grid_size_near_line_length(
    multi_line_output: int,
    line_length: int,
    include_trailing_comma: bool,
):
    separator = " "
    # Cases where the input should be wrapped:
    if (
        # Mode 4 always adds a closing ")", making the imports line 19 chars,
        # if include_trailing_comma is True that becomes 20 chars.
        (multi_line_output == 4 and line_length < 19 + int(include_trailing_comma))
        # Modes 5 and 6 only add a comma, if include_trailing_comma is True,
        # so their lines are 18 or 19 chars long.
        or (multi_line_output != 4 and line_length < 18 + int(include_trailing_comma))
    ):
        separator = "\n    "

    test_input = f"from foo import (\n    aaaa, bbb,{separator}ccc"
    if include_trailing_comma:
        test_input += ","
    if multi_line_output != 4:
        test_input += "\n"
    test_input += ")\n"

    assert (
        isort.code(
            test_input,
            multi_line_output=multi_line_output,
            line_length=line_length,
            include_trailing_comma=include_trailing_comma,
        )
        == test_input
    )

# This test code was written by the `hypothesis.extra.ghostwriter` module
# and is provided under the Creative Commons Zero public domain dedication.

@given(
    statement=st.text(),
    imports=st.lists(st.text()),
    white_space=st.text(),
    indent=st.text(),
    line_length=st.integers(),
    comments=st.lists(st.text()),
    line_separator=st.text(),
    comment_prefix=st.text(),
    include_trailing_comma=st.booleans(),
    remove_comments=st.booleans(),
)
def test_fuzz_backslash_grid(
    statement,
    imports,
    white_space,
    indent,
    line_length,
    comments,
    line_separator,
    comment_prefix,
    include_trailing_comma,
    remove_comments,
):
    try:
        isort.wrap_modes.backslash_grid(
            statement=statement,
            imports=imports,
            white_space=white_space,
            indent=indent,
            line_length=line_length,
            comments=comments,
            line_separator=line_separator,
            comment_prefix=comment_prefix,
            include_trailing_comma=include_trailing_comma,
            remove_comments=remove_comments,
        )
    except ValueError:
        reject()

@given(
    statement=st.text(),
    imports=st.lists(st.text()),
    white_space=st.text(),
    indent=st.text(),
    line_length=st.integers(),
    comments=st.lists(st.text()),
    line_separator=st.text(),
    comment_prefix=st.text(),
    include_trailing_comma=st.booleans(),
    remove_comments=st.booleans(),
)
def test_fuzz_grid(
    statement,
    imports,
    white_space,
    indent,
    line_length,
    comments,
    line_separator,
    comment_prefix,
    include_trailing_comma,
    remove_comments,
):
    try:
        isort.wrap_modes.grid(
            statement=statement,
            imports=imports,
            white_space=white_space,
            indent=indent,
            line_length=line_length,
            comments=comments,
            line_separator=line_separator,
            comment_prefix=comment_prefix,
            include_trailing_comma=include_trailing_comma,
            remove_comments=remove_comments,
        )
    except ValueError:
        reject()

@given(
    statement=st.text(),
    imports=st.lists(st.text()),
    white_space=st.text(),
    indent=st.text(),
    line_length=st.integers(),
    comments=st.lists(st.text()),
    line_separator=st.text(),
    comment_prefix=st.text(),
    include_trailing_comma=st.booleans(),
    remove_comments=st.booleans(),
)
def test_fuzz_hanging_indent(
    statement,
    imports,
    white_space,
    indent,
    line_length,
    comments,
    line_separator,
    comment_prefix,
    include_trailing_comma,
    remove_comments,
):
    try:
        isort.wrap_modes.hanging_indent(
            statement=statement,
            imports=imports,
            white_space=white_space,
            indent=indent,
            line_length=line_length,
            comments=comments,
            line_separator=line_separator,
            comment_prefix=comment_prefix,
            include_trailing_comma=include_trailing_comma,
            remove_comments=remove_comments,
        )
    except ValueError:
        reject()

@given(
    statement=st.text(),
    imports=st.lists(st.text()),
    white_space=st.text(),
    indent=st.text(),
    line_length=st.integers(),
    comments=st.lists(st.text()),
    line_separator=st.text(),
    comment_prefix=st.text(),
    include_trailing_comma=st.booleans(),
    remove_comments=st.booleans(),
)
def test_fuzz_hanging_indent_with_parentheses(
    statement,
    imports,
    white_space,
    indent,
    line_length,
    comments,
    line_separator,
    comment_prefix,
    include_trailing_comma,
    remove_comments,
):
    try:
        isort.wrap_modes.hanging_indent_with_parentheses(
            statement=statement,
            imports=imports,
            white_space=white_space,
            indent=indent,
            line_length=line_length,
            comments=comments,
            line_separator=line_separator,
            comment_prefix=comment_prefix,
            include_trailing_comma=include_trailing_comma,
            remove_comments=remove_comments,
        )
    except ValueError:
        reject()

@given(
    statement=st.text(),
    imports=st.lists(st.text()),
    white_space=st.text(),
    indent=st.text(),
    line_length=st.integers(),
    comments=st.lists(st.text()),
    line_separator=st.text(),
    comment_prefix=st.text(),
    include_trailing_comma=st.booleans(),
    remove_comments=st.booleans(),
)
def test_fuzz_noqa(
    statement,
    imports,
    white_space,
    indent,
    line_length,
    comments,
    line_separator,
    comment_prefix,
    include_trailing_comma,
    remove_comments,
):
    try:
        isort.wrap_modes.noqa(
            statement=statement,
            imports=imports,
            white_space=white_space,
            indent=indent,
            line_length=line_length,
            comments=comments,
            line_separator=line_separator,
            comment_prefix=comment_prefix,
            include_trailing_comma=include_trailing_comma,
            remove_comments=remove_comments,
        )
    except ValueError:
        reject()

@given(
    statement=st.text(),
    imports=st.lists(st.text()),
    white_space=st.text(),
    indent=st.text(),
    line_length=st.integers(),
    comments=st.lists(st.text()),
    line_separator=st.text(),
    comment_prefix=st.text(),
    include_trailing_comma=st.booleans(),
    remove_comments=st.booleans(),
)
def test_fuzz_vertical(
    statement,
    imports,
    white_space,
    indent,
    line_length,
    comments,
    line_separator,
    comment_prefix,
    include_trailing_comma,
    remove_comments,
):
    try:
        isort.wrap_modes.vertical(
            statement=statement,
            imports=imports,
            white_space=white_space,
            indent=indent,
            line_length=line_length,
            comments=comments,
            line_separator=line_separator,
            comment_prefix=comment_prefix,
            include_trailing_comma=include_trailing_comma,
            remove_comments=remove_comments,
        )
    except ValueError:
        reject()

@given(
    statement=st.text(),
    imports=st.lists(st.text()),
    white_space=st.text(),
    indent=st.text(),
    line_length=st.integers(),
    comments=st.lists(st.text()),
    line_separator=st.text(),
    comment_prefix=st.text(),
    include_trailing_comma=st.booleans(),
    remove_comments=st.booleans(),
)
def test_fuzz_vertical_grid(
    statement,
    imports,
    white_space,
    indent,
    line_length,
    comments,
    line_separator,
    comment_prefix,
    include_trailing_comma,
    remove_comments,
):
    try:
        isort.wrap_modes.vertical_grid(
            statement=statement,
            imports=imports,
            white_space=white_space,
            indent=indent,
            line_length=line_length,
            comments=comments,
            line_separator=line_separator,
            comment_prefix=comment_prefix,
            include_trailing_comma=include_trailing_comma,
            remove_comments=remove_comments,
        )
    except ValueError:
        reject()

@given(
    statement=st.text(),
    imports=st.lists(st.text()),
    white_space=st.text(),
    indent=st.text(),
    line_length=st.integers(),
    comments=st.lists(st.text()),
    line_separator=st.text(),
    comment_prefix=st.text(),
    include_trailing_comma=st.booleans(),
    remove_comments=st.booleans(),
)
def test_fuzz_vertical_grid_grouped(
    statement,
    imports,
    white_space,
    indent,
    line_length,
    comments,
    line_separator,
    comment_prefix,
    include_trailing_comma,
    remove_comments,
):
    try:
        isort.wrap_modes.vertical_grid_grouped(
            statement=statement,
            imports=imports,
            white_space=white_space,
            indent=indent,
            line_length=line_length,
            comments=comments,
            line_separator=line_separator,
            comment_prefix=comment_prefix,
            include_trailing_comma=include_trailing_comma,
            remove_comments=remove_comments,
        )
    except ValueError:
        reject()

@given(
    statement=st.text(),
    imports=st.lists(st.text()),
    white_space=st.text(),
    indent=st.text(),
    line_length=st.integers(),
    comments=st.lists(st.text()),
    line_separator=st.text(),
    comment_prefix=st.text(),
    include_trailing_comma=st.booleans(),
    remove_comments=st.booleans(),
)
def test_fuzz_vertical_hanging_indent(
    statement,
    imports,
    white_space,
    indent,
    line_length,
    comments,
    line_separator,
    comment_prefix,
    include_trailing_comma,
    remove_comments,
):
    try:
        isort.wrap_modes.vertical_hanging_indent(
            statement=statement,
            imports=imports,
            white_space=white_space,
            indent=indent,
            line_length=line_length,
            comments=comments,
            line_separator=line_separator,
            comment_prefix=comment_prefix,
            include_trailing_comma=include_trailing_comma,
            remove_comments=remove_comments,
        )
    except ValueError:
        reject()

@given(
    statement=st.text(),
    imports=st.lists(st.text()),
    white_space=st.text(),
    indent=st.text(),
    line_length=st.integers(),
    comments=st.lists(st.text()),
    line_separator=st.text(),
    comment_prefix=st.text(),
    include_trailing_comma=st.booleans(),
    remove_comments=st.booleans(),
)
def test_fuzz_vertical_hanging_indent_bracket(
    statement,
    imports,
    white_space,
    indent,
    line_length,
    comments,
    line_separator,
    comment_prefix,
    include_trailing_comma,
    remove_comments,
):
    try:
        isort.wrap_modes.vertical_hanging_indent_bracket(
            statement=statement,
            imports=imports,
            white_space=white_space,
            indent=indent,
            line_length=line_length,
            comments=comments,
            line_separator=line_separator,
            comment_prefix=comment_prefix,
            include_trailing_comma=include_trailing_comma,
            remove_comments=remove_comments,
        )
    except ValueError:
        reject()

@given(
    statement=st.text(),
    imports=st.lists(st.text()),
    white_space=st.text(),
    indent=st.text(),
    line_length=st.integers(),
    comments=st.lists(st.text()),
    line_separator=st.text(),
    comment_prefix=st.text(),
    include_trailing_comma=st.booleans(),
    remove_comments=st.booleans(),
)
def test_fuzz_vertical_prefix_from_module_import(
    statement,
    imports,
    white_space,
    indent,
    line_length,
    comments,
    line_separator,
    comment_prefix,
    include_trailing_comma,
    remove_comments,
):
    try:
        isort.wrap_modes.vertical_prefix_from_module_import(
            statement=statement,
            imports=imports,
            white_space=white_space,
            indent=indent,
            line_length=line_length,
            comments=comments,
            line_separator=line_separator,
            comment_prefix=comment_prefix,
            include_trailing_comma=include_trailing_comma,
            remove_comments=remove_comments,
        )
    except ValueError:
        reject()


text:
package org.jvnet.hudson.test;

import org.jvnet.hudson.test.recipes.Recipe;
import org.jvnet.hudson.test.recipes.WithPlugin;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * An annotation for test methods that do not require the {@link JenkinsRule}/{@link HudsonTestCase} to create and tear down the jenkins
 * instance.
 */
@Retention(RUNTIME)
@Documented
@Target(METHOD)
@Recipe(WithoutJenkins.RunnerImpl.class)
public @interface WithoutJenkins {
    class RunnerImpl extends Recipe.Runner<WithPlugin> {
        // bogus. this recipe is handled differently by HudsonTestCase
    }
}


text:
package com.opengamma.analytics.math.rootfinding;

import org.testng.annotations.Test;

import com.opengamma.util.test.TestGroup;

/**
 * Test.
 */
@Test(groups = TestGroup.UNIT)
public class BisectionSingleRootFinderTest extends RealSingleRootFinderTestCase {
  private static final RealSingleRootFinder FINDER = new BisectionSingleRootFinder();

  @Override
  protected RealSingleRootFinder getRootFinder() {
    return FINDER;
  }

}


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Moq;
using System.Reflection;

namespace Moqzilla
{
    /// <summary>
    /// A container for dynamically creating mocks.
    /// </summary>
    public class Mocker
    {
        /// <summary>
        /// Mock repository. Values are Mock of T
        /// </summary>
        private readonly IDictionary<Type, object> _mockRepository;

        /// <summary>
        /// Activator repository. Values are Action of T
        /// </summary>
        private readonly IDictionary<Type, object> _activatorRepository;

        /// <summary>
        /// Concrete implementation repository. Values are T.
        /// </summary>
        private readonly IDictionary<Type, object> _concreteRepository;

        /// <summary>
        /// Cached empty Type array.
        /// </summary>
        private static readonly Type[] EmptyTypeArray = { };

        /// <summary>
        /// Cached empty object array.
        /// </summary>
        private static readonly object[] EmptyObjectArray = { };

        /// <summary>
        /// Create a Moqzilla container.
        /// </summary>
        public Mocker()
        {
            _mockRepository = new Dictionary<Type, object>();
            _activatorRepository = new Dictionary<Type, object>();
            _concreteRepository = new Dictionary<Type, object>();
        }

        /// <summary>
        /// Returns TRUE if the specified type is an interface type.
        /// </summary>
        private static bool TypeIsInterface(Type type)
        {
            return type.GetTypeInfo().IsInterface;
        }

        /// <summary>
        /// Creates an object, mocking up all dependencies in the constructor.
        /// </summary>
        /// <exception cref="MockerException">Thrown when no mockable constructor could be found.</exception>
        public TSubject Create<TSubject>()
            where TSubject : class
        {
            // Cache constructor parameters.
            var type = typeof(TSubject);
            var constructors = type.GetConstructors();
            var parameters = constructors
                .ToDictionary(c => c, c => c.GetParameters());

            // Determine which constructors we can use.
            var validConstructors = constructors
                .Where(c => parameters[c]
                    .All(p => TypeIsInterface(p.ParameterType)))
                .ToArray();

            // If there are no constructors, fail.
            if (!validConstructors.Any())
                throw new MockerException(MockerExceptionType.NoValidConstructors);

            // Choose the constructor with the most dependencies.
            var mostSpecificConstructor = constructors
                .OrderByDescending(c => parameters[c].Length)
                .First();

            // Pull mocked objects for the constructor from the repository.
            var constructorArguments = parameters[mostSpecificConstructor]
                .Select(p => GetConcrete(p.ParameterType) ?? Get(p.ParameterType).Object)
                .ToArray();

            // Run activations.
            foreach (var parameter in parameters[mostSpecificConstructor])
            {
                if (!_activatorRepository.ContainsKey(parameter.ParameterType))
                    continue;

                // Don't activate concrete implementations.
                if (_concreteRepository.ContainsKey(parameter.ParameterType))
                    continue;

                var activator = _activatorRepository[parameter.ParameterType];
                var activatorType = activator.GetType();
                activatorType.GetMethod("Invoke")?.Invoke(activator, new object[] { Get(parameter.ParameterType) });
            }

            // Instantiate the object.
            return (TSubject)mostSpecificConstructor.Invoke(constructorArguments);
        }

        /// <summary>
        /// Get a concrete implementation from the repository for a type determined at runtime.
        /// </summary>
        protected object GetConcrete(Type type)
        {
            return _concreteRepository.ContainsKey(type)
                ? _concreteRepository[type]
                : null;
        }

        /// <summary>
        /// Get a mock from the repository for a type determined at runtime.
        /// </summary>
        protected Mock Get(Type type)
        {
            // Return a cached mock, if we have one.
            if (_mockRepository.ContainsKey(type))
                return (Mock)_mockRepository[type];

            // Create a mock - reflection is needed for invocation due to how Moq works.
            var mock = typeof(Mock<>)
                .MakeGenericType(type)
                .GetConstructor(EmptyTypeArray)
                ?.Invoke(EmptyObjectArray);

            _mockRepository[type] = mock;
            return (Mock)mock;
        }

        /// <summary>
        /// Get a mock from the container.
        /// </summary>
        public Mock<TSubject> Mock<TSubject>()
            where TSubject : class
        {
            var type = typeof(TSubject);

            if (_mockRepository.ContainsKey(type))
                return (Mock<TSubject>) _mockRepository[type];

            var mock = new Mock<TSubject>();
            _mockRepository[type] = mock;
            return mock;
        }

        /// <summary>
        /// Set up a mock within the container. This allows you to pass in
        /// a block solely for the purpose of configuring a mock.
        /// </summary>
        public Mock<TSubject> Mock<TSubject>(Action<Mock<TSubject>> setupMethod)
            where TSubject : class
        {
            var mock = Mock<TSubject>();
            setupMethod?.Invoke(mock);
            return mock;
        }

        /// <summary>
        /// Removes all mocks from the container. Objects created with
        /// <see cref="Create{TSubject}"/> prior to this call are not affected.
        /// This does not clear activations.
        /// </summary>
        public void Reset()
        {
            _mockRepository.Clear();
        }

        /// <summary>
        /// Removes a single mock from the container. Objects created with
        /// <see cref="Create{TSubject}"/> prior to this call are not affected.
        /// This does not clear activations.
        /// </summary>
        public void Reset<TSubject>()
        {
            _mockRepository.Remove(typeof(TSubject));
        }

        /// <summary>
        /// Injects a mock into the container. Objects created with
        /// <see cref="Create{TSubject}"/> prior to this call are not affected.
        /// </summary>
        /// <exception cref="ArgumentNullException">Thrown when the specified mock is null.</exception>
        public void Inject<TSubject>(Mock<TSubject> mock)
            where TSubject : class
        {
            _mockRepository[typeof(TSubject)] = mock
                ?? throw new ArgumentNullException(nameof(mock));
        }

        /// <summary>
        /// Injects a concrete implementation into the container. Objects created with
        /// <see cref="Create{TSubject}"/> prior to this call are not affected.
        /// </summary>
        /// <exception cref="ArgumentNullException">Thrown when the specified object is null.</exception>
        public void Implement<TSubject>(TSubject obj)
            where TSubject : class
        {
            _concreteRepository[typeof(TSubject)] = obj
                ?? throw new ArgumentNullException(nameof(obj));
        }

        /// <summary>
        /// Registers an activation. When <see cref="Create{TSubject}"/> is invoked,
        /// activations are invoked before object creation. This is used to set up consistent parts
        /// of a mock.
        /// </summary>
        public void Activate<TSubject>(Action<Mock<TSubject>> activator)
            where TSubject : class
        {
            var type = typeof(TSubject);

            if (_activatorRepository.ContainsKey(type))
            {
                // Chain existing activations.
                var currentActivation = (Action<Mock<TSubject>>)_activatorRepository[type];
                _activatorRepository[type] = (Action<Mock<TSubject>>)(mock =>
                {
                    currentActivation(mock);
                    activator(mock);
                });
            }
            else
            {
                _activatorRepository[type] = activator;
            }
        }
    }
}


text:
#pragma once
#include <aws/dynamodbstreams/DynamoDBStreams_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace DynamoDBStreams
{
namespace Model
{

  /**
   *
The beginning and ending sequence numbers for the stream records contained
   * within a shard.

See Also:
   AWS
   * API Reference

   */
  class AWS_DYNAMODBSTREAMS_API SequenceNumberRange
  {
  public:
    SequenceNumberRange();
    SequenceNumberRange(Aws::Utils::Json::JsonView jsonValue);
    SequenceNumberRange& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The first sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline const Aws::String& GetStartingSequenceNumber() const{ return m_startingSequenceNumber; }

    /**
     *
The first sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline bool StartingSequenceNumberHasBeenSet() const { return m_startingSequenceNumberHasBeenSet; }

    /**
     *
The first sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline void SetStartingSequenceNumber(const Aws::String& value) { m_startingSequenceNumberHasBeenSet = true; m_startingSequenceNumber = value; }

    /**
     *
The first sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline void SetStartingSequenceNumber(Aws::String&& value) { m_startingSequenceNumberHasBeenSet = true; m_startingSequenceNumber = std::move(value); }

    /**
     *
The first sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline void SetStartingSequenceNumber(const char* value) { m_startingSequenceNumberHasBeenSet = true; m_startingSequenceNumber.assign(value); }

    /**
     *
The first sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline SequenceNumberRange& WithStartingSequenceNumber(const Aws::String& value) { SetStartingSequenceNumber(value); return *this;}

    /**
     *
The first sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline SequenceNumberRange& WithStartingSequenceNumber(Aws::String&& value) { SetStartingSequenceNumber(std::move(value)); return *this;}

    /**
     *
The first sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline SequenceNumberRange& WithStartingSequenceNumber(const char* value) { SetStartingSequenceNumber(value); return *this;}

    /**
     *
The last sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline const Aws::String& GetEndingSequenceNumber() const{ return m_endingSequenceNumber; }

    /**
     *
The last sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline bool EndingSequenceNumberHasBeenSet() const { return m_endingSequenceNumberHasBeenSet; }

    /**
     *
The last sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline void SetEndingSequenceNumber(const Aws::String& value) { m_endingSequenceNumberHasBeenSet = true; m_endingSequenceNumber = value; }

    /**
     *
The last sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline void SetEndingSequenceNumber(Aws::String&& value) { m_endingSequenceNumberHasBeenSet = true; m_endingSequenceNumber = std::move(value); }

    /**
     *
The last sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline void SetEndingSequenceNumber(const char* value) { m_endingSequenceNumberHasBeenSet = true; m_endingSequenceNumber.assign(value); }

    /**
     *
The last sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline SequenceNumberRange& WithEndingSequenceNumber(const Aws::String& value) { SetEndingSequenceNumber(value); return *this;}

    /**
     *
The last sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline SequenceNumberRange& WithEndingSequenceNumber(Aws::String&& value) { SetEndingSequenceNumber(std::move(value)); return *this;}

    /**
     *
The last sequence number for the stream records contained within a shard.
     * String contains numeric characters only.

     */
    inline SequenceNumberRange& WithEndingSequenceNumber(const char* value) { SetEndingSequenceNumber(value); return *this;}

  private:

    Aws::String m_startingSequenceNumber;
    bool m_startingSequenceNumberHasBeenSet = false;

    Aws::String m_endingSequenceNumber;
    bool m_endingSequenceNumberHasBeenSet = false;
  };

} // namespace Model
} // namespace DynamoDBStreams
} // namespace Aws


text:
//
//  NSMutableArray+STKit.m
//  IOS自定义常用控件
//
//  Created by ST on 17/3/1.
//  Copyright © 2017年 ST. All rights reserved.
//

#import "NSMutableArray+STKit.h"
#import "NSArray+STKit.h"

@implementation NSMutableArray (STKit)

/* 获取在安全模式下给定索引的对象(如果自身是空的则无 */
- (id)safeObjectAtIndex:(NSUInteger)index
{
    if([self count] > 0 && [self count] > index)
        return [self objectAtIndex:index];
    else
        return nil;
}
/* 移动对象从一个索引到另一个索引 */
- (void)moveObjectFromIndex:(NSUInteger)from
                    toIndex:(NSUInteger)to
{
    if(to != from)
    {
        id obj = [self safeObjectAtIndex:from];
        // 删除集合指定的元素
        [self removeObjectAtIndex:from];

        if(to >= [self count])
            // 向集合添加元素
            [self addObject:obj];
        else
            // 向集合的指定位置插入一个元素
            [self insertObject:obj
                       atIndex:to];
    }
}

/* 创建反向数组 */
- (NSMutableArray *)reversedArray
{
    return (NSMutableArray *)[NSArray reversedArray:self];
}

/* 获取给定的键值和排序的数组 */
+ (NSMutableArray *)sortArrayByKey:(NSString *)key
                             array:(NSMutableArray *)array
                         ascending:(BOOL)ascending
{
    NSMutableArray *tempArray = [[NSMutableArray alloc] init];
    // 集合移除全部对象
    [tempArray removeAllObjects];
    // 向集合尾部添加指定集合
    [tempArray addObjectsFromArray:array];
    // 初始化一个指定键值和排序的排序描述器
    NSSortDescriptor *brandDescriptor = [[NSSortDescriptor alloc] initWithKey:key ascending:ascending];
    NSArray *sortDescriptors = [NSArray arrayWithObjects:brandDescriptor, nil];
    // 通过排序接收机对象返回一个新的数组
    NSArray *sortedArray = [tempArray sortedArrayUsingDescriptors:sortDescriptors];
    [tempArray removeAllObjects];
    tempArray = (NSMutableArray *)sortedArray;
    [array removeAllObjects];
    [array addObjectsFromArray:tempArray];

    return array;
}

@end


text:
var annotationsStore = {

    annotations:[],
    removedAnnotations:[],

    append: function (annotation) {
        if(!annotation.hasOwnProperty('id'))
            return;
        for(var existing in this.annotations){
            if(existing.id == annotation.id)
                return;
        }
        this.annotations.push(annotation);
    },

    remove: function (annotation) {
        this.annotations = $.grep(this.annotations, function(value) {
            return value.id != annotation.id;
        });
        this.removedAnnotations.push(annotation);
    },

    init: function (data) {
        this.annotations = data;
    }
};


text:
package thecave.matrixcontrol.device.commands;

public class InfoCommand extends AbstractCommand {
    private String name;
    private String version;

    @Override
    public String getRequest() {
        return "?";
    }

    public String getName() {
        return name;
    }

    public String getVersion() {
        return version;
    }

    @Override
    protected void parseResponse(String response) {
        String[] split = response.split("\\/");
        if (split.length != 2) throw new IllegalStateException("Unknown version string '" + response + "'");

        name = split[0];
        version = split[1];
    }

    @Override
    public String toString() {
        return "InfoCommand{" +
                "name='" + name + '\'' +
                ", version='" + version + '\'' +
                '}';
    }
}


text:
package org.openkilda.messaging.nbtopology.request;

import org.openkilda.messaging.nbtopology.annotations.ReadRequest;

@ReadRequest
public class GetSwitchesRequest extends SwitchesBaseRequest {

}


text:
require File.expand_path(File.dirname(__FILE__) + '/../../../../../spec/spec_helper')

describe MemcachedProtected::ProtectedAccess do

  describe ".read" do

    it "should generate a protected key" do
      Rails.original_cache.should_receive(:read).with("58efdc201e7a8f6f621d47146beaa3d6186339b2")
      MemcachedProtected::ProtectedAccess.read("very big key"*251).should be_nil
    end

  end

  describe ".write" do

    it "should generate a protected key" do
      Rails.original_cache.should_receive(:write).with("58efdc201e7a8f6f621d47146beaa3d6186339b2", "content")
      MemcachedProtected::ProtectedAccess.write("very big key"*251, "content").should be_nil
    end

  end

end


text:
import { Context, Middleware } from '../core/road';
import * as url_module from 'url';
import Response from '../core/response';

/**
 * Any requests with trailing slashes will immediately return a Response object redirecting to a non-trailing-slash path
 */
export const middleware: Middleware<Context> = function (method, url, body, headers, next) {
	// TODO: parse is deprecated, but the URL object that replaces it doesn't do what I need it to
	const parsedUrl = url_module.parse(url);
	const parsedPath = parsedUrl.path;

	if (!parsedPath) {
		return next();
	}

	// kill trailing slash as long as we aren't at the root level
	if (parsedPath !== '/' && parsedPath[parsedPath.length - 1] === '/') {
		return Promise.resolve(new Response('', 302, {
			location : parsedPath.substring(0, parsedPath.length - 1)
		}));
	}

	return next();
};


text:
<?php
// src/Man/FinanceBundle/DataFixtures/ORM/LoadOwnerData.php
namespace Man\FinanceBundle\DataFixtures\ORM;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Man\FinanceBundle\Entity\Owner;

class LoadOwnerData extends AbstractFixture implements OrderedFixtureInterface
{
  public function load(ObjectManager $em)
  {
    $owner1 = new Owner();
    $owner1->setOwnerName('บริษัท เงินด่วน ทวีชัย จำกัด');
	$owner1->setIsDefault( true );

    $owner2 = new Owner();
    $owner2->setOwnerName('นางสาวธารีรัตน์ ศรีวสุทธิ์');
	$owner2->setIsDefault( false );

    $owner3 = new Owner();
    $owner3->setOwnerName('นายธานัท สมพงษ์');
	$owner3->setIsDefault( false );

    $owner4 = new Owner();
    $owner4->setOwnerName('นายทวี ศรีวสุทธิ์');
	$owner4->setIsDefault( false );

    $owner5 = new Owner();
    $owner5->setOwnerName('นางนงเยาว์ ศรีวสุทธิ์');
	$owner5->setIsDefault( false );

    $em->persist($owner1);
	$em->persist($owner2);
	$em->persist($owner3);
	$em->persist($owner4);
	$em->persist($owner5);
    $em->flush();

    $this->addReference('owner1', $owner1);
	$this->addReference('owner2', $owner2);
	$this->addReference('owner3', $owner3);
	$this->addReference('owner4', $owner4);
	$this->addReference('owner5', $owner5);

  }

  public function getOrder()
  {
    return 8; // the order in which fixtures will be loaded
  }
}