text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
IvyNodeEviction.EvictionData
</TITLE>

<META NAME="date" CONTENT="2013-01-10">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.apache.ivy.core.resolve

Class IvyNodeEviction.EvictionData

java.lang.Object
  org.apache.ivy.core.resolve.IvyNodeEviction.EvictionData

Enclosing class:
IvyNodeEviction

public static class IvyNodeEviction.EvictionData
extends java.lang.Object

This class contains data about the eviction of an IvyNode.

Constructor Summary

IvyNodeEviction.EvictionData(java.lang.String rootModuleConf,
                             IvyNode parent,
                             ConflictManager conflictManager,
                             java.util.Collection selected)

          Creates a new object containing the eviction data of an IvyNode.

IvyNodeEviction.EvictionData(java.lang.String rootModuleConf,
                             IvyNode parent,
                             ConflictManager conflictManager,
                             java.util.Collection selected,
                             java.lang.String detail)

          Creates a new object containing the eviction data of an IvyNode.

Method Summary

 ConflictManager
getConflictManager()

 java.lang.String
getDetail()

 IvyNode
getParent()

 java.lang.String
getRootModuleConf()

 java.util.Collection
getSelected()

 boolean
isTransitivelyEvicted()

 java.lang.String
toString()

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

IvyNodeEviction.EvictionData

public IvyNodeEviction.EvictionData(java.lang.String rootModuleConf,
                                    IvyNode parent,
                                    ConflictManager conflictManager,
                                    java.util.Collection selected)

Creates a new object containing the eviction data of an IvyNode.

Parameters:
rootModuleConf - the root module configuration
parent - the parent node (or <tt>null</tt> in case of transitive eviction)
conflictManager - the conflict manager which evicted the node (or <tt>null</tt> in case of
            transitive eviction)
selected - a collection of IvyNodes which evict the evicted node (or
            <tt>null</tt> in case of transitive eviction)

IvyNodeEviction.EvictionData

public IvyNodeEviction.EvictionData(java.lang.String rootModuleConf,
                                    IvyNode parent,
                                    ConflictManager conflictManager,
                                    java.util.Collection selected,
                                    java.lang.String detail)

Creates a new object containing the eviction data of an IvyNode.

Parameters:
rootModuleConf - the root module configuration
parent - the parent node (or <tt>null</tt> in case of transitive eviction)
conflictManager - the conflict manager which evicted the node (or <tt>null</tt> in case of
            transitive eviction)
selected - a collection of IvyNodes which evict the evicted node (or
            <tt>null</tt> in case of transitive eviction)
detail - a String detailing the reason why the node was evicted

Method Detail

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

getConflictManager

public ConflictManager getConflictManager()

getParent

public IvyNode getParent()

getSelected

public java.util.Collection getSelected()

getRootModuleConf

public java.lang.String getRootModuleConf()

isTransitivelyEvicted

public boolean isTransitivelyEvicted()

getDetail

public java.lang.String getDetail()

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
using System;
using System.Collections.Generic;
using System.Linq;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Serialization;

namespace nHydrate.Generator.Common.Util
{
    public static class Extensions
    {
        /// <summary>
        /// Determines if the data type is a database type of Int,BigInt,TinyInt,SmallInt
        /// </summary>
        public static bool IsIntegerType(this System.Data.SqlDbType type)
        {
            switch (type)
            {
                case System.Data.SqlDbType.BigInt:
                case System.Data.SqlDbType.Int:
                case System.Data.SqlDbType.TinyInt:
                case System.Data.SqlDbType.SmallInt:
                    return true;
            }
            return false;
        }

        /// <summary>
        /// Determines if the data type is a database character type of Binary,Image,VarBinary
        /// </summary>
        public static bool IsBinaryType(this System.Data.SqlDbType type)
        {
            switch (type)
            {
                case System.Data.SqlDbType.Binary:
                case System.Data.SqlDbType.Image:
                case System.Data.SqlDbType.VarBinary:
                    return true;
                default:
                    return false;
            }
        }

        /// <summary>
        /// Determines if the data type is a database character type of Char,NChar,NText,NVarChar,Text,VarChar,Xml
        /// </summary>
        public static bool IsTextType(this System.Data.SqlDbType type)
        {
            switch (type)
            {
                case System.Data.SqlDbType.Char:
                case System.Data.SqlDbType.NChar:
                case System.Data.SqlDbType.NText:
                case System.Data.SqlDbType.NVarChar:
                case System.Data.SqlDbType.Text:
                case System.Data.SqlDbType.VarChar:
                case System.Data.SqlDbType.Xml:
                    return true;
                default:
                    return false;
            }
        }

        public static bool IsNString(this Models.Column column) => column?.DataType.IsNString() == true;

        public static bool IsNString(this System.Data.SqlDbType type)
        {
            switch (type)
            {
                case System.Data.SqlDbType.NChar:
                case System.Data.SqlDbType.NText:
                case System.Data.SqlDbType.NVarChar:
                    return true;
                default:
                    return false;
            }
        }

        /// <summary>
        /// Determines if the data type is a database character type of DateTime,DateTime2,DateTimeOffset,SmallDateTime
        /// </summary>
        public static bool IsDateType(this System.Data.SqlDbType type)
        {
            switch (type)
            {
                case System.Data.SqlDbType.Date:
                case System.Data.SqlDbType.DateTime:
                case System.Data.SqlDbType.DateTime2:
                case System.Data.SqlDbType.DateTimeOffset:
                case System.Data.SqlDbType.SmallDateTime:
                    return true;
            }
            return false;
        }

        /// <summary>
        /// Determines if the type is a number wither floating point or integer
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static bool IsNumericType(this System.Data.SqlDbType type)
        {
            return IsDecimalType(type) || IsIntegerType(type) || IsMoneyType(type);
        }

        /// <summary>
        /// Determines if the data type is a database type of Money,SmallMoney
        /// </summary>
        public static bool IsMoneyType(this System.Data.SqlDbType type)
        {
            switch (type)
            {
                case System.Data.SqlDbType.Money:
                case System.Data.SqlDbType.SmallMoney:
                    return true;
            }
            return false;
        }

        /// <summary>
        /// Determines if the data type is a database type of Decimal,Float,Real
        /// </summary>
        public static bool IsDecimalType(this System.Data.SqlDbType type)
        {
            switch (type)
            {
                case System.Data.SqlDbType.Decimal:
                case System.Data.SqlDbType.Float:
                case System.Data.SqlDbType.Real:
                    return true;
            }
            return false;
        }

        /// <summary>
        /// Determines if this type supports the MAX syntax in SQL 2008
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static bool SupportsMax(this System.Data.SqlDbType type)
        {
            switch (type)
            {
                case System.Data.SqlDbType.VarChar:
                case System.Data.SqlDbType.NVarChar:
                case System.Data.SqlDbType.VarBinary:
                    return true;
                default:
                    return false;
            }
        }

        public static bool DefaultIsString(this System.Data.SqlDbType type)
        {
            switch (type)
            {
                case System.Data.SqlDbType.BigInt: return false;
                case System.Data.SqlDbType.Binary: return true;
                case System.Data.SqlDbType.Bit: return false;
                case System.Data.SqlDbType.Char: return true;
                case System.Data.SqlDbType.DateTime: return false;
                case System.Data.SqlDbType.Decimal: return false;
                case System.Data.SqlDbType.Float: return false;
                case System.Data.SqlDbType.Image: return true;
                case System.Data.SqlDbType.Int: return false;
                case System.Data.SqlDbType.Money: return false;
                case System.Data.SqlDbType.NChar: return true;
                case System.Data.SqlDbType.NText: return true;
                case System.Data.SqlDbType.NVarChar: return true;
                case System.Data.SqlDbType.Real: return false;
                case System.Data.SqlDbType.SmallDateTime: return false;
                case System.Data.SqlDbType.SmallInt: return false;
                case System.Data.SqlDbType.SmallMoney: return false;
                case System.Data.SqlDbType.Text: return true;
                case System.Data.SqlDbType.Timestamp: return false;
                case System.Data.SqlDbType.TinyInt: return false;
                case System.Data.SqlDbType.Udt: return false;
                case System.Data.SqlDbType.UniqueIdentifier: return true;
                case System.Data.SqlDbType.VarBinary: return true;
                case System.Data.SqlDbType.VarChar: return true;
                case System.Data.SqlDbType.Variant: return true;
                case System.Data.SqlDbType.Xml: return true;
                default: return false;
            }
        }

        /// <summary>
        /// Gets the SQL equivalent for this default value
        /// </summary>
        /// <returns></returns>
        public static string GetSQLDefault(this System.Data.SqlDbType dataType, string defaultValue)
        {
            var retval = string.Empty;
            if ((dataType == System.Data.SqlDbType.DateTime) || (dataType == System.Data.SqlDbType.SmallDateTime))
            {
                if (defaultValue == "getdate")
                {
                    //retval = defaultValue;
                }
                else if (defaultValue == "sysdatetime")
                {
                    //retval = defaultValue;
                }
                else if (defaultValue == "getutcdate")
                {
                    //retval = defaultValue;
                }
                else if (defaultValue.StartsWith("getdate+"))
                {
                    //Do Nothing - Cannot calculate
                }
                //else if (daatType == System.Data.SqlDbType.SmallDateTime)
                //{
                //  defaultValue = String.Format("new DateTime(1900, 1, 1)", this.PascalName);
                //}
                //else
                //{
                //  defaultValue = String.Format("new DateTime(1753, 1, 1)", this.PascalName);
                //}
            }
            else if (dataType == System.Data.SqlDbType.Char)
            {
                retval = "' '";
                if (defaultValue.Length == 1)
                    retval = "'" + defaultValue[0].ToString().DoubleTicks() + "'";
            }
            else if (dataType.IsBinaryType())
            {
                //Do Nothing - Cannot calculate
            }
            //else if (dataType == System.Data.SqlDbType.DateTimeOffset)
            //{
            //  defaultValue = "DateTimeOffset.MinValue";
            //}
            //else if (this.IsDateType)
            //{
            //  defaultValue = "System.DateTime.MinValue";
            //}
            //else if (dataType == System.Data.SqlDbType.Time)
            //{
            //  defaultValue = "0";
            //}
            else if (dataType == System.Data.SqlDbType.UniqueIdentifier)
            {
                //Do Nothing
                //if ((StringHelper.Match(defaultValue, "newid", true)) || (StringHelper.Match(defaultValue, "newid()", true)))
                //  retval = "newid";
                //else if (string.IsNullOrEmpty(defaultValue))
                //  retval = string.Empty;
                //else
                //{
                //  Guid g;
                //  if (Guid.TryParse(defaultValue, out g))
                //    retval = "'" + g.ToString() + "'";
                //}
            }
            else if (dataType.IsIntegerType())
            {
                if (int.TryParse(defaultValue, out _))
                    retval = defaultValue;
            }
            else if (dataType.IsNumericType())
            {
                if (double.TryParse(defaultValue, out _))
                {
                    retval = defaultValue;
                }
            }
            else if (dataType == System.Data.SqlDbType.Bit)
            {
                if (defaultValue == "0" || defaultValue == "1")
                    retval = defaultValue;
            }
            else
            {
                if (dataType.IsTextType() && !defaultValue.IsEmpty())
                    retval = "'" + defaultValue.DoubleTicks() + "'";
            }
            return retval;
        }

        public static string GetPostgresDefault(this System.Data.SqlDbType dataType, string defaultValue)
        {
            var retval = string.Empty;
            if ((dataType == System.Data.SqlDbType.DateTime) || (dataType == System.Data.SqlDbType.SmallDateTime))
            {
                if (defaultValue == "getdate")
                {
                    //retval = defaultValue;
                }
                else if (defaultValue == "sysdatetime")
                {
                    //retval = defaultValue;
                }
                else if (defaultValue == "getutcdate")
                {
                    //retval = defaultValue;
                }
                else if (defaultValue.StartsWith("getdate+"))
                {
                    //Do Nothing - Cannot calculate
                }
                //else if (daatType == System.Data.SqlDbType.SmallDateTime)
                //{
                //  defaultValue = String.Format("new DateTime(1900, 1, 1)", this.PascalName);
                //}
                //else
                //{
                //  defaultValue = String.Format("new DateTime(1753, 1, 1)", this.PascalName);
                //}
            }
            else if (dataType == System.Data.SqlDbType.Char)
            {
                retval = "' '";
                if (defaultValue.Length == 1)
                    retval = "'" + defaultValue[0].ToString().DoubleTicks() + "'";
            }
            else if (dataType.IsBinaryType())
            {
                //Do Nothing - Cannot calculate
            }
            //else if (dataType == System.Data.SqlDbType.DateTimeOffset)
            //{
            //  defaultValue = "DateTimeOffset.MinValue";
            //}
            //else if (this.IsDateType)
            //{
            //  defaultValue = "System.DateTime.MinValue";
            //}
            //else if (dataType == System.Data.SqlDbType.Time)
            //{
            //  defaultValue = "0";
            //}
            else if (dataType == System.Data.SqlDbType.UniqueIdentifier)
            {
                //Do Nothing
                //if ((StringHelper.Match(defaultValue, "newid", true)) || (StringHelper.Match(defaultValue, "newid()", true)))
                //  retval = "newid";
                //else if (defaultValue.IsEmpty())
                //  retval = string.Empty;
                //else
                //{
                //  Guid g;
                //  if (Guid.TryParse(defaultValue, out g))
                //    retval = "'" + g.ToString() + "'";
                //}
            }
            else if (dataType.IsIntegerType())
            {
                if (int.TryParse(defaultValue, out _))
                    retval = defaultValue;
            }
            else if (dataType.IsNumericType())
            {
                if (double.TryParse(defaultValue, out _))
                {
                    retval = defaultValue;
                }
            }
            else if (dataType == System.Data.SqlDbType.Bit)
            {
                if (defaultValue == "0" || defaultValue == "1")
                    retval = (defaultValue == "1") ? "true" : "false";
            }
            else
            {
                if (dataType.IsTextType() && !defaultValue.IsEmpty())
                    retval = "'" + defaultValue.DoubleTicks() + "'";
            }
            return retval;
        }

        /// <summary>
        /// Removes the dashes from a GUID/string
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string FlatGuid(this string str)
        {
            return str.Replace("-", string.Empty);
        }
        public static string FlatGuid(this System.Guid g)
        {
            return g.ToString().FlatGuid();
        }

        public static Guid ToGuid(this string str)
        {
            if (str.IsEmpty()) return Guid.Empty;
            if (Guid.TryParse(str, out Guid v))
                return v;
            return Guid.Empty;
        }

        public static bool IsEmpty(this string str) => string.IsNullOrEmpty(str);

        public static string IfEmptyDefault(this string str, string defaultValue) => string.IsNullOrEmpty(str) ? defaultValue : str;

        public static string IfExistsReturn(this string str, string value) => !string.IsNullOrEmpty(str) ? value : string.Empty;

        public static T ToEnum<T>(this string str)
            where T : struct, System.Enum
        {
            System.Enum.TryParse<T>(str, true, out T v);
            return (T)v;
        }

        public static T ToEnum<T>(this string str, T defaultValue)
            where T : struct, System.Enum
        {
            if (System.Enum.TryParse<T>(str, true, out T v))
                return (T)v;
            return defaultValue;
        }

        public static T AddItem<T>(this List<T> list, T item)
        {
            list.Add(item);
            return item;
        }

        public static T AddNew<T>(this List<T> list)
            where T : new()
        {
            T item = new T();
            list.Add(item);
            return item;
        }

        public static T Convert<T>(this System.Enum type)
            where T : struct, System.Enum
        {
            Enum.TryParse(type.ToString(), out T v);
            return v;
        }

        public static string ToYaml<T>(this T obj)
        {
            if (obj == null) return null;
            var serializer = new YamlDotNet.Serialization.SerializerBuilder()
                    .WithTypeConverter(new SystemTypeTypeConverter())
                    .Build();
            return serializer.Serialize(obj);
        }

        public static T FromYaml<T>(this string value)
        {
            if (string.IsNullOrEmpty(value)) return default(T);
            var serializer = new YamlDotNet.Serialization.DeserializerBuilder()
                   .WithTypeConverter(new SystemTypeTypeConverter())
                   .Build();
            return serializer.Deserialize<T>(value);
        }

        /// <summary>
        /// If null returns new object of type
        /// </summary>
        public static T OrDefault<T>(this T obj) where T : new() => (obj == null) ? new T() : obj;

        public static T[] OrDefault<T>(this T[] obj) where T : new() => (obj == null) ? new T[0] : obj;

        public static bool Is(this BaseModelObject obj, BaseModelObject other) => (obj == null || other == null) ? false : obj.Key == other.Key;

        public static bool IsEnumOnly(this Models.Table obj) => obj?.TypedTable == TypedTableConstants.EnumOnly;

        public static bool IsTypedTable(this Models.Table obj) => obj?.TypedTable != TypedTableConstants.None;

        public static bool IdentityDatabase(this Models.Column obj) => obj?.Identity == IdentityTypeConstants.Database;

        public static bool IdentityNone(this Models.Column obj) => obj?.Identity == IdentityTypeConstants.None;

        public static string RemoveParens(this string str) => str?.Replace("(", string.Empty).Replace(")", string.Empty);

        public static string DoubleTicks(this string str) => str?.Replace("'", "''");

        public static string NormalizeLineEndings(this string str) => str?.Replace("\r\n", "\n").Replace("\r", "\n");

        public static List<string> BreakLines(this string text) => text.NormalizeLineEndings().Split(new char[] { '\n' }, StringSplitOptions.None).ToList() ?? new List<string>();

        public static bool Match(this string str, string compare)
        {
            if (str == null && compare == null) return true;
            if (str == string.Empty && compare == string.Empty) return true;
            return str?.ToLower() == compare?.ToLower();
        }

        public static void Repeat(int count, Action action)
        {
            for (int i = 0; i < count; i++)
            {
                action();
            }
        }
    }

    internal class SystemTypeTypeConverter : IYamlTypeConverter
    {
        public bool Accepts(Type type)
        {
            return typeof(Type).IsAssignableFrom(type);
        }

        public object ReadYaml(IParser parser, Type type)
        {
            var scalar = parser.Expect<Scalar>();
            return Type.GetType(scalar.Value);
        }

        public void WriteYaml(IEmitter emitter, object value, Type type)
        {
            var typeName = ((Type)value).AssemblyQualifiedName;
            emitter.Emit(new Scalar(typeName));
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<!doctype html>

    <title>Source Server Stats</title>
    <link rel="stylesheet" type="text/css" href="/static/font/fontawesome/font.css">


text:
filetype=c

root="$HOME/data/code/public-clones/gish"
working_root='game'

if 0; then # simple setup
    working_set='. ../audio'
    other_set='input math menu parser physics sdl video'

else # complex setup
    # use grep to find the files that we want to build tags for
    # this way I don't need to explicitly list everything.
    #
    taginclude=' input math menu parser physics sdl video'
    # convert to grep format (previous must start with a space!)
    taginclude=${taginclude// / -e /}
    # all of our packages are 2 levels deep. sadly I can't put wholename here
    # because of quoting I think.
    find_args="-maxdepth 2 -mindepth 2 -type d"

    # This is what I think I'll use the most. (engine/src/libraryname/common is
    # for nonplatform-specific code. Ignore the platform-specific stuff.)
    cd $root/$working_root
    #working_set='. ../audio'
    working_set=`find . ../engine/src $find_args -wholename '*common*' | grep $taginclude`
    # add content
    working_set="$working_set ../content/ ../engine/content/"
    cd -
    # This should be everything else (except platform-specific stuff)
    cd $root
    other_set=`find src engine/src $find_args -wholename '*common*' | grep -v $taginclude`
    cd -
fi
# }}}

# General config {{{
temp_name='temp.tags'
cscope=cscope
if command -v $cscope > /dev/null ; then
    echo
else
	cscope=mlcscope
fi
tags_exclude_file=~/.tags_exclude.txt

# }}}

# Database build driver functions {{{

function __run_ctags {
    filetype=$1

    # Instead of matching the script object name, use the code name so we can
    # jump from code to the def file.
    SCRIPT_REGEX='/^[\t ]*(struct|enum) +([^ :]+):?.*$/t\2/'

    case $filetype in
        local)
            LANGUAGES="C,C++,C#,lua,script"
            LANGMAPS="C#:+.ddf,C#:+.adf,C++:+.inl,script:.script"

            ctags --c++-kinds=+p --fields=+iaS --extra=+q \
                --langscript=script --languages=$LANGUAGES --langmap=$LANGMAPS \
                --regex-script="$SCRIPT_REGEX" -L ctags.files
            ;;
        script)
            LANGUAGES="script"
            LANGMAPS="script:.script"

            ctags --langdef=script \
                --languages=$LANGUAGES --langmap=$LANGMAPS \
                --regex-script="$SCRIPT_REGEX" -L ctags.files
            ;;
        cpp|cs|c)
            ctags --c++-kinds=+p --fields=+iaS --extra=+q -L ctags.files
            ;;
        *)
            ctags -L ctags.files
            ;;
    esac
}

function __run_cscope {
    filetype=$1
    cscope=$2
    cscope_files=$3
    if [ "$cscope_files" == "" ] ; then
        cscope_files=cscope.files
    fi

    case $filetype in
        python)
            # Requires the python package pycscope:
            #   pip install pycscope
            pycscope.py -i $cscope_files
            ;;
        *)
            # Build cscope database
            #	-b              Build the database only.
            #	-k              Kernel Mode - don't use /usr/include for #include files.
            #	-q              Build an inverted index for quick symbol seaching.
            # May want to consider these flags
            #	-m "lang"       Use lang for multi-lingual cscope.
            #	-R              Recurse directories for files.
            $cscope -b -q -k -i $cscope_files
            ;;
    esac
}

# }}}

# Index builder functions {{{

function __append_intermediate_index {
    # expects temp_name to a temporary filename for output
    folders=$*

    # If you wanted to exclude a directory for some filetype, you could prepend
    # your find_ftype list with this:
    #       find_ftype[ 0]="-path"
    #       find_ftype[ 1]="*/bad_folder"
    #       find_ftype[ 2]="-prune"
    #       find_ftype[ 3]="-o"

    declare -a find_ftype
    case $filetype in
        local)
			# just fallthrough to cpp
        cpp)
            find_ftype[0]="("
            find_ftype[1]="-iname"
            find_ftype[2]="*.cpp"
            find_ftype[3]="-o"
            find_ftype[4]="-iname"
            find_ftype[5]="*.h"
            find_ftype[6]="-o"
            find_ftype[7]="-iname"
            find_ftype[8]="*.inl"
            find_ftype[9]=")"
            ;;
        c)
            find_ftype[0]="("
            find_ftype[1]="-iname"
            find_ftype[2]="*.c"
            find_ftype[3]="-o"
            find_ftype[4]="-iname"
            find_ftype[5]="*.h"
            find_ftype[6]=")"
            ;;
        cs)
            find_ftype[0]="("
            find_ftype[1]="-iname"
            find_ftype[2]="*.cs"
            find_ftype[3]=")"
            ;;
        *)
            # use no name filter
            find_ftype[0]=""
            ;;
    esac

    find $folders "${find_ftype[@]}" -type f -print | sed -e"s/.cygdrive.c/c:/g" | sort -f >> $temp_name
}

function __build_ctags_index {
    cut -f2 $temp_name > ctags.files
    __run_ctags $filetype

	# filter out nonsense (from macros)
	mv tags unfiltered.tags
	grep -vf $tags_exclude_file unfiltered.tags > tags

	rm unfiltered.tags ctags.files
}

function __build_lookupfile_index {
	# add config file to beginning of file list
	cat > filelist << END
build/pc/user.ini
END
    # add files
    sort -f $temp_name >> filelist
}

function __build_cscope_index {
    # linux requires relative names?
    #cut -f2 $temp_name | sed -e"s|^|$root/|" > cscope.files
    # and windows doesn't?
    __run_cscope $filetype $cscope $temp_name
}

# }}}

# Setup {{{
touch $root/$temp_name $root/$working_root/$temp_name
rm $root/$temp_name $root/$working_root/$temp_name
# }}}

# Build root indexes {{{
cd $root

__append_intermediate_index $other_set

# ctags only uses the subset
__build_ctags_index

working_set_from_root=
for d in $working_set; do
    working_set_from_root="$working_set_from_root $working_root/$d"
done
__append_intermediate_index $working_set_from_root

# lookupfile and cscope use all
__build_lookupfile_index

# cscope needs absolute paths, so append our current dir
__build_cscope_index

cd -
# }}}

# Build working set indexes {{{
cd $root/$working_root

__append_intermediate_index $working_set

# ctags only uses the subset
__build_ctags_index $filetype

cd -
# }}}

# Cleanup {{{
rm $root/$temp_name $root/$working_root/$temp_name
# }}}

# vi:et:sw=4 ts=4 fdm=marker


text:
<?php

namespace Magento\GiftMessage\Observer;

use Magento\Framework\Event\ObserverInterface;

/**
 * Gift Message Observer Model
 *
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class SalesEventQuoteSubmitBeforeObserver implements ObserverInterface
{
    /**
     * Set gift messages to order from quote address
     *
     * @param \Magento\Framework\Event\Observer $observer
     * @return $this
     */
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $observer->getEvent()->getOrder()->setGiftMessageId($observer->getEvent()->getQuote()->getGiftMessageId());

        return $this;
    }
}


text:
class Folio::Console::ConsoleNotes::CatalogueTooltipCell < Folio::ConsoleCell
  class_name "f-c-console-notes-catalogue-tooltip", :some_open?, :only_closed?

  def show
    render if model && model.console_notes.present?
  end

  def some_open?
    return @some_open unless @some_open.nil?
    @some_open = model.console_notes.present? && model.console_notes.any? { |note| !note.closed_at? }
  end

  def only_closed?
    !some_open?
  end
end


text:
namespace base {

// Constants for GTest command-line flags.
extern const char kGTestFilterFlag[];
extern const char kGTestFlagfileFlag[];
extern const char kGTestHelpFlag[];
extern const char kGTestListTestsFlag[];
extern const char kGTestRepeatFlag[];
extern const char kGTestRunDisabledTestsFlag[];
extern const char kGTestOutputFlag[];
extern const char kGTestShuffleFlag[];
extern const char kGTestRandomSeedFlag[];
extern const char kIsolatedScriptRunDisabledTestsFlag[];
extern const char kIsolatedScriptTestFilterFlag[];
extern const char kIsolatedScriptTestRepeatFlag[];

// Interface for use with LaunchTests that abstracts away exact details
// which tests and how are run.
class TestLauncherDelegate {
 public:
  // Called to get names of tests available for running. The delegate
  // must put the result in |output| and return true on success.
  virtual bool GetTests(std::vector<TestIdentifier>* output) = 0;

  // Additional delegate TestResult processing.
  virtual void ProcessTestResults(std::vector<TestResult>& test_results,
                                  TimeDelta elapsed_time) {}

  // Called to get the command line for the specified tests.
  // |output_file_| is populated with the path to the result file, and must
  // be inside |temp_dir|.
  virtual CommandLine GetCommandLine(const std::vector<std::string>& test_names,
                                     const FilePath& temp_dir,
                                     FilePath* output_file) = 0;

  // Invoked when a test process exceeds its runtime, immediately before it is
  // terminated. |command_line| is the command line used to launch the process.
  // NOTE: this method is invoked on the thread the process is launched on.
  virtual void OnTestTimedOut(const CommandLine& cmd_line) {}

  // Returns the delegate specific wrapper for command line.
  // If it is not empty, it is prepended to the final command line.
  virtual std::string GetWrapper() = 0;

  // Returns the delegate specific flags for launch options.
  // The flags are specified in LaunchChildGTestProcessFlags.
  virtual int GetLaunchOptions() = 0;

  // Returns the delegate specific timeout per test.
  virtual TimeDelta GetTimeout() = 0;

  // Returns the delegate specific batch size.
  virtual size_t GetBatchSize() = 0;

  // Returns true if test should run.
  virtual bool ShouldRunTest(const TestIdentifier& test);

 protected:
  virtual ~TestLauncherDelegate();
};

// Launches tests using a TestLauncherDelegate.
class TestLauncher {
 public:
  // Flags controlling behavior of LaunchChildGTestProcess.
  enum LaunchChildGTestProcessFlags {
    // Allows usage of job objects on Windows. Helps properly clean up child
    // processes.
    USE_JOB_OBJECTS = (1 << 0),

    // Allows breakaway from job on Windows. May result in some child processes
    // not being properly terminated after launcher dies if these processes
    // fail to cooperate.
    ALLOW_BREAKAWAY_FROM_JOB = (1 << 1),
  };

  // Enum for subprocess stdio redirect.
  enum StdioRedirect { AUTO, ALWAYS, NEVER };

  struct LaunchOptions {
    LaunchOptions();
    LaunchOptions(const LaunchOptions& other);
    ~LaunchOptions();

    int flags = 0;
    // These mirror values in base::LaunchOptions, see it for details.
#if defined(OS_WIN)
    base::LaunchOptions::Inherit inherit_mode =
        base::LaunchOptions::Inherit::kSpecific;
    base::HandlesToInheritVector handles_to_inherit;
#else
    FileHandleMappingVector fds_to_remap;
#endif
  };

  // Constructor. |parallel_jobs| is the limit of simultaneous parallel test
  // jobs. |retry_limit| is the default limit of retries for bots or all tests.
  TestLauncher(TestLauncherDelegate* launcher_delegate,
               size_t parallel_jobs,
               size_t retry_limit = 1U);
  // virtual to mock in testing.
  virtual ~TestLauncher();

  // Runs the launcher. Must be called at most once.
  // command_line is null by default.
  // if null, uses command line for current process.
  bool Run(CommandLine* command_line = nullptr) WARN_UNUSED_RESULT;

  // Launches a child process (assumed to be gtest-based binary) which runs
  // tests indicated by |test_names|.
  // |task_runner| is used to post results back to the launcher on the main
  // thread. |task_temp_dir| is used for child process files such as user data,
  // result file, and flag_file. |child_temp_dir|, if not empty, specifies a
  // directory (within task_temp_dir) that the child process will use as its
  // process-wide temporary directory.
  // virtual to mock in testing.
  virtual void LaunchChildGTestProcess(
      scoped_refptr<TaskRunner> task_runner,
      const std::vector<std::string>& test_names,
      const FilePath& task_temp_dir,
      const FilePath& child_temp_dir);

  // Called when a test has finished running.
  void OnTestFinished(const TestResult& result);

  // Returns true if child test processes should have dedicated temporary
  // directories.
  static constexpr bool SupportsPerChildTempDirs() {
#if defined(OS_WIN)
    return true;
#else
    // TODO(https://crbug.com/1038857): Enable for macOS, Linux, and Fuchsia.
    return false;
#endif
  }

 private:
  bool Init(CommandLine* command_line) WARN_UNUSED_RESULT;

  // Gets tests from the delegate, and converts to TestInfo objects.
  // Catches and logs uninstantiated parameterized tests.
  // Returns false if delegate fails to return tests.
  bool InitTests();

  // Some of the TestLauncherDelegate implementations don't call into gtest
  // until they've already split into test-specific processes. This results
  // in gtest's native shuffle implementation attempting to shuffle one test.
  // Shuffling the list of tests in the test launcher (before the delegate
  // gets involved) ensures that the entire shard is shuffled.
  bool ShuffleTests(CommandLine* command_line);

  // Move all PRE_ tests prior to the final test in order.
  // Validate tests names. This includes no name conflict between tests
  // without DISABLED_ prefix, and orphaned PRE_ tests.
  // Add all tests and disabled tests names to result tracker.
  // Filter Disabled tests if not flagged to run.
  // Returns false if any violation is found.
  bool ProcessAndValidateTests();

  // Runs all tests in current iteration.
  void RunTests();

  // Retry to run tests that failed during RunTests.
  // Returns false if retry still fails or unable to start.
  bool RunRetryTests();

  void CombinePositiveTestFilters(std::vector<std::string> filter_a,
                                  std::vector<std::string> filter_b);

  // Rest counters, retry tests list, and test result tracker.
  void OnTestIterationStart();

#if defined(OS_POSIX)
  void OnShutdownPipeReadable();
#endif

  // Saves test results summary as JSON if requested from command line.
  void MaybeSaveSummaryAsJSON(const std::vector<std::string>& additional_tags);

  // Called when a test iteration is finished.
  void OnTestIterationFinished();

  // Called by the delay timer when no output was made for a while.
  void OnOutputTimeout();

  // Creates and starts a ThreadPoolInstance with |num_parallel_jobs| dedicated
  // to foreground blocking tasks (corresponds to the traits used to launch and
  // wait for child processes). virtual to mock in testing.
  virtual void CreateAndStartThreadPool(int num_parallel_jobs);

  // Callback to receive result of a test.
  // |result_file| is a path to xml file written by child process.
  // It contains information about test and failed
  // EXPECT/ASSERT/DCHECK statements. Test launcher parses that
  // file to get additional information about test run (status,
  // error-messages, stack-traces and file/line for failures).
  // |leaked_items| is the number of files and/or directories remaining in the
  // child process's temporary directory upon its termination.
  void ProcessTestResults(const std::vector<std::string>& test_names,
                          const FilePath& result_file,
                          const std::string& output,
                          TimeDelta elapsed_time,
                          int exit_code,
                          bool was_timeout,
                          int leaked_items);

  // Make sure we don't accidentally call the wrong methods e.g. on the worker
  // pool thread.  Should be the first member so that it's destroyed last: when
  // destroying other members, especially the worker pool, we may check the code
  // is running on the correct thread.
  ThreadChecker thread_checker_;

  TestLauncherDelegate* launcher_delegate_;

  // Support for outer sharding, just like gtest does.
  int32_t total_shards_;  // Total number of outer shards, at least one.
  int32_t shard_index_;   // Index of shard the launcher is to run.

  int cycles_;  // Number of remaining test iterations, or -1 for infinite.

  // Test filters (empty means no filter).
  bool has_at_least_one_positive_filter_;
  std::vector<std::string> positive_test_filter_;
  std::vector<std::string> negative_test_filter_;

  // Class to encapsulate gtest information.
  class TestInfo;

  // Tests to use (cached result of TestLauncherDelegate::GetTests).
  std::vector<TestInfo> tests_;

  // Threshold for number of broken tests.
  size_t broken_threshold_;

  // Number of tests started in this iteration.
  size_t test_started_count_;

  // Number of tests finished in this iteration.
  size_t test_finished_count_;

  // Number of tests successfully finished in this iteration.
  size_t test_success_count_;

  // Number of tests either timing out or having an unknown result,
  // likely indicating a more systemic problem if widespread.
  size_t test_broken_count_;

  // Maximum number of retries per iteration.
  size_t retry_limit_;

  // If true will not early exit nor skip retries even if too many tests are
  // broken.
  bool force_run_broken_tests_;

  // Tests to retry in this iteration.
  std::unordered_set<std::string> tests_to_retry_;

  TestResultsTracker results_tracker_;

  // Watchdog timer to make sure we do not go without output for too long.
  DelayTimer watchdog_timer_;

  // Number of jobs to run in parallel.
  size_t parallel_jobs_;

  // Switch to control tests stdio :{auto, always, never}
  StdioRedirect print_test_stdio_;

  // Skip disabled tests unless explicitly requested.
  bool skip_diabled_tests_;

  // Stop test iterations due to failure.
  bool stop_on_failure_;

  // Path to JSON summary result file.
  FilePath summary_path_;

  // Path to trace file.
  FilePath trace_path_;

  // redirect stdio of subprocess
  bool redirect_stdio_;

  DISALLOW_COPY_AND_ASSIGN(TestLauncher);
};

// Return the number of parallel jobs to use, or 0U in case of error.
size_t NumParallelJobs();

// Extract part from |full_output| that applies to |result|.
std::string GetTestOutputSnippet(const TestResult& result,
                                 const std::string& full_output);

}  // namespace base

#endif  // BASE_TEST_LAUNCHER_TEST_LAUNCHER_H_


text:
CREATE TABLE [dbo].[User]
(
	[Id] BIGINT NOT NULL PRIMARY KEY IDENTITY,
	[PublicId] CHAR(32) NOT NULL,

	[IsActive] BIT NOT NULL DEFAULT 1,
	[IsAdmin] BIT NULL DEFAULT 0,

	[Name] VARCHAR(100) NOT NULL,
	[Email] VARCHAR(300) NOT NULL,
	[ImageUrl] VARCHAR(1000) NULL,

	[PasswordHash] VARCHAR(100) NOT NULL,
	[PasswordResetToken] CHAR(32) NULL,
	[PasswordResetRequestedAt] DATETIME NULL,
	[LastLoginAt] DATETIME NOT NULL DEFAULT GETDATE(),
	[LoginTryCount] INT NOT NULL DEFAULT 0,

    [CreatedBy] BIGINT NOT NULL,
	[CreatedAt] DATETIME NOT NULL,
    [UpdatedBy] BIGINT NOT NULL,
    [UpdatedAt] DATETIME NOT NULL
)


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var DomUtil = function () {
    function DomUtil() {
        _classCallCheck(this, DomUtil);
    }

    _createClass(DomUtil, null, [{
        key: "buildPath",
        value: function buildPath(parentElement, childElement) {
            var path = [],
                node;

            path.push(childElement);

            if (childElement === parentElement) {
                return path;
            }

            node = childElement.parentNode;

            while (node != null) {
                path.push(node);
                if (node === parentElement) {
                    return path;
                }
                node = node.parentNode;
            }
            return false; // not a real path
        }
    }]);

    return DomUtil;
}();

exports.default = DomUtil;


text:
    <form class="form-inline">

            {{:: $ctrl.caption || ('UI_PAGESIZE' | translate) }}
            <select ng-model="$ctrl.$component.pageSize" class="form-control input-sm {{::$ctrl.selectorCss}}"
                    ng-options="item for item in options"></select>

    </form>


text:
.. python-bitbucket documentation master file, created by sphinx-quickstart.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

python-bitbucket
-----------

.. automodule:: python-bitbucket

.. highlight:: sh

You can install python-bitbucket with pip::

    pip install python-bitbucket

You can fork python-bitbucket `from its hg repository
<http://bitbucket.org/jmoiron/python-bitbucket/>`_::

    hg clone http://bitbucket.org/jmoiron/python-bitbucket/

.. highlight:: python


text:
#ifndef SQLPP11_SINGLE_TABLE_H
#define SQLPP11_SINGLE_TABLE_H

#include <sqlpp11/data_types/no_value.h>
#include <sqlpp11/detail/type_set.h>
#include <sqlpp11/no_data.h>
#include <sqlpp11/prepared_insert.h>
#include <sqlpp11/serializer.h>
#include <sqlpp11/type_traits.h>

namespace sqlpp
{
  // A SINGLE TABLE DATA
  template <typename Database, typename Table>
  struct single_table_data_t
  {
    single_table_data_t(Table table) : _table(table)
    {
    }

    single_table_data_t(const single_table_data_t&) = default;
    single_table_data_t(single_table_data_t&&) = default;
    single_table_data_t& operator=(const single_table_data_t&) = default;
    single_table_data_t& operator=(single_table_data_t&&) = default;
    ~single_table_data_t() = default;

    Table _table;
  };

  // A SINGLE TABLE
  template <typename Database, typename Table>
  struct single_table_t
  {
    using _traits = make_traits<no_value_t, tag::is_single_table>;
    using _nodes = detail::type_vector<Table>;

    static_assert(is_table_t<Table>::value, "argument has to be a table");
    static_assert(required_tables_of<Table>::size::value == 0, "table depends on another table");

    using _data_t = single_table_data_t<Database, Table>;

    struct _alias_t
    {
    };

    // Member implementation with data and methods
    template <typename Policies>
    struct _impl_t
    {
      // workaround for msvc bug https://connect.microsoft.com/VisualStudio/Feedback/Details/2173269
      _impl_t() = default;
      _impl_t(const _data_t& data) : _data(data)
      {
      }

      _data_t _data;
    };

    // Base template to be inherited by the statement
    template <typename Policies>
    struct _base_t
    {
      using _data_t = single_table_data_t<Database, Table>;

      // workaround for msvc bug https://connect.microsoft.com/VisualStudio/Feedback/Details/2173269
      template <typename... Args>
      _base_t(Args&&... args) : from{std::forward<Args>(args)...}
      {
      }

      _impl_t<Policies> from;
      _impl_t<Policies>& operator()()
      {
        return from;
      }
      const _impl_t<Policies>& operator()() const
      {
        return from;
      }

      template <typename T>
      static auto _get_member(T t) -> decltype(t.from)
      {
        return t.from;
      }

      using _consistency_check = consistent_t;
    };
  };

  SQLPP_PORTABLE_STATIC_ASSERT(assert_update_table_arg_is_table_t, "argument for update() must be a table");
  template <typename Table>
  struct check_update_table
  {
    using type = static_combined_check_t<static_check_t<is_table_t<Table>::value, assert_update_table_arg_is_table_t>>;
  };
  template <typename Table>
  using check_update_table_t = typename check_update_table<Table>::type;

  // NO TABLE YET
  struct no_single_table_t
  {
    using _traits = make_traits<no_value_t, tag::is_noop>;
    using _nodes = detail::type_vector<>;

    // Data
    using _data_t = no_data_t;

    // Member implementation with data and methods
    template <typename Policies>
    struct _impl_t
    {
      _data_t _data;
    };

    // Base template to be inherited by the statement
    template <typename Policies>
    struct _base_t
    {
      using _data_t = no_data_t;

      _impl_t<Policies> no_from;
      _impl_t<Policies>& operator()()
      {
        return no_from;
      }
      const _impl_t<Policies>& operator()() const
      {
        return no_from;
      }

      template <typename T>
      static auto _get_member(T t) -> decltype(t.no_from)
      {
        return t.no_from;
      }

      using _database_t = typename Policies::_database_t;

      template <typename Check, typename T>
      using _new_statement_t = new_statement_t<Check, Policies, no_single_table_t, T>;

      using _consistency_check = consistent_t;

      template <typename Table>
      auto single_table(Table table) const -> _new_statement_t<check_update_table_t<Table>, single_table_t<void, Table>>
      {
        return _single_table_impl<void>(check_update_table_t<Table>{}, table);
      }

    private:
      template <typename Database, typename Check, typename Table>
      auto _single_table_impl(Check, Table table) const -> inconsistent<Check>;

      template <typename Database, typename Table>
      auto _single_table_impl(consistent_t /*unused*/, Table table) const
          -> _new_statement_t<consistent_t, single_table_t<Database, Table>>
      {
        static_assert(required_tables_of<single_table_t<Database, Table>>::size::value == 0,
                      "argument depends on another table in single_table()");

        return {static_cast<const derived_statement_t<Policies>&>(*this), single_table_data_t<Database, Table>{table}};
      }
    };
  };

  // Interpreters
  template <typename Context, typename Database, typename Table>
  struct serializer_t<Context, single_table_data_t<Database, Table>>
  {
    using _serialize_check = serialize_check_of<Context, Table>;
    using T = single_table_data_t<Database, Table>;

    static Context& _(const T& t, Context& context)
    {
      serialize(t._table, context);
      return context;
    }
  };
}  // namespace sqlpp

#endif


text:
using System;

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

using Parse;

namespace ParseAndroidStarterProject
{
	[Activity (Label = "ParseAndroidStarterProject", MainLauncher = true)]
	public class Activity1 : Activity
	{
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);
		}
	}
}


text:
"""Defines erminctl interface compatible with modern scripts."""

import subprocess
from typing import List

from compatible_utils import get_ssh_prefix
from common import get_ssh_address
import base_ermine_ctl

class ErmineCtl(base_ermine_ctl.BaseErmineCtl):
    """ErmineCtl adaptation for modern scripts."""

    def __init__(self, target_id: str):
        super().__init__()
        self._ssh_prefix = get_ssh_prefix(get_ssh_address(target_id))

    def execute_command_async(self, args: List[str]) -> subprocess.Popen:
        return subprocess.Popen(self._ssh_prefix + args,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.STDOUT,
                                encoding='utf-8')


text:
class RailsExceptionHandler::Parser
  def initialize(exception, request, controller)
    @exception = exception
    @request  = request
    @controller = controller
  end

  def relevant_info
    info = {}
    info[:app_name] =     Rails.application.class.parent_name
    info[:class_name] =   @exception.class.to_s
    info[:message] =      @exception.to_s
    info[:trace] =        @exception.backtrace.join("\n")
    info[:target_url] =   @request.url
    info[:referer_url] =  @request.referer
    info[:params] =       @request.params.inspect
    info[:user_agent] =   @request.user_agent
    info[:user_info] =    user_info
    info[:created_at] =   Time.now
    return info
  end

  def ignore?
    filters = RailsExceptionHandler.configuration.filters
    filters.each do |filter|
      if(filter.class == Symbol)
        result = send("filter_#{filter}")
      elsif(filter.class == Hash)
        result = send("filter_#{filter.keys[0]}", filter.values[0])
      else
        raise "RailsExceptionHandler: Unknown filter #{filter.inspect}"
      end
      return true if(result)
    end
    return false
  end

  def routing_error?
    routing_errors = ['ActionController::RoutingError', 'AbstractController::ActionNotFound', 'ActiveRecord::RecordNotFound']
    routing_errors.include?(@exception.class.to_s)
  end

  private

  def blank_referer?
    relevant_info[:referer_url] == "/" || relevant_info[:referer_url].blank?
  end

  def user_info
    config = RailsExceptionHandler.configuration.store_user_info
    return nil unless(config)
    user_object = @controller.send(config[:method])
    user_object ? user_object.send(config[:field]) : 'Anonymous'
  end

  def filter_all_404s
    routing_error?
  end

  def filter_no_referer_404s
    routing_error? && blank_referer?
  end

  def filter_user_agent_regxp(regxp)
    result = relevant_info[:user_agent].match(regxp)
    result != nil
  end

  def filter_target_url_regxp(regxp)
    result = relevant_info[:target_url].match(regxp)
    result != nil
  end
end


text:
from random import choice
from six.moves import xrange
from uuid import UUID

from django.conf import settings
from django.test import TestCase

from tests.models import ShardedModelIDs
from django_sharding_library.id_generation_strategies import TableStrategy, UUIDStrategy

class TableStrategyIDGenerationTestCase(TestCase):

    def test_returns_unique_values(self):
        sut = TableStrategy('tests.ShardedModelIDs')
        ids = [sut.get_next_id() for i in xrange(100)]
        self.assertEqual(ids, list(set(ids)))

    def test_largest_value_stored_in_db(self):
        sut = TableStrategy('tests.ShardedModelIDs')
        for i in xrange(100):
            id = sut.get_next_id()
            self.assertEqual(ShardedModelIDs.objects.latest('pk').pk, id)
            self.assertFalse(ShardedModelIDs.objects.filter(pk__gt=id).exists())

class UUIDStrategyTestCase(TestCase):

    def test_uuid_strategy_must_be_passed_a_database(self):
        sut = UUIDStrategy()
        with self.assertRaises(AssertionError):
            sut.get_next_id('im not a database')

    def test_returns_value_with_db_name_and_uuid(self):
        sut = UUIDStrategy()
        for i in xrange(100):
            database = choice(list(settings.DATABASES.keys()))
            id = sut.get_next_id(database)
            self.assertTrue(id.startswith(database))
            uuid_value = id[len(database) + 1:]
            self.assertEqual(str(UUID(uuid_value, version=4)), uuid_value)


text:
layout: page
title: Cube Music Dinner
date: 2016-05-24
author: Betty Osborn
tags: weekly links, java
status: published
summary: Ut dignissim imperdiet iaculis. Curabitur ut auctor nisl.
banner: images/banner/leisure-01.jpg
booking:
  startDate: 07/09/2016
  endDate: 07/14/2016
  ctyhocn: FARGOHX
  groupCode: CMD
published: true
---
Pellentesque scelerisque vestibulum augue, ut pellentesque felis fringilla eu. Cras et blandit quam. Vivamus non rhoncus mauris. Etiam nisl mi, posuere quis ligula sit amet, bibendum eleifend sapien. Donec id diam lorem. Donec a dignissim tellus. Nullam id lacus in erat consequat congue blandit sit amet diam. Praesent pharetra placerat elit, in convallis dolor consequat nec. Vestibulum nec rutrum turpis. Aliquam non nulla non mauris tincidunt ultrices.

1 Mauris egestas leo sed neque varius, eget aliquet lacus iaculis.

Sed porta justo ut diam laoreet, a tristique nisl malesuada. Pellentesque turpis quam, aliquam vitae porta non, vulputate at justo. Donec semper leo in purus feugiat, at dictum lorem tristique. Sed orci nibh, ornare ac blandit consectetur, consectetur rutrum arcu. Morbi accumsan nisi at massa varius, quis commodo nisi placerat. Pellentesque egestas id nisi at lacinia. Nulla auctor placerat sodales. Duis feugiat mollis arcu eu aliquet. Etiam vitae mattis lectus. Curabitur dignissim consequat rhoncus.


text:
package org.jacpfx.api.component.ui;

/**
 * @author: Patrick Symmangk (pete.jacp@gmail.com)
 */
public interface HideableComponent {

    Hideable getHideableParent();
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.PooledObjects;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.CSharp
{
    /// <summary>
    /// A binder that places the members of a symbol in scope.
    /// </summary>
    internal class InContainerBinder : Binder
    {
        private readonly NamespaceOrTypeSymbol _container;

        /// <summary>
        /// Creates a binder for a container.
        /// </summary>
        internal InContainerBinder(NamespaceOrTypeSymbol container, Binder next)
            : base(next)
        {
            Debug.Assert((object)container != null);
            _container = container;
        }

        internal NamespaceOrTypeSymbol Container
        {
            get
            {
                return _container;
            }
        }

        internal override Symbol ContainingMemberOrLambda
        {
            get
            {
                var merged = _container as MergedNamespaceSymbol;
                return ((object)merged != null) ? merged.GetConstituentForCompilation(this.Compilation) : _container;
            }
        }

        private bool IsScriptClass
        {
            get { return (_container.Kind == SymbolKind.NamedType) && ((NamedTypeSymbol)_container).IsScriptClass; }
        }

        internal override bool IsAccessibleHelper(Symbol symbol, TypeSymbol accessThroughType, out bool failedThroughTypeCheck, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, ConsList<TypeSymbol> basesBeingResolved)
        {
            var type = _container as NamedTypeSymbol;
            if ((object)type != null)
            {
                return this.IsSymbolAccessibleConditional(symbol, type, accessThroughType, out failedThroughTypeCheck, ref useSiteInfo);
            }
            else
            {
                return Next.IsAccessibleHelper(symbol, accessThroughType, out failedThroughTypeCheck, ref useSiteInfo, basesBeingResolved);  // delegate to containing Binder, eventually checking assembly.
            }
        }

        internal override bool SupportsExtensionMethods
        {
            get { return true; }
        }

        internal override void GetCandidateExtensionMethods(
            ArrayBuilder<MethodSymbol> methods,
            string name,
            int arity,
            LookupOptions options,
            Binder originalBinder)
        {
            if (_container.Kind == SymbolKind.Namespace)
            {
                ((NamespaceSymbol)_container).GetExtensionMethods(methods, name, arity, options);
            }
        }

        internal override TypeWithAnnotations GetIteratorElementType()
        {
            if (IsScriptClass)
            {
                // This is the scenario where a `yield return` exists in the script file as a global statement.
                // This method is to guard against hitting `BuckStopsHereBinder` and crash.
                return TypeWithAnnotations.Create(this.Compilation.GetSpecialType(SpecialType.System_Object));
            }
            else
            {
                // This path would eventually throw, if we didn't have the case above.
                return Next.GetIteratorElementType();
            }
        }

        internal override void LookupSymbolsInSingleBinder(
            LookupResult result, string name, int arity, ConsList<TypeSymbol> basesBeingResolved, LookupOptions options, Binder originalBinder, bool diagnose, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
        {
            Debug.Assert(result.IsClear);

            // first lookup members of the namespace
            if ((options & LookupOptions.NamespaceAliasesOnly) == 0)
            {
                this.LookupMembersInternal(result, _container, name, arity, basesBeingResolved, options, originalBinder, diagnose, ref useSiteInfo);

                if (result.IsMultiViable)
                {
                    if (arity == 0)
                    {
                        // symbols cannot conflict with using alias names
                        if (Next is WithExternAndUsingAliasesBinder withUsingAliases && withUsingAliases.IsUsingAlias(name, originalBinder.IsSemanticModelBinder, basesBeingResolved))
                        {
                            CSDiagnosticInfo diagInfo = new CSDiagnosticInfo(ErrorCode.ERR_ConflictAliasAndMember, name, _container);
                            var error = new ExtendedErrorTypeSymbol((NamespaceOrTypeSymbol)null, name, arity, diagInfo, unreported: true);
                            result.SetFrom(LookupResult.Good(error)); // force lookup to be done w/ error symbol as result
                        }
                    }

                    return;
                }
            }
        }

        internal override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder)
        {
            this.AddMemberLookupSymbolsInfo(result, _container, options, originalBinder);
        }

        protected override SourceLocalSymbol LookupLocal(SyntaxToken nameToken)
        {
            return null;
        }

        protected override LocalFunctionSymbol LookupLocalFunction(SyntaxToken nameToken)
        {
            return null;
        }

        internal override uint LocalScopeDepth => Binder.ExternalScope;
    }
}


text:
using System;
using BenchmarkDotNet.Running;

namespace Data.Net.PerformanceTest
{
    class Program
    {
        static void Main()
        {
            BenchmarkRunner.Run<BenchmarkTest>();

            Console.WriteLine("DONE");
            Console.ReadKey();
        }
    }
}


text:
package com.painless.clock.setting;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.Toast;

import com.painless.clock.Constants;
import com.painless.clock.Debug;
import com.painless.clock.R;
import com.painless.clock.setting.ColorPickerView.OnColorChangedListener;

public class ColorPicker extends Activity {
	private static final int UN_SELECTED = R.drawable.picker1;
	private static final int SELECTED = R.drawable.picker2;

	private final OnClickListener sameAsThemeClicked = new OnClickListener() {

		@Override
		public void onClick(View v) {
			if (sameAsTheme.isChecked()) {
				customColorView.setImageResource(UN_SELECTED);
			} else {
				customColorView.setImageResource(SELECTED);
			}
		}
	};

	private final OnClickListener customColorClicked = new OnClickListener() {

		@Override
		public void onClick(View v) {
			customColorView.setImageResource(SELECTED);
			sameAsTheme.setChecked(false);
		}
	};

	private final OnColorChangedListener colorChange = new OnColorChangedListener() {

		@Override
		public void onColorChanged(int color) {
			customColorClicked.onClick(null);
			customColorView.setBackgroundColor(color);
		}
	};

	private CheckBox sameAsTheme;
	private ImageView customColorView;
	private ColorPickerView colorPickerView;

	SharedPreferences prefs;
	private String key;

	private int themeColor;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.color_picker);
		final Bundle bundle = getIntent().getExtras();
		setTitle(bundle.getString("title"));

		sameAsTheme = (CheckBox) findViewById(R.id.sameAsTheme);
		sameAsTheme.setOnClickListener(sameAsThemeClicked);

		customColorView = (ImageView) findViewById(R.id.customColorView);
		customColorView.setOnClickListener(customColorClicked);

		// Setting the type
		key = bundle.getString("key");
		Debug.log("Color picker key : " + key);
		prefs = getSharedPreferences(Constants.SHARED_PREFS_NAME, 0);

		themeColor = prefs.getInt(Constants.THEME_CODE, Constants.DEFAULT_THEME);
		int defaultColor = 0;
		boolean checked;
		if (Constants.THEME_CODE.equals(key)) {
			sameAsTheme.setText(R.string.cp_defaultTheme);
			defaultColor = themeColor;
			checked = defaultColor == Constants.DEFAULT_THEME;

		} else if (key != null) {
			defaultColor = prefs.getInt(key, themeColor);
			checked = !prefs.contains(key);

		} else {
			defaultColor = bundle.getInt("color");
			checked = bundle.getBoolean("default");
		}

		if (checked) {
			sameAsTheme.setChecked(true);
		} else {
			customColorClicked.onClick(null);
		}

		customColorView.setBackgroundColor(defaultColor);

		((Button) findViewById(R.id.cancel)).setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
			}
		});

		((Button) findViewById(R.id.done)).setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (saveSettings()) {
					finish();
				} else {
					Toast.makeText(getApplicationContext(), R.string.cp_error, Toast.LENGTH_LONG).show();
				}
			}
		});

		colorPickerView = (ColorPickerView) findViewById(R.id.color_picker);
		colorPickerView.setColor(defaultColor);
		colorPickerView.setOnColorChangedListener(colorChange);
	}

	private boolean saveSettings() {
		if (Constants.THEME_CODE.equals(key)) {
			final int value = sameAsTheme.isChecked() ? Constants.DEFAULT_THEME : getColor();
			return prefs.edit().putInt(key, value).commit();
		} else if (key != null) {
			if (sameAsTheme.isChecked()) {
				return prefs.edit().remove(key).commit();
			} else {
				return prefs.edit().putInt(key, getColor()).commit();
			}
		} else {
			final Intent data = new Intent();
			data.putExtra("color", sameAsTheme.isChecked() ? themeColor : getColor());
			data.putExtra("default", sameAsTheme.isChecked());
			setResult(RESULT_OK, data);
		}
		return true;
	}

	private int getColor() {
		return colorPickerView.getColor();
	}
}


text:
package com.forerunnergames.tools.net.events.remote.origin.server;

import com.forerunnergames.tools.net.events.remote.AnswerEvent;

/**
 * The server is answering a RequestEvent from a client with a positive confirmation.
 *
 * This event is intended to be sent over the network.
 */
public interface SuccessEvent extends ServerNotificationEvent, AnswerEvent
{
}


text:
const jwt = require('jsonwebtoken');
const cookieParser = require('cookie-parser');

// check for token
function hasToken(req, res, next) {
  if (!req.cookies.auth) {
    res.sendStatus(404);
  } else {
    next();
  }
}

// check if user is logged
function isLoggedIn(req, res, next) {
  jwt.verify(req.cookies.auth, process.env.JWT_KEY, (err, decoded) => {
    if (err || !decoded.loggedIn) {
      res.sendStatus(403);
    } else {
      next();
    }
  });
}

// check if user is an administrator
// currently hard-coding user id 1
function isAdministrator(req, res, next) {
  jwt.verify(req.cookies.auth, process.env.JWT_KEY, (err, decoded) => {
    if (err || parseInt(decoded.id) !== 1) {
      res.sendStatus(403);
    } else {
      next();
    }
  });
}

module.exports = { hasToken, isLoggedIn, isAdministrator };


text:
package XZot1K.plugins.zb.libraries;

import XZot1K.plugins.zb.ZotBox;
import org.bukkit.command.Command;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.SimpleCommandMap;
import org.bukkit.plugin.*;

import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URLClassLoader;
import java.util.*;
import java.util.List;

public class PluginManagementLibrary
{

    private ZotBox plugin = ZotBox.getInstance();
    private List<String> preventedPlugins;

    public PluginManagementLibrary()
    {
        setPreventedPlugins(new ArrayList<>());
    }

    public boolean isPluginLoaded(String pluginName)
    {
        Plugin[] pluginsList = plugin.getServer().getPluginManager().getPlugins();
        for (int i = -1; ++i < pluginsList.length; )
        {
            Plugin pl = pluginsList[i];
            if (pl.getDescription().getName().equalsIgnoreCase(pluginName))
                return true;
        }

        return true;
    }

    @SuppressWarnings("unchecked")
    public boolean unLoadPlugin(String pluginName, boolean useDependDetector)
    {
        long startTime = System.currentTimeMillis();
        Plugin[] pluginsList = plugin.getServer().getPluginManager().getPlugins();
        for (int i = -1; ++i < pluginsList.length; )
        {
            Plugin pl = pluginsList[i];
            if (pl.getDescription().getName().equalsIgnoreCase(pluginName))
            {

                if (getPreventedPlugins().contains(pl.getDescription().getName()))
                {
                    plugin.getGeneralLibrary().sendConsoleMessage("&e" + pl.getDescription().getName()
                            + " &cwas in the integrated prevented plugins list. Skipping...");
                    return false;
                }

                if (isPrevented(pl.getDescription().getName()))
                {
                    plugin.getGeneralLibrary().sendConsoleMessage("&e" + pl.getDescription().getName()
                            + " &cwas in the prevented plugins list in the &econfig.yml&c. Skipping...");
                    return false;
                }

                if (useDependDetector)
                {
                    Plugin[] otherPlugins = plugin.getServer().getPluginManager().getPlugins();
                    if (otherPlugins != null && otherPlugins.length > 0)
                        for (int j = -1; ++j < otherPlugins.length; )
                        {
                            Plugin otherPl = otherPlugins[j];
                            if (otherPl.getDescription().getDepend().contains(pl.getDescription().getName()))
                            {
                                plugin.getGeneralLibrary().sendConsoleMessage("&aFound that &e" + otherPl.getDescription().getName()
                                        + " &adepends on &e" + pl.getDescription().getName() + "&a. " + "Trying to un-load this plugin as well.");

                                if (getPreventedPlugins().contains(pl.getDescription().getName()))
                                {
                                    plugin.getGeneralLibrary().sendConsoleMessage("&e" + pl.getDescription().getName()
                                            + " &cwas in the integrated prevented plugins list. Skipping...");
                                    return false;
                                }

                                if (isPrevented(otherPl.getDescription().getName()))
                                {
                                    plugin.getGeneralLibrary().sendConsoleMessage("&e" + pl.getDescription().getName()
                                            + " &cwas in the prevented plugins list in the &econfig.yml&c. Skipping...");
                                    return false;
                                }

                                unLoadPlugin(otherPl.getDescription().getName(), true);
                            }
                        }
                }

                String name = pl.getName();
                SimpleCommandMap commandMap;
                List<Plugin> plugins;
                Map<String, Plugin> names;
                Map<String, Command> commands;
                Map<Event, SortedSet<RegisteredListener>> listeners = null;

                try
                {
                    plugin.getServer().getPluginManager().disablePlugin(pl);
                    Field pluginsField = plugin.getServer().getPluginManager().getClass().getDeclaredField("plugins");
                    pluginsField.setAccessible(true);
                    plugins = (List<Plugin>) pluginsField.get(plugin.getServer().getPluginManager());
                    Field lookupNamesField = plugin.getServer().getPluginManager().getClass().getDeclaredField("lookupNames");
                    lookupNamesField.setAccessible(true);
                    names = (Map<String, Plugin>) lookupNamesField.get(plugin.getServer().getPluginManager());
                    try
                    {
                        Field listenersField = plugin.getServer().getPluginManager().getClass().getDeclaredField("listeners");
                        listenersField.setAccessible(true);
                        listeners = (Map<Event, SortedSet<RegisteredListener>>) listenersField.get(plugin.getServer().getPluginManager());
                    } catch (Exception ignored) {}

                    Field commandMapField = plugin.getServer().getPluginManager().getClass().getDeclaredField("commandMap");
                    commandMapField.setAccessible(true);
                    commandMap = (SimpleCommandMap) commandMapField.get(plugin.getServer().getPluginManager());

                    Field knownCommandsField = SimpleCommandMap.class.getDeclaredField("knownCommands");
                    knownCommandsField.setAccessible(true);
                    commands = (Map<String, Command>) knownCommandsField.get(commandMap);
                } catch (NoSuchFieldException | IllegalAccessException e)
                {
                    e.printStackTrace();
                    return false;
                }

                plugin.getServer().getPluginManager().disablePlugin(pl);
                if (plugins != null) plugins.remove(pl);
                if (names != null) names.remove(name);

                if (listeners != null)
                {
                    List<SortedSet<RegisteredListener>> lsList = new ArrayList(listeners.values());
                    for (int j = -1; ++j < lsList.size(); )
                    {
                        SortedSet<RegisteredListener> set = lsList.get(j);
                        set.removeIf(value -> value.getPlugin() == pl);
                    }
                }

                if (commandMap != null)
                {
                    for (Iterator<Map.Entry<String, Command>> it = commands.entrySet().iterator(); it.hasNext(); )
                    {
                        Map.Entry<String, Command> entry = it.next();
                        if (entry.getValue() instanceof PluginCommand)
                        {
                            PluginCommand c = (PluginCommand) entry.getValue();
                            if (c.getPlugin() == pl)
                            {
                                c.unregister(commandMap);
                                it.remove();
                            }
                        }
                    }
                }

                ClassLoader cl = plugin.getClass().getClassLoader();
                if (cl instanceof URLClassLoader)
                {
                    try
                    {
                        ((URLClassLoader) cl).close();
                    } catch (IOException ex)
                    {
                        ex.printStackTrace();
                    }
                }

                System.gc();
                long endTime = System.currentTimeMillis();
                plugin.getGeneralLibrary().sendConsoleMessage("&aSuccessfully un-loaded &e" + pl.getDescription().getName()
                        + "&a! (Took &e" + (endTime - startTime) + "ms&a)");
                return true;
            }
        }

        return false;
    }

    public boolean loadPlugin(String pluginName, boolean useDependDetector)
    {
        if (isPluginLoaded(pluginName))
        {
            long startTime = System.currentTimeMillis();
            File pluginsFolder = new File("plugins");
            if (pluginsFolder.exists() && pluginsFolder.isDirectory())
            {
                File[] files = pluginsFolder.listFiles();
                if (files == null) return false;
                for (int i = -1; ++i < files.length; )
                {
                    File file = files[i];
                    if (file.getName().toLowerCase().endsWith(".jar"))
                    {
                        try
                        {
                            PluginDescriptionFile desc = plugin.getPluginLoader().getPluginDescription(file);
                            if (desc.getName().equalsIgnoreCase(pluginName))
                            {
                                if (getPreventedPlugins().contains(desc.getName()))
                                {
                                    plugin.getGeneralLibrary().sendConsoleMessage("&e" + desc.getName()
                                            + " &cwas in the integrated prevented plugins list. Skipping...");
                                    return false;
                                }

                                if (isPrevented(desc.getName()))
                                {
                                    plugin.getGeneralLibrary().sendConsoleMessage("&e" + desc.getName()
                                            + " &cwas in the prevented plugins list in the &econfig.yml&c. Skipping...");
                                    return false;
                                }

                                if (useDependDetector)
                                {
                                    List<String> depends = desc.getDepend();
                                    for (int j = -1; ++j < depends.size(); )
                                    {
                                        String dependent = depends.get(j);
                                        if (isPluginLoaded(dependent))
                                        {
                                            plugin.getGeneralLibrary().sendConsoleMessage("&aFound that &e" + desc.getName() + " &adepends on &e" + dependent + "&a, but it is not installed. " +
                                                    "Trying to load the dependency if it is in the plugins folder.");

                                            if (isPrevented(dependent))
                                            {
                                                plugin.getGeneralLibrary().sendConsoleMessage("&e" + dependent
                                                        + " &cwas in the prevented plugins list in the &econfig.yml&c. Skipping...");
                                                return false;
                                            }

                                            if (!loadPlugin(dependent, true))
                                            {
                                                plugin.getGeneralLibrary().sendConsoleMessage("&cTried to load the dependencies for &e"
                                                        + desc.getName() + " &c, but was un-successful. Therefore &e" + desc.getName() + " &cwas not loaded.");
                                                return false;
                                            }
                                        }
                                    }
                                }

                                Plugin pl = plugin.getServer().getPluginManager().loadPlugin(file);
                                pl.onLoad();
                                plugin.getServer().getPluginManager().enablePlugin(pl);
                                long endTime = System.currentTimeMillis();
                                plugin.getGeneralLibrary().sendConsoleMessage("&aSuccessfully loaded &e" + pl.getDescription().getName()
                                        + "&a! (Took &e" + (endTime - startTime) + "ms&a)");
                                return true;
                            }
                        } catch (InvalidPluginException | InvalidDescriptionException e)
                        {
                            e.printStackTrace();
                            plugin.getGeneralLibrary().sendConsoleMessage("&cIt seems the &e" + file.getName() + " &cfile might have a invalid " +
                                    "plugin.yml or at least couldn't be found. (You may want to restart the server to attempt to resolve this issue)");
                        }
                    }
                }
            }
        }

        return false;
    }

    public boolean reloadPlugin(String pluginName, boolean useDependDetector)
    {
        return unLoadPlugin(pluginName, useDependDetector) && loadPlugin(pluginName, useDependDetector);
    }

    public String getProperPluginName(String pluginName)
    {
        Plugin[] pluginsList = plugin.getServer().getPluginManager().getPlugins();
        for (int i = -1; ++i < pluginsList.length; )
        {
            Plugin pl = pluginsList[i];
            if (pl.getDescription().getName().equalsIgnoreCase(pluginName))
            {
                return pl.getDescription().getName();
            }
        }

        return pluginName;
    }

    public boolean isPrevented(String pluginName)
    {
        List<String> prevented = plugin.getConfig().getStringList("prevented-plugins");
        for (int i = -1; ++i < prevented.size(); )
            if (pluginName.equalsIgnoreCase(prevented.get(i))) return true;
        return false;
    }

    // Getters & Setters
    public List<String> getPreventedPlugins()
    {
        return preventedPlugins;
    }

    private void setPreventedPlugins(List<String> preventedPlugins)
    {
        this.preventedPlugins = preventedPlugins;
    }

}


text:
require 'spec_helper'

RSpec.describe Events do
  subject { Object.new }
  let(:dummy) { double }

  describe 'emitting events' do
    before{ allow(dummy).to receive(:call) }

    it 'calls the block on emit' do
      subject.on(:event) { dummy.call }
      expect(dummy).to receive(:call)
      subject.emit(:event)
    end

    it 'passes arguments to the block' do
      subject.on(:bad_event) { dummy.call(:x, 1) }
      subject.on(:good_event) { |a, b| dummy.call(a, b) }
      expect(dummy).to receive(:call).with(3, :y)
      subject.emit(:good_event, 3, :y)
    end

    it 'handles multiple event listeners' do
      subject.on(:event) { dummy.call(1) }
      subject.on(:event) { dummy.call(2) }
      expect(dummy).to receive(:call).with(1).exactly(1).times.ordered
      expect(dummy).to receive(:call).with(2).exactly(1).times.ordered
      subject.emit(:event)
    end
  end
end