text:
require 'stringio'
require 'test_helper'

module Trollop
module Test

class Trollop < ::MiniTest::Unit::TestCase
  def setup
    @p = Parser.new
  end

  def test_die_without_options_ever_run
    ::Trollop.send(:instance_variable_set, "@last_parser", nil)
    assert_raises(ArgumentError) { ::Trollop.die 'hello' }
  end

  def test_unknown_arguments
    assert_raises(CommandlineError) { @p.parse(%w(--arg)) }
    @p.opt "arg"
    @p.parse(%w(--arg))
    assert_raises(CommandlineError) { @p.parse(%w(--arg2)) }
  end

  def test_syntax_check
    @p.opt "arg"

    @p.parse(%w(--arg))
    @p.parse(%w(arg))
    assert_raises(CommandlineError) { @p.parse(%w(---arg)) }
    assert_raises(CommandlineError) { @p.parse(%w(-arg)) }
  end

  def test_required_flags_are_required
    @p.opt "arg", "desc", :required => true
    @p.opt "arg2", "desc", :required => false
    @p.opt "arg3", "desc", :required => false

    @p.parse(%w(--arg))
    @p.parse(%w(--arg --arg2))
    assert_raises(CommandlineError) { @p.parse(%w(--arg2)) }
    assert_raises(CommandlineError) { @p.parse(%w(--arg2 --arg3)) }
  end

  ## flags that take an argument error unless given one
  def test_argflags_demand_args
    @p.opt "goodarg", "desc", :type => String
    @p.opt "goodarg2", "desc", :type => String

    @p.parse(%w(--goodarg goat))
    assert_raises(CommandlineError) { @p.parse(%w(--goodarg --goodarg2 goat)) }
    assert_raises(CommandlineError) { @p.parse(%w(--goodarg)) }
  end

  ## flags that don't take arguments ignore them
  def test_arglessflags_refuse_args
    @p.opt "goodarg"
    @p.opt "goodarg2"
    @p.parse(%w(--goodarg))
    @p.parse(%w(--goodarg --goodarg2))
    opts = @p.parse %w(--goodarg a)
    assert_equal true, opts["goodarg"]
    assert_equal ["a"], @p.leftovers
  end

  ## flags that require args of a specific type refuse args of other
  ## types
  def test_typed_args_refuse_args_of_other_types
    @p.opt "goodarg", "desc", :type => :int
    assert_raises(ArgumentError) { @p.opt "badarg", "desc", :type => :asdf }

    @p.parse(%w(--goodarg 3))
    assert_raises(CommandlineError) { @p.parse(%w(--goodarg 4.2)) }
    assert_raises(CommandlineError) { @p.parse(%w(--goodarg hello)) }
  end

  ## type is correctly derived from :default
  def test_type_correctly_derived_from_default
    assert_raises(ArgumentError) { @p.opt "badarg", "desc", :default => [] }
    assert_raises(ArgumentError) { @p.opt "badarg3", "desc", :default => [{1 => 2}] }
    assert_raises(ArgumentError) { @p.opt "badarg4", "desc", :default => Hash.new }

    # single arg: int
    @p.opt "argsi", "desc", :default => 0
    opts = @p.parse(%w(--))
    assert_equal 0, opts["argsi"]
    opts = @p.parse(%w(--argsi 4))
    assert_equal 4, opts["argsi"]
    opts = @p.parse(%w(--argsi=4))
    assert_equal 4, opts["argsi"]
    opts = @p.parse(%w(--argsi=-4))
    assert_equal -4, opts["argsi"]

    assert_raises(CommandlineError) { @p.parse(%w(--argsi 4.2)) }
    assert_raises(CommandlineError) { @p.parse(%w(--argsi hello)) }

    # single arg: float
    @p.opt "argsf", "desc", :default => 3.14
    opts = @p.parse(%w(--))
    assert_equal 3.14, opts["argsf"]
    opts = @p.parse(%w(--argsf 2.41))
    assert_equal 2.41, opts["argsf"]
    opts = @p.parse(%w(--argsf 2))
    assert_equal 2, opts["argsf"]
    opts = @p.parse(%w(--argsf 1.0e-2))
    assert_equal 1.0e-2, opts["argsf"]
    assert_raises(CommandlineError) { @p.parse(%w(--argsf hello)) }

    # single arg: date
    date = Date.today
    @p.opt "argsd", "desc", :default => date
    opts = @p.parse(%w(--))
    assert_equal Date.today, opts["argsd"]
    opts = @p.parse(['--argsd', 'Jan 4, 2007'])
    assert_equal Date.civil(2007, 1, 4), opts["argsd"]
    assert_raises(CommandlineError) { @p.parse(%w(--argsd hello)) }

    # single arg: string
    @p.opt "argss", "desc", :default => "foobar"
    opts = @p.parse(%w(--))
    assert_equal "foobar", opts["argss"]
    opts = @p.parse(%w(--argss 2.41))
    assert_equal "2.41", opts["argss"]
    opts = @p.parse(%w(--argss hello))
    assert_equal "hello", opts["argss"]

    # multi args: ints
    @p.opt "argmi", "desc", :default => [3, 5]
    opts = @p.parse(%w(--))
    assert_equal [3, 5], opts["argmi"]
    opts = @p.parse(%w(--argmi 4))
    assert_equal [4], opts["argmi"]
    assert_raises(CommandlineError) { @p.parse(%w(--argmi 4.2)) }
    assert_raises(CommandlineError) { @p.parse(%w(--argmi hello)) }

    # multi args: floats
    @p.opt "argmf", "desc", :default => [3.34, 5.21]
    opts = @p.parse(%w(--))
    assert_equal [3.34, 5.21], opts["argmf"]
    opts = @p.parse(%w(--argmf 2))
    assert_equal [2], opts["argmf"]
    opts = @p.parse(%w(--argmf 4.0))
    assert_equal [4.0], opts["argmf"]
    assert_raises(CommandlineError) { @p.parse(%w(--argmf hello)) }

    # multi args: dates
    dates = [Date.today, Date.civil(2007, 1, 4)]
    @p.opt "argmd", "desc", :default => dates
    opts = @p.parse(%w(--))
    assert_equal dates, opts["argmd"]
    opts = @p.parse(['--argmd', 'Jan 4, 2007'])
    assert_equal [Date.civil(2007, 1, 4)], opts["argmd"]
    assert_raises(CommandlineError) { @p.parse(%w(--argmd hello)) }

    # multi args: strings
    @p.opt "argmst", "desc", :default => %w(hello world)
    opts = @p.parse(%w(--))
    assert_equal %w(hello world), opts["argmst"]
    opts = @p.parse(%w(--argmst 3.4))
    assert_equal ["3.4"], opts["argmst"]
    opts = @p.parse(%w(--argmst goodbye))
    assert_equal ["goodbye"], opts["argmst"]
  end

  ## :type and :default must match if both are specified
  def test_type_and_default_must_match
    assert_raises(ArgumentError) { @p.opt "badarg", "desc", :type => :int, :default => "hello" }
    assert_raises(ArgumentError) { @p.opt "badarg2", "desc", :type => :String, :default => 4 }
    assert_raises(ArgumentError) { @p.opt "badarg2", "desc", :type => :String, :default => ["hi"] }
    assert_raises(ArgumentError) { @p.opt "badarg2", "desc", :type => :ints, :default => [3.14] }

    @p.opt "argsi", "desc", :type => :int, :default => 4
    @p.opt "argsf", "desc", :type => :float, :default => 3.14
    @p.opt "argsd", "desc", :type => :date, :default => Date.today
    @p.opt "argss", "desc", :type => :string, :default => "yo"
    @p.opt "argmi", "desc", :type => :ints, :default => [4]
    @p.opt "argmf", "desc", :type => :floats, :default => [3.14]
    @p.opt "argmd", "desc", :type => :dates, :default => [Date.today]
    @p.opt "argmst", "desc", :type => :strings, :default => ["yo"]
  end

  ##
  def test_flags_with_defaults_and_no_args_act_as_switches
    @p.opt :argd, "desc", :default => "default_string"

    opts = @p.parse(%w(--))
    assert !opts[:argd_given]
    assert_equal "default_string", opts[:argd]

    opts = @p.parse(%w( --argd ))
    assert opts[:argd_given]
    assert_equal "default_string", opts[:argd]

    opts = @p.parse(%w(--argd different_string))
    assert opts[:argd_given]
    assert_equal "different_string", opts[:argd]
  end

  def test_flag_with_no_defaults_and_no_args_act_as_switches_array
    opts = nil

    @p.opt :argd, "desc", :type => :strings, :default => ["default_string"]

    opts = @p.parse(%w(--argd))
    assert_equal ["default_string"], opts[:argd]
  end

  def test_type_and_empty_array
    @p.opt "argmi", "desc", :type => :ints, :default => []
    @p.opt "argmf", "desc", :type => :floats, :default => []
    @p.opt "argmd", "desc", :type => :dates, :default => []
    @p.opt "argms", "desc", :type => :strings, :default => []
    assert_raises(ArgumentError) { @p.opt "badi", "desc", :type => :int, :default => [] }
    assert_raises(ArgumentError) { @p.opt "badf", "desc", :type => :float, :default => [] }
    assert_raises(ArgumentError) { @p.opt "badd", "desc", :type => :date, :default => [] }
    assert_raises(ArgumentError) { @p.opt "bads", "desc", :type => :string, :default => [] }
    opts = @p.parse([])
    assert_equal(opts["argmi"], [])
    assert_equal(opts["argmf"], [])
    assert_equal(opts["argmd"], [])
    assert_equal(opts["argms"], [])
  end

  def test_long_detects_bad_names
    @p.opt "goodarg", "desc", :long => "none"
    @p.opt "goodarg2", "desc", :long => "--two"
    assert_raises(ArgumentError) { @p.opt "badarg", "desc", :long => "" }
    assert_raises(ArgumentError) { @p.opt "badarg2", "desc", :long => "--" }
    assert_raises(ArgumentError) { @p.opt "badarg3", "desc", :long => "-one" }
    assert_raises(ArgumentError) { @p.opt "badarg4", "desc", :long => "---toomany" }
  end

  def test_short_detects_bad_names
    @p.opt "goodarg", "desc", :short => "a"
    @p.opt "goodarg2", "desc", :short => "-b"
    assert_raises(ArgumentError) { @p.opt "badarg", "desc", :short => "" }
    assert_raises(ArgumentError) { @p.opt "badarg2", "desc", :short => "-ab" }
    assert_raises(ArgumentError) { @p.opt "badarg3", "desc", :short => "--t" }
  end

  def test_short_names_created_automatically
    @p.opt "arg"
    @p.opt "arg2"
    @p.opt "arg3"
    opts = @p.parse %w(-a -g)
    assert_equal true, opts["arg"]
    assert_equal false, opts["arg2"]
    assert_equal true, opts["arg3"]
  end

  def test_short_autocreation_skips_dashes_and_numbers
    @p.opt :arg # auto: a
    @p.opt :arg_potato # auto: r
    @p.opt :arg_muffin # auto: g
    @p.opt :arg_daisy  # auto: d (not _)!
    @p.opt :arg_r2d2f  # auto: f (not 2)!

    opts = @p.parse %w(-f -d)
    assert_equal true, opts[:arg_daisy]
    assert_equal true, opts[:arg_r2d2f]
    assert_equal false, opts[:arg]
    assert_equal false, opts[:arg_potato]
    assert_equal false, opts[:arg_muffin]
  end

  def test_short_autocreation_is_ok_with_running_out_of_chars
    @p.opt :arg1 # auto: a
    @p.opt :arg2 # auto: r
    @p.opt :arg3 # auto: g
    @p.opt :arg4 # auto: uh oh!
    @p.parse []
  end

  def test_short_can_be_nothing
    @p.opt "arg", "desc", :short => :none
    @p.parse []

    sio = StringIO.new "w"
    @p.educate sio
    assert sio.string =~ /--arg\s+desc/

    assert_raises(CommandlineError) { @p.parse %w(-a) }
  end

  ## two args can't have the same name
  def test_conflicting_names_are_detected
    @p.opt "goodarg"
    assert_raises(ArgumentError) { @p.opt "goodarg" }
  end

  ## two args can't have the same :long
  def test_conflicting_longs_detected
    @p.opt "goodarg", "desc", :long => "--goodarg"
    assert_raises(ArgumentError) { @p.opt "badarg", "desc", :long => "--goodarg" }
  end

  ## two args can't have the same :short
  def test_conflicting_shorts_detected
    @p.opt "goodarg", "desc", :short => "-g"
    assert_raises(ArgumentError) { @p.opt "badarg", "desc", :short => "-g" }
  end

  ## note: this behavior has changed in trollop 2.0!
  def test_flag_parameters
    @p.opt :defaultnone, "desc"
    @p.opt :defaultfalse, "desc", :default => false
    @p.opt :defaulttrue, "desc", :default => true

    ## default state
    opts = @p.parse []
    assert_equal false, opts[:defaultnone]
    assert_equal false, opts[:defaultfalse]
    assert_equal true, opts[:defaulttrue]

    ## specifying turns them on, regardless of default
    opts = @p.parse %w(--defaultfalse --defaulttrue --defaultnone)
    assert_equal true, opts[:defaultnone]
    assert_equal true, opts[:defaultfalse]
    assert_equal true, opts[:defaulttrue]

    ## using --no- form turns them off, regardless of default
    opts = @p.parse %w(--no-defaultfalse --no-defaulttrue --no-defaultnone)
    assert_equal false, opts[:defaultnone]
    assert_equal false, opts[:defaultfalse]
    assert_equal false, opts[:defaulttrue]
  end

  ## note: this behavior has changed in trollop 2.0!
  def test_flag_parameters_for_inverted_flags
    @p.opt :no_default_none, "desc"
    @p.opt :no_default_false, "desc", :default => false
    @p.opt :no_default_true, "desc", :default => true

    ## default state
    opts = @p.parse []
    assert_equal false, opts[:no_default_none]
    assert_equal false, opts[:no_default_false]
    assert_equal true, opts[:no_default_true]

    ## specifying turns them all on, regardless of default
    opts = @p.parse %w(--no-default-false --no-default-true --no-default-none)
    p opts
    assert_equal true, opts[:no_default_none]
    assert_equal true, opts[:no_default_false]
    assert_equal true, opts[:no_default_true]

    ## using dropped-no form turns them all off, regardless of default
    opts = @p.parse %w(--default-false --default-true --default-none)
    assert_equal false, opts[:no_default_none]
    assert_equal false, opts[:no_default_false]
    assert_equal false, opts[:no_default_true]

    ## disallow double negatives for reasons of sanity preservation
    assert_raises(CommandlineError) { @p.parse %w(--no-no-default-true) }
  end

  def test_special_flags_work
    @p.version "asdf fdas"
    assert_raises(VersionNeeded) { @p.parse(%w(-v)) }
    assert_raises(HelpNeeded) { @p.parse(%w(-h)) }
  end

  def test_short_options_combine
    @p.opt :arg1, "desc", :short => "a"
    @p.opt :arg2, "desc", :short => "b"
    @p.opt :arg3, "desc", :short => "c", :type => :int

    opts = @p.parse %w(-a -b)
    assert_equal true, opts[:arg1]
    assert_equal true, opts[:arg2]
    assert_equal nil, opts[:arg3]

    opts = @p.parse %w(-ab)
    assert_equal true, opts[:arg1]
    assert_equal true, opts[:arg2]
    assert_equal nil, opts[:arg3]

    opts = @p.parse %w(-ac 4 -b)
    assert_equal true, opts[:arg1]
    assert_equal true, opts[:arg2]
    assert_equal 4, opts[:arg3]

    assert_raises(CommandlineError) { @p.parse %w(-cab 4) }
    assert_raises(CommandlineError) { @p.parse %w(-cba 4) }
  end

  def test_version_only_appears_if_set
    @p.opt "arg"
    assert_raises(CommandlineError) { @p.parse %w(-v) }
    @p.version "trollop 1.2.3.4"
    assert_raises(VersionNeeded) { @p.parse %w(-v) }
  end

  def test_doubledash_ends_option_processing
    @p.opt :arg1, "desc", :short => "a", :default => 0
    @p.opt :arg2, "desc", :short => "b", :default => 0
    opts = @p.parse %w(-- -a 3 -b 2)
    assert_equal opts[:arg1], 0
    assert_equal opts[:arg2], 0
    assert_equal %w(-a 3 -b 2), @p.leftovers
    opts = @p.parse %w(-a 3 -- -b 2)
    assert_equal opts[:arg1], 3
    assert_equal opts[:arg2], 0
    assert_equal %w(-b 2), @p.leftovers
    opts = @p.parse %w(-a 3 -b 2 --)
    assert_equal opts[:arg1], 3
    assert_equal opts[:arg2], 2
    assert_equal %w(), @p.leftovers
  end

  def test_wrap
    assert_equal [""], @p.wrap("")
    assert_equal ["a"], @p.wrap("a")
    assert_equal ["one two", "three"], @p.wrap("one two three", :width => 8)
    assert_equal ["one two three"], @p.wrap("one two three", :width => 80)
    assert_equal ["one", "two", "three"], @p.wrap("one two three", :width => 3)
    assert_equal ["onetwothree"], @p.wrap("onetwothree", :width => 3)
    assert_equal [
      "Test is an awesome program that does something very, very important.",
      "",
      "Usage:",
      "  test [options] <filenames>+",
      "where [options] are:"], @p.wrap(<<EOM, :width => 100)
Test is an awesome program that does something very, very important.

Usage:
  test [options] <filenames>+
where [options] are:
EOM
  end

  def test_multi_line_description
    out = StringIO.new
    @p.opt :arg, <<-EOM, :type => :int
This is an arg
with a multi-line description
    EOM
    @p.educate(out)
    assert_equal <<-EOM, out.string
Options:
  --arg=<i>    This is an arg
               with a multi-line description
    EOM
  end

  def test_floating_point_formatting
    @p.opt :arg, "desc", :type => :float, :short => "f"
    opts = @p.parse %w(-f 1)
    assert_equal 1.0, opts[:arg]
    opts = @p.parse %w(-f 1.0)
    assert_equal 1.0, opts[:arg]
    opts = @p.parse %w(-f 0.1)
    assert_equal 0.1, opts[:arg]
    opts = @p.parse %w(-f .1)
    assert_equal 0.1, opts[:arg]
    opts = @p.parse %w(-f .99999999999999999999)
    assert_equal 1.0, opts[:arg]
    opts = @p.parse %w(-f -1)
    assert_equal(-1.0, opts[:arg])
    opts = @p.parse %w(-f -1.0)
    assert_equal(-1.0, opts[:arg])
    opts = @p.parse %w(-f -0.1)
    assert_equal(-0.1, opts[:arg])
    opts = @p.parse %w(-f -.1)
    assert_equal(-0.1, opts[:arg])
    assert_raises(CommandlineError) { @p.parse %w(-f a) }
    assert_raises(CommandlineError) { @p.parse %w(-f 1a) }
    assert_raises(CommandlineError) { @p.parse %w(-f 1.a) }
    assert_raises(CommandlineError) { @p.parse %w(-f a.1) }
    assert_raises(CommandlineError) { @p.parse %w(-f 1.0.0) }
    assert_raises(CommandlineError) { @p.parse %w(-f .) }
    assert_raises(CommandlineError) { @p.parse %w(-f -.) }
  end

  def test_date_formatting
    @p.opt :arg, "desc", :type => :date, :short => 'd'
    opts = @p.parse(['-d', 'Jan 4, 2007'])
    assert_equal Date.civil(2007, 1, 4), opts[:arg]
    opts = @p.parse(['-d', 'today'])
    assert_equal Date.today, opts[:arg]
  end

  def test_short_options_cant_be_numeric
    assert_raises(ArgumentError) { @p.opt :arg, "desc", :short => "-1" }
    @p.opt :a1b, "desc"
    @p.opt :a2b, "desc"
    assert @p.specs[:a2b][:short].to_i == 0
  end

  def test_short_options_can_be_weird
    @p.opt :arg1, "desc", :short => "#"
    @p.opt :arg2, "desc", :short => "."
    assert_raises(ArgumentError) { @p.opt :arg3, "desc", :short => "-" }
  end

  def test_options_cant_be_set_multiple_times_if_not_specified
    @p.opt :arg, "desc", :short => "-x"
    @p.parse %w(-x)
    assert_raises(CommandlineError) { @p.parse %w(-x -x) }
    assert_raises(CommandlineError) { @p.parse %w(-xx) }
  end

  def test_options_can_be_set_multiple_times_if_specified
    @p.opt :arg, "desc", :short => "-x", :multi => true
    @p.parse %w(-x)
    @p.parse %w(-x -x)
    @p.parse %w(-xx)
  end

  def test_short_options_with_multiple_options
    @p.opt :xarg, "desc", :short => "-x", :type => String, :multi => true
    opts = @p.parse %w(-x a -x b)
    assert_equal %w(a b), opts[:xarg]
    assert_equal [], @p.leftovers
  end

  def test_short_options_with_multiple_options_does_not_affect_flags_type
    @p.opt :xarg, "desc", :short => "-x", :type => :flag, :multi => true

    opts = @p.parse %w(-x a)
    assert_equal true, opts[:xarg]
    assert_equal %w(a), @p.leftovers

    opts = @p.parse %w(-x a -x b)
    assert_equal true, opts[:xarg]
    assert_equal %w(a b), @p.leftovers

    opts = @p.parse %w(-xx a -x b)
    assert_equal true, opts[:xarg]
    assert_equal %w(a b), @p.leftovers
  end

  def test_short_options_with_multiple_arguments
    @p.opt :xarg, "desc", :type => :ints
    opts = @p.parse %w(-x 3 4 0)
    assert_equal [3, 4, 0], opts[:xarg]
    assert_equal [], @p.leftovers

    @p.opt :yarg, "desc", :type => :floats
    opts = @p.parse %w(-y 3.14 4.21 0.66)
    assert_equal [3.14, 4.21, 0.66], opts[:yarg]
    assert_equal [], @p.leftovers

    @p.opt :zarg, "desc", :type => :strings
    opts = @p.parse %w(-z a b c)
    assert_equal %w(a b c), opts[:zarg]
    assert_equal [], @p.leftovers
  end

  def test_short_options_with_multiple_options_and_arguments
    @p.opt :xarg, "desc", :type => :ints, :multi => true
    opts = @p.parse %w(-x 3 4 5 -x 6 7)
    assert_equal [[3, 4, 5], [6, 7]], opts[:xarg]
    assert_equal [], @p.leftovers

    @p.opt :yarg, "desc", :type => :floats, :multi => true
    opts = @p.parse %w(-y 3.14 4.21 5.66 -y 6.99 7.01)
    assert_equal [[3.14, 4.21, 5.66], [6.99, 7.01]], opts[:yarg]
    assert_equal [], @p.leftovers

    @p.opt :zarg, "desc", :type => :strings, :multi => true
    opts = @p.parse %w(-z a b c -z d e)
    assert_equal [%w(a b c), %w(d e)], opts[:zarg]
    assert_equal [], @p.leftovers
  end

  def test_combined_short_options_with_multiple_arguments
    @p.opt :arg1, "desc", :short => "a"
    @p.opt :arg2, "desc", :short => "b"
    @p.opt :arg3, "desc", :short => "c", :type => :ints
    @p.opt :arg4, "desc", :short => "d", :type => :floats

    opts = @p.parse %w(-abc 4 6 9)
    assert_equal true, opts[:arg1]
    assert_equal true, opts[:arg2]
    assert_equal [4, 6, 9], opts[:arg3]

    opts = @p.parse %w(-ac 4 6 9 -bd 3.14 2.41)
    assert_equal true, opts[:arg1]
    assert_equal true, opts[:arg2]
    assert_equal [4, 6, 9], opts[:arg3]
    assert_equal [3.14, 2.41], opts[:arg4]

    assert_raises(CommandlineError) { opts = @p.parse %w(-abcd 3.14 2.41) }
  end

  def test_long_options_with_multiple_options
    @p.opt :xarg, "desc", :type => String, :multi => true
    opts = @p.parse %w(--xarg=a --xarg=b)
    assert_equal %w(a b), opts[:xarg]
    assert_equal [], @p.leftovers
    opts = @p.parse %w(--xarg a --xarg b)
    assert_equal %w(a b), opts[:xarg]
    assert_equal [], @p.leftovers
  end

  def test_long_options_with_multiple_arguments
    @p.opt :xarg, "desc", :type => :ints
    opts = @p.parse %w(--xarg 3 2 5)
    assert_equal [3, 2, 5], opts[:xarg]
    assert_equal [], @p.leftovers
    opts = @p.parse %w(--xarg=3)
    assert_equal [3], opts[:xarg]
    assert_equal [], @p.leftovers

    @p.opt :yarg, "desc", :type => :floats
    opts = @p.parse %w(--yarg 3.14 2.41 5.66)
    assert_equal [3.14, 2.41, 5.66], opts[:yarg]
    assert_equal [], @p.leftovers
    opts = @p.parse %w(--yarg=3.14)
    assert_equal [3.14], opts[:yarg]
    assert_equal [], @p.leftovers

    @p.opt :zarg, "desc", :type => :strings
    opts = @p.parse %w(--zarg a b c)
    assert_equal %w(a b c), opts[:zarg]
    assert_equal [], @p.leftovers
    opts = @p.parse %w(--zarg=a)
    assert_equal %w(a), opts[:zarg]
    assert_equal [], @p.leftovers
  end

  def test_long_options_with_multiple_options_and_arguments
    @p.opt :xarg, "desc", :type => :ints, :multi => true
    opts = @p.parse %w(--xarg 3 2 5 --xarg 2 1)
    assert_equal [[3, 2, 5], [2, 1]], opts[:xarg]
    assert_equal [], @p.leftovers
    opts = @p.parse %w(--xarg=3 --xarg=2)
    assert_equal [[3], [2]], opts[:xarg]
    assert_equal [], @p.leftovers

    @p.opt :yarg, "desc", :type => :floats, :multi => true
    opts = @p.parse %w(--yarg 3.14 2.72 5 --yarg 2.41 1.41)
    assert_equal [[3.14, 2.72, 5], [2.41, 1.41]], opts[:yarg]
    assert_equal [], @p.leftovers
    opts = @p.parse %w(--yarg=3.14 --yarg=2.41)
    assert_equal [[3.14], [2.41]], opts[:yarg]
    assert_equal [], @p.leftovers

    @p.opt :zarg, "desc", :type => :strings, :multi => true
    opts = @p.parse %w(--zarg a b c --zarg d e)
    assert_equal [%w(a b c), %w(d e)], opts[:zarg]
    assert_equal [], @p.leftovers
    opts = @p.parse %w(--zarg=a --zarg=d)
    assert_equal [%w(a), %w(d)], opts[:zarg]
    assert_equal [], @p.leftovers
  end

  def test_long_options_also_take_equals
    @p.opt :arg, "desc", :long => "arg", :type => String, :default => "hello"
    opts = @p.parse %w()
    assert_equal "hello", opts[:arg]
    opts = @p.parse %w(--arg goat)
    assert_equal "goat", opts[:arg]
    opts = @p.parse %w(--arg=goat)
    assert_equal "goat", opts[:arg]
    ## actually, this next one is valid. empty string for --arg, and goat as a
    ## leftover.
    ## assert_raises(CommandlineError) { opts = @p.parse %w(--arg= goat) }
  end

  def test_auto_generated_long_names_convert_underscores_to_hyphens
    @p.opt :hello_there
    assert_equal "hello-there", @p.specs[:hello_there][:long]
  end

  def test_arguments_passed_through_block
    @goat = 3
    boat = 4
    Parser.new(@goat) do |goat|
      boat = goat
    end
    assert_equal @goat, boat
  end

  def test_help_has_default_banner
    @p = Parser.new
    sio = StringIO.new "w"
    @p.parse []
    @p.educate sio
    help = sio.string.split "\n"
    assert help[0] =~ /options/i
    assert_equal 2, help.length # options, then -h

    @p = Parser.new
    @p.version "my version"
    sio = StringIO.new "w"
    @p.parse []
    @p.educate sio
    help = sio.string.split "\n"
    assert help[0] =~ /my version/i
    assert_equal 4, help.length # version, options, -h, -v

    @p = Parser.new
    @p.banner "my own banner"
    sio = StringIO.new "w"
    @p.parse []
    @p.educate sio
    help = sio.string.split "\n"
    assert help[0] =~ /my own banner/i
    assert_equal 2, help.length # banner, -h
  end

  def test_help_has_optional_usage
    @p = Parser.new
    @p.usage "OPTIONS FILES"
    sio = StringIO.new "w"
    @p.parse []
    @p.educate sio
    help = sio.string.split "\n"
    assert help[0] =~ /OPTIONS FILES/i
    assert_equal 4, help.length # line break, options, then -h
  end

  def test_help_has_optional_synopsis
    @p = Parser.new
    @p.synopsis "About this program"
    sio = StringIO.new "w"
    @p.parse []
    @p.educate sio
    help = sio.string.split "\n"
    assert help[0] =~ /About this program/i
    assert_equal 4, help.length # line break, options, then -h
  end

  def test_help_has_specific_order_for_usage_and_synopsis
    @p = Parser.new
    @p.usage "OPTIONS FILES"
    @p.synopsis "About this program"
    sio = StringIO.new "w"
    @p.parse []
    @p.educate sio
    help = sio.string.split "\n"
    assert help[0] =~ /OPTIONS FILES/i
    assert help[1] =~ /About this program/i
    assert_equal 5, help.length # line break, options, then -h
  end

  def test_help_preserves_positions
    @p.opt :zzz, "zzz"
    @p.opt :aaa, "aaa"
    sio = StringIO.new "w"
    @p.educate sio

    help = sio.string.split "\n"
    assert help[1] =~ /zzz/
    assert help[2] =~ /aaa/
  end

  def test_help_includes_option_types
    @p.opt :arg1, 'arg', :type => :int
    @p.opt :arg2, 'arg', :type => :ints
    @p.opt :arg3, 'arg', :type => :string
    @p.opt :arg4, 'arg', :type => :strings
    @p.opt :arg5, 'arg', :type => :float
    @p.opt :arg6, 'arg', :type => :floats
    @p.opt :arg7, 'arg', :type => :io
    @p.opt :arg8, 'arg', :type => :ios
    @p.opt :arg9, 'arg', :type => :date
    @p.opt :arg10, 'arg', :type => :dates
    sio = StringIO.new "w"
    @p.educate sio

    help = sio.string.split "\n"
    assert help[1] =~ /<i>/
    assert help[2] =~ /<i\+>/
    assert help[3] =~ /<s>/
    assert help[4] =~ /<s\+>/
    assert help[5] =~ /<f>/
    assert help[6] =~ /<f\+>/
    assert help[7] =~ /<filename\/uri>/
    assert help[8] =~ /<filename\/uri\+>/
    assert help[9] =~ /<date>/
    assert help[10] =~ /<date\+>/
  end

  def test_help_has_grammatical_default_text
    @p.opt :arg1, 'description with period.', :default => 'hello'
    @p.opt :arg2, 'description without period', :default => 'world'
    sio = StringIO.new 'w'
    @p.educate sio

    help = sio.string.split "\n"
    assert help[1] =~ /Default/
    assert help[2] =~ /default/
  end

  def test_version_and_help_short_args_can_be_overridden
    @p.opt :verbose, "desc", :short => "-v"
    @p.opt :hello, "desc", :short => "-h"
    @p.version "version"

    @p.parse(%w(-v))
    assert_raises(VersionNeeded) { @p.parse(%w(--version)) }
    @p.parse(%w(-h))
    assert_raises(HelpNeeded) { @p.parse(%w(--help)) }
  end

  def test_version_and_help_long_args_can_be_overridden
    @p.opt :asdf, "desc", :long => "help"
    @p.opt :asdf2, "desc2", :long => "version"
    @p.parse %w()
    @p.parse %w(--help)
    @p.parse %w(--version)
    @p.parse %w(-h)
    @p.parse %w(-v)
  end

  def test_version_and_help_override_errors
    @p.opt :asdf, "desc", :type => String
    @p.version "version"
    @p.parse %w(--asdf goat)
    assert_raises(CommandlineError) { @p.parse %w(--asdf) }
    assert_raises(HelpNeeded) { @p.parse %w(--asdf --help) }
    assert_raises(VersionNeeded) { @p.parse %w(--asdf --version) }
  end

  def test_conflicts
    @p.opt :one
    assert_raises(ArgumentError) { @p.conflicts :one, :two }
    @p.opt :two
    @p.conflicts :one, :two
    @p.parse %w(--one)
    @p.parse %w(--two)
    assert_raises(CommandlineError) { @p.parse %w(--one --two) }

    @p.opt :hello
    @p.opt :yellow
    @p.opt :mellow
    @p.opt :jello
    @p.conflicts :hello, :yellow, :mellow, :jello
    assert_raises(CommandlineError) { @p.parse %w(--hello --yellow --mellow --jello) }
    assert_raises(CommandlineError) { @p.parse %w(--hello --mellow --jello) }
    assert_raises(CommandlineError) { @p.parse %w(--hello --jello) }

    @p.parse %w(--hello)
    @p.parse %w(--jello)
    @p.parse %w(--yellow)
    @p.parse %w(--mellow)

    @p.parse %w(--mellow --one)
    @p.parse %w(--mellow --two)

    assert_raises(CommandlineError) { @p.parse %w(--mellow --two --jello) }
    assert_raises(CommandlineError) { @p.parse %w(--one --mellow --two --jello) }
  end

  def test_conflict_error_messages
    @p.opt :one
    @p.opt "two"
    @p.conflicts :one, "two"

    assert_raises(CommandlineError, /--one.*--two/) { @p.parse %w(--one --two) }
  end

  def test_depends
    @p.opt :one
    assert_raises(ArgumentError) { @p.depends :one, :two }
    @p.opt :two
    @p.depends :one, :two
    @p.parse %w(--one --two)
    assert_raises(CommandlineError) { @p.parse %w(--one) }
    assert_raises(CommandlineError) { @p.parse %w(--two) }

    @p.opt :hello
    @p.opt :yellow
    @p.opt :mellow
    @p.opt :jello
    @p.depends :hello, :yellow, :mellow, :jello
    @p.parse %w(--hello --yellow --mellow --jello)
    assert_raises(CommandlineError) { @p.parse %w(--hello --mellow --jello) }
    assert_raises(CommandlineError) { @p.parse %w(--hello --jello) }

    assert_raises(CommandlineError) { @p.parse %w(--hello) }
    assert_raises(CommandlineError) { @p.parse %w(--mellow) }

    @p.parse %w(--hello --yellow --mellow --jello --one --two)
    @p.parse %w(--hello --yellow --mellow --jello --one --two a b c)

    assert_raises(CommandlineError) { @p.parse %w(--mellow --two --jello --one) }
  end

  def test_depend_error_messages
    @p.opt :one
    @p.opt "two"
    @p.depends :one, "two"

    @p.parse %w(--one --two)

    assert_raises(CommandlineError, /--one.*--two/) { @p.parse %w(--one) }
    assert_raises(CommandlineError, /--one.*--two/) { @p.parse %w(--two) }
  end

  ## courtesy neill zero
  def test_two_required_one_missing_accuses_correctly
    @p.opt "arg1", "desc1", :required => true
    @p.opt "arg2", "desc2", :required => true

    assert_raises(CommandlineError, /arg2/) { @p.parse(%w(--arg1)) }
    assert_raises(CommandlineError, /arg1/) { @p.parse(%w(--arg2)) }
    @p.parse(%w(--arg1 --arg2))
  end

  def test_stopwords_mixed
    @p.opt "arg1", :default => false
    @p.opt "arg2", :default => false
    @p.stop_on %w(happy sad)

    opts = @p.parse %w(--arg1 happy --arg2)
    assert_equal true, opts["arg1"]
    assert_equal false, opts["arg2"]

    ## restart parsing
    @p.leftovers.shift
    opts = @p.parse @p.leftovers
    assert_equal false, opts["arg1"]
    assert_equal true, opts["arg2"]
  end

  def test_stopwords_no_stopwords
    @p.opt "arg1", :default => false
    @p.opt "arg2", :default => false
    @p.stop_on %w(happy sad)

    opts = @p.parse %w(--arg1 --arg2)
    assert_equal true, opts["arg1"]
    assert_equal true, opts["arg2"]

    ## restart parsing
    @p.leftovers.shift
    opts = @p.parse @p.leftovers
    assert_equal false, opts["arg1"]
    assert_equal false, opts["arg2"]
  end

  def test_stopwords_multiple_stopwords
    @p.opt "arg1", :default => false
    @p.opt "arg2", :default => false
    @p.stop_on %w(happy sad)

    opts = @p.parse %w(happy sad --arg1 --arg2)
    assert_equal false, opts["arg1"]
    assert_equal false, opts["arg2"]

    ## restart parsing
    @p.leftovers.shift
    opts = @p.parse @p.leftovers
    assert_equal false, opts["arg1"]
    assert_equal false, opts["arg2"]

    ## restart parsing again
    @p.leftovers.shift
    opts = @p.parse @p.leftovers
    assert_equal true, opts["arg1"]
    assert_equal true, opts["arg2"]
  end

  def test_stopwords_with_short_args
    @p.opt :global_option, "This is a global option", :short => "-g"
    @p.stop_on %w(sub-command-1 sub-command-2)

    global_opts = @p.parse %w(-g sub-command-1 -c)
    cmd = @p.leftovers.shift

    @q = Parser.new
    @q.opt :cmd_option, "This is an option only for the subcommand", :short => "-c"
    cmd_opts = @q.parse @p.leftovers

    assert_equal true, global_opts[:global_option]
    assert_nil global_opts[:cmd_option]

    assert_equal true, cmd_opts[:cmd_option]
    assert_nil cmd_opts[:global_option]

    assert_equal cmd, "sub-command-1"
    assert_equal @q.leftovers, []
  end

  def assert_parses_correctly(parser, commandline, expected_opts,
                              expected_leftovers)
    opts = parser.parse commandline
    assert_equal expected_opts, opts
    assert_equal expected_leftovers, parser.leftovers
  end

  def test_unknown_subcommand
    @p.opt :global_flag, "Global flag", :short => "-g", :type => :flag
    @p.opt :global_param, "Global parameter", :short => "-p", :default => 5
    @p.stop_on_unknown

    expected_opts = { :global_flag => true, :help => false, :global_param => 5, :global_flag_given => true }
    expected_leftovers = [ "my_subcommand", "-c" ]

    assert_parses_correctly @p, %w(--global-flag my_subcommand -c), \
      expected_opts, expected_leftovers
    assert_parses_correctly @p, %w(-g my_subcommand -c), \
      expected_opts, expected_leftovers

    expected_opts = { :global_flag => false, :help => false, :global_param => 5, :global_param_given => true }
    expected_leftovers = [ "my_subcommand", "-c" ]

    assert_parses_correctly @p, %w(-p 5 my_subcommand -c), \
      expected_opts, expected_leftovers
    assert_parses_correctly @p, %w(--global-param 5 my_subcommand -c), \
      expected_opts, expected_leftovers
  end

  def test_alternate_args
    args = %w(-a -b -c)

    opts = ::Trollop.options(args) do
      opt :alpher, "Ralph Alpher", :short => "-a"
      opt :bethe, "Hans Bethe", :short => "-b"
      opt :gamow, "George Gamow", :short => "-c"
    end

    physicists_with_humor = [:alpher, :bethe, :gamow]
    physicists_with_humor.each do |physicist|
      assert_equal true, opts[physicist]
    end
  end

  def test_date_arg_type
    temp = Date.new
    @p.opt :arg, 'desc', :type => :date
    @p.opt :arg2, 'desc', :type => Date
    @p.opt :arg3, 'desc', :default => temp

    opts = @p.parse []
    assert_equal temp, opts[:arg3]

    opts = @p.parse %w(--arg 5/1/2010)
    assert_kind_of Date, opts[:arg]
    assert_equal Date.new(2010, 5, 1), opts[:arg]

    opts = @p.parse %w(--arg2 5/1/2010)
    assert_kind_of Date, opts[:arg2]
    assert_equal Date.new(2010, 5, 1), opts[:arg2]
  end

  def test_unknown_arg_class_type
    assert_raises ArgumentError do
      @p.opt :arg, 'desc', :type => Hash
    end
  end

  def test_io_arg_type
    @p.opt :arg, "desc", :type => :io
    @p.opt :arg2, "desc", :type => IO
    @p.opt :arg3, "desc", :default => $stdout

    opts = @p.parse []
    assert_equal $stdout, opts[:arg3]

    opts = @p.parse %w(--arg /dev/null)
    assert_kind_of File, opts[:arg]
    assert_equal "/dev/null", opts[:arg].path

    #TODO: move to mocks
    #opts = @p.parse %w(--arg2 http://google.com/)
    #assert_kind_of StringIO, opts[:arg2]

    opts = @p.parse %w(--arg3 stdin)
    assert_equal $stdin, opts[:arg3]

    assert_raises(CommandlineError) { opts = @p.parse %w(--arg /fdasfasef/fessafef/asdfasdfa/fesasf) }
  end

  def test_openstruct_style_access
    @p.opt "arg1", "desc", :type => :int
    @p.opt :arg2, "desc", :type => :int

    opts = @p.parse(%w(--arg1 3 --arg2 4))

    opts.arg1
    opts.arg2
    assert_equal 3, opts.arg1
    assert_equal 4, opts.arg2
  end

  def test_multi_args_autobox_defaults
    @p.opt :arg1, "desc", :default => "hello", :multi => true
    @p.opt :arg2, "desc", :default => ["hello"], :multi => true

    opts = @p.parse []
    assert_equal ["hello"], opts[:arg1]
    assert_equal ["hello"], opts[:arg2]

    opts = @p.parse %w(--arg1 hello)
    assert_equal ["hello"], opts[:arg1]
    assert_equal ["hello"], opts[:arg2]

    opts = @p.parse %w(--arg1 hello --arg1 there)
    assert_equal ["hello", "there"], opts[:arg1]
  end

  def test_ambigious_multi_plus_array_default_resolved_as_specified_by_documentation
    @p.opt :arg1, "desc", :default => ["potato"], :multi => true
    @p.opt :arg2, "desc", :default => ["potato"], :multi => true, :type => :strings
    @p.opt :arg3, "desc", :default => ["potato"]
    @p.opt :arg4, "desc", :default => ["potato", "rhubarb"], :short => :none, :multi => true

    ## arg1 should be multi-occurring but not multi-valued
    opts = @p.parse %w(--arg1 one two)
    assert_equal ["one"], opts[:arg1]
    assert_equal ["two"], @p.leftovers

    opts = @p.parse %w(--arg1 one --arg1 two)
    assert_equal ["one", "two"], opts[:arg1]
    assert_equal [], @p.leftovers

    ## arg2 should be multi-valued and multi-occurring
    opts = @p.parse %w(--arg2 one two)
    assert_equal [["one", "two"]], opts[:arg2]
    assert_equal [], @p.leftovers

    ## arg3 should be multi-valued but not multi-occurring
    opts = @p.parse %w(--arg3 one two)
    assert_equal ["one", "two"], opts[:arg3]
    assert_equal [], @p.leftovers

    ## arg4 should be multi-valued but not multi-occurring
    opts = @p.parse %w()
    assert_equal ["potato", "rhubarb"], opts[:arg4]
  end

  def test_given_keys
    @p.opt :arg1
    @p.opt :arg2

    opts = @p.parse %w(--arg1)
    assert opts[:arg1_given]
    assert !opts[:arg2_given]

    opts = @p.parse %w(--arg2)
    assert !opts[:arg1_given]
    assert opts[:arg2_given]

    opts = @p.parse []
    assert !opts[:arg1_given]
    assert !opts[:arg2_given]

    opts = @p.parse %w(--arg1 --arg2)
    assert opts[:arg1_given]
    assert opts[:arg2_given]
  end

  def test_default_shorts_assigned_only_after_user_shorts
    @p.opt :aab, "aaa" # should be assigned to -b
    @p.opt :ccd, "bbb" # should be assigned to -d
    @p.opt :user1, "user1", :short => 'a'
    @p.opt :user2, "user2", :short => 'c'

    opts = @p.parse %w(-a -b)
    assert opts[:user1]
    assert !opts[:user2]
    assert opts[:aab]
    assert !opts[:ccd]

    opts = @p.parse %w(-c -d)
    assert !opts[:user1]
    assert opts[:user2]
    assert !opts[:aab]
    assert opts[:ccd]
  end

  def test_accepts_arguments_with_spaces
    @p.opt :arg1, "arg", :type => String
    @p.opt :arg2, "arg2", :type => String

    opts = @p.parse ["--arg1", "hello there", "--arg2=hello there"]
    assert_equal "hello there", opts[:arg1]
    assert_equal "hello there", opts[:arg2]
    assert_equal 0, @p.leftovers.size
  end

  def test_multi_args_default_to_empty_array
    @p.opt :arg1, "arg", :multi => true
    opts = @p.parse []
    assert_equal [], opts[:arg1]
  end

  def test_simple_interface_handles_help
    ARGV.clear
    ARGV.unshift "-h"
    assert_raises(SystemExit) do
      ::Trollop::options do
        opt :potato
      end
    end
  end

  def test_simple_interface_handles_version
    ARGV.clear
    ARGV.unshift "-v"
    assert_raises(SystemExit) do
      ::Trollop::options do
        version "1.2"
        opt :potato
      end
    end
  end

  def test_simple_interface_handles_regular_usage
    ARGV.clear
    ARGV.unshift "--potato"
    opts = ::Trollop::options do
      opt :potato
    end
    assert opts[:potato]
  end

  def test_simple_interface_handles_die
    old_stderr, $stderr = $stderr, StringIO.new('w')
    ARGV.clear
    ARGV.unshift "--potato"
    ::Trollop::options do
      opt :potato
    end
    assert_raises(SystemExit) { ::Trollop::die :potato, "is invalid" }
  ensure
    $stderr = old_stderr
  end

  def test_simple_interface_handles_die_without_message
    old_stderr, $stderr = $stderr, StringIO.new('w')
    ARGV.clear
    ARGV.unshift "--potato"
    opts = ::Trollop::options do
      opt :potato
    end
    assert_raises(SystemExit) { ::Trollop::die :potato }
    assert $stderr.string =~ /Error:/
  ensure
    $stderr = old_stderr
  end

  def test_with_standard_exception_handling
    assert_raises(SystemExit) do
      ::Trollop.with_standard_exception_handling(@p) do
        raise ::Trollop::CommandlineError.new('cl error')
      end
    end
  end

  def test_supports_callback_inline
    assert_raises(RuntimeError, "good") do
      @p.opt :cb1 do |vals|
        raise "good"
      end
      @p.parse(%w(--cb1))
    end
  end

  def test_supports_callback_param
    assert_raises(RuntimeError, "good") do
      @p.opt :cb1, "with callback", :callback => lambda { |vals| raise "good" }
      @p.parse(%w(--cb1))
    end
  end
end

end
end


text:
package org.apache.skywalking.oap.query.graphql;

import com.coxautodev.graphql.tools.SchemaParser;
import graphql.GraphQL;
import graphql.schema.GraphQLSchema;
import org.apache.skywalking.oap.query.graphql.resolver.AggregationQuery;
import org.apache.skywalking.oap.query.graphql.resolver.AlarmQuery;
import org.apache.skywalking.oap.query.graphql.resolver.BrowserLogQuery;
import org.apache.skywalking.oap.query.graphql.resolver.HealthQuery;
import org.apache.skywalking.oap.query.graphql.resolver.LogQuery;
import org.apache.skywalking.oap.query.graphql.resolver.MetadataQuery;
import org.apache.skywalking.oap.query.graphql.resolver.MetricQuery;
import org.apache.skywalking.oap.query.graphql.resolver.MetricsQuery;
import org.apache.skywalking.oap.query.graphql.resolver.Mutation;
import org.apache.skywalking.oap.query.graphql.resolver.ProfileMutation;
import org.apache.skywalking.oap.query.graphql.resolver.ProfileQuery;
import org.apache.skywalking.oap.query.graphql.resolver.Query;
import org.apache.skywalking.oap.query.graphql.resolver.TopNRecordsQuery;
import org.apache.skywalking.oap.query.graphql.resolver.TopologyQuery;
import org.apache.skywalking.oap.query.graphql.resolver.TraceQuery;
import org.apache.skywalking.oap.query.graphql.resolver.UIConfigurationManagement;
import org.apache.skywalking.oap.server.core.CoreModule;
import org.apache.skywalking.oap.server.core.query.QueryModule;
import org.apache.skywalking.oap.server.core.server.JettyHandlerRegister;
import org.apache.skywalking.oap.server.library.module.ModuleConfig;
import org.apache.skywalking.oap.server.library.module.ModuleDefine;
import org.apache.skywalking.oap.server.library.module.ModuleProvider;
import org.apache.skywalking.oap.server.library.module.ModuleStartException;
import org.apache.skywalking.oap.server.library.module.ServiceNotProvidedException;

/**
 * GraphQL query provider.
 */
public class GraphQLQueryProvider extends ModuleProvider {

    private final GraphQLQueryConfig config = new GraphQLQueryConfig();

    private GraphQL graphQL;

    @Override
    public String name() {
        return "graphql";
    }

    @Override
    public Class<? extends ModuleDefine> module() {
        return QueryModule.class;
    }

    @Override
    public ModuleConfig createConfigBeanIfAbsent() {
        return config;
    }

    @Override
    public void prepare() throws ServiceNotProvidedException, ModuleStartException {
        GraphQLSchema schema = SchemaParser.newParser()
                                           .file("query-protocol/common.graphqls")
                                           .resolvers(new Query(), new Mutation(), new HealthQuery(getManager()))
                                           .file("query-protocol/metadata.graphqls")
                                           .resolvers(new MetadataQuery(getManager()))
                                           .file("query-protocol/topology.graphqls")
                                           .resolvers(new TopologyQuery(getManager()))
                                           /**
                                            * Metrics v2 query protocol is an alternative metrics query(s) of original v1,
                                            * defined in the metric.graphql, top-n-records.graphqls, and aggregation.graphqls.
                                            */
                                           .file("query-protocol/metrics-v2.graphqls")
                                           .resolvers(new MetricsQuery(getManager()))
                                           ////////
                                           //Deprecated Queries
                                           ////////
                                           .file("query-protocol/metric.graphqls")
                                           .resolvers(new MetricQuery(getManager()))
                                           .file("query-protocol/aggregation.graphqls")
                                           .resolvers(new AggregationQuery(getManager()))
                                           .file("query-protocol/top-n-records.graphqls")
                                           .resolvers(new TopNRecordsQuery(getManager()))
                                           ////////
                                           .file("query-protocol/trace.graphqls")
                                           .resolvers(new TraceQuery(getManager()))
                                           .file("query-protocol/alarm.graphqls")
                                           .resolvers(new AlarmQuery(getManager()))
                                           .file("query-protocol/log.graphqls")
                                           .resolvers(new LogQuery(getManager()))
                                           .file("query-protocol/profile.graphqls")
                                           .resolvers(new ProfileQuery(getManager()), new ProfileMutation(getManager()))
                                           .file("query-protocol/ui-configuration.graphqls")
                                           .resolvers(new UIConfigurationManagement(getManager()))
                                           .file("query-protocol/browser-log.graphqls")
                                           .resolvers(new BrowserLogQuery(getManager()))
                                           .build()
                                           .makeExecutableSchema();
        this.graphQL = GraphQL.newGraphQL(schema).build();
    }

    @Override
    public void start() throws ServiceNotProvidedException, ModuleStartException {
        JettyHandlerRegister service = getManager().find(CoreModule.NAME)
                                                   .provider()
                                                   .getService(JettyHandlerRegister.class);
        service.addHandler(new GraphQLQueryHandler(config.getPath(), graphQL));
    }

    @Override
    public void notifyAfterCompleted() throws ServiceNotProvidedException, ModuleStartException {

    }

    @Override
    public String[] requiredModules() {
        return new String[0];
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Fitbit.Api.Portable;
using Fitbit.Models;
using FluentAssertions;
using NUnit.Framework;

namespace Fitbit.Portable.Tests
{
    [TestFixture]
    public class FriendsTests
    {
        [Test]
        [Category("Portable")]
        public async Task GetFriendsMultipleAsync_Success()
        {
            string content = SampleDataHelper.GetContent("GetFriends-Multiple.json");

            var responseMessage = new Func<HttpResponseMessage>(() =>
            {
                return new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(content) };
            });

            var verification = new Action<HttpRequestMessage, CancellationToken>((message, token) =>
            {
                Assert.AreEqual(HttpMethod.Get, message.Method);
                Assert.AreEqual("https://api.fitbit.com/1/user/-/friends.json", message.RequestUri.AbsoluteUri);
            });

            var fitbitClient = Helper.CreateFitbitClient(responseMessage, verification);

            var response = await fitbitClient.GetFriendsAsync();

            Assert.AreEqual(3, response.Count);
            ValidateMultipleFriends(response);
        }

        [Test]
        [Category("Portable")]
        public async Task GetFriendsSingleAsync_Success()
        {
            string content = SampleDataHelper.GetContent("GetFriends-Single.json");

            var responseMessage = new Func<HttpResponseMessage>(() =>
            {
                return new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(content) };
            });

            var verification = new Action<HttpRequestMessage, CancellationToken>((message, token) =>
            {
                Assert.AreEqual(HttpMethod.Get, message.Method);
                Assert.AreEqual("https://api.fitbit.com/1/user/-/friends.json", message.RequestUri.AbsoluteUri);
            });

            var fitbitClient = Helper.CreateFitbitClient(responseMessage, verification);

            var response = await fitbitClient.GetFriendsAsync();

            ValidateSingleFriend(response);
        }

        [Test]
        [Category("Portable")]
        public void GetFriendsAsync_Failure_Errors()
        {
            var responseMessage = Helper.CreateErrorResponse();
            var verification = new Action<HttpRequestMessage, CancellationToken>((message, token) =>
            {
                Assert.AreEqual(HttpMethod.Get, message.Method);
            });

            var fitbitClient = Helper.CreateFitbitClient(responseMessage, verification);

            Func<Task<List<UserProfile>>> result = () => fitbitClient.GetFriendsAsync();

            result.Should().Throw<FitbitException>();
        }

        [Test]
        [Category("Portable")]
        public void Throws_Exception_With_Empty_String()
        {
            var deserializer = new JsonDotNetSerializer();
            Assert.That(
                new TestDelegate(() => deserializer.GetFriends(string.Empty)),
                Throws.ArgumentNullException
            );
        }

        [Test]
        [Category("Portable")]
        public void Throws_Exception_With_Null_String()
        {
            var deserializer = new JsonDotNetSerializer();

            Assert.That(
                new TestDelegate(() => deserializer.GetFriends(null)),
                Throws.ArgumentNullException
            );
        }

        [Test]
        [Category("Portable")]
        public void Throws_Exception_With_WhiteSpace()
        {
            var deserializer = new JsonDotNetSerializer();
            Assert.That(
                new TestDelegate(() => deserializer.GetFriends("         ")),
                Throws.ArgumentNullException
            );
        }

        [Test]
        [Category("Portable")]
        public void Can_Deserialize_Friends_Multiple()
        {
            string content = SampleDataHelper.GetContent("GetFriends-Multiple.json");
            var deserializer = new JsonDotNetSerializer();

            List<UserProfile> friends = deserializer.GetFriends(content);

            Assert.IsNotNull(friends);
            Assert.IsTrue(friends.Count == 3);

            ValidateMultipleFriends(friends);
        }

        [Test]
        [Category("Portable")]
        public void Can_Deserialize_Friends_Single()
        {
            string content = SampleDataHelper.GetContent("GetFriends-Single.json");
            var deserializer = new JsonDotNetSerializer();

            List<UserProfile> friends = deserializer.GetFriends(content);

            Assert.IsNotNull(friends);
            ValidateSingleFriend(friends);
        }

        [Test]
        [Category("Portable")]
        public void Can_Deserialize_Friends_Single_NullDateOfBirth()
        {
            string content = SampleDataHelper.GetContent("GetFriends-Single-2.json");
            var deserializer = new JsonDotNetSerializer();

            List<UserProfile> friends = deserializer.GetFriends(content);

            Assert.IsNotNull(friends);
            ValidateSingleFriendNullDateOfBirth(friends);
        }

        [Test]
        [Category("Portable")]
        public void Can_Deserialize_Friends_None()
        {
            string content = SampleDataHelper.GetContent("GetFriends-None.json");
            var deserializer = new JsonDotNetSerializer();

            List<UserProfile> friends = deserializer.GetFriends(content);

            Assert.IsNotNull(friends);
            Assert.IsTrue(friends.Count == 0);
        }

        private void ValidateMultipleFriends(List<UserProfile> friends)
        {
            var friend = friends.First();

            Assert.AreEqual("http://www.fitbit.com/images/profile/defaultProfile_100_male.gif", friend.Avatar);
            Assert.AreEqual("http://www.fitbit.com/images/profile/defaultProfile_150_male.gif", friend.Avatar150);
            Assert.AreEqual("GB", friend.Country);
            Assert.AreEqual(DateTime.Parse("1970-01-01"), friend.DateOfBirth);
            Assert.AreEqual("Andy", friend.DisplayName);
            Assert.AreEqual("242XXX", friend.EncodedId);
            Assert.AreEqual("Andy Fullname", friend.FullName);
            Assert.AreEqual(Gender.MALE, friend.Gender);
            Assert.AreEqual(155, friend.Height);
            Assert.AreEqual("en_GB", friend.Locale);
            Assert.AreEqual(DateTime.Parse("2010-12-25"), friend.MemberSince);
            Assert.AreEqual("", friend.Nickname);
            Assert.AreEqual(3600000, friend.OffsetFromUTCMillis);
            Assert.AreEqual("SUNDAY", friend.StartDayOfWeek);
            Assert.AreEqual(0, friend.StrideLengthRunning);
            Assert.AreEqual(0, friend.StrideLengthWalking);
            Assert.AreEqual("Europe/London", friend.Timezone);
            Assert.AreEqual(84.7, friend.Weight);

            friend = friends.FirstOrDefault(x => x.Gender == Gender.FEMALE);

            Assert.AreEqual("http://www.fitbit.com/images/profile/defaultProfile_100_female.gif", friend.Avatar);
            Assert.AreEqual("http://www.fitbit.com/images/profile/defaultProfile_150_female.gif", friend.Avatar150);
            Assert.AreEqual("GB", friend.Country);
            Assert.AreEqual(DateTime.Parse("1984-09-07"), friend.DateOfBirth);
            Assert.AreEqual("Laura", friend.DisplayName);
            Assert.AreEqual("24WXXX", friend.EncodedId);
            Assert.AreEqual("", friend.FullName);
            Assert.AreEqual(Gender.FEMALE, friend.Gender);
            Assert.AreEqual(165, friend.Height);
            Assert.AreEqual("en_GB", friend.Locale);
            Assert.AreEqual(DateTime.Parse("2013-02-01"), friend.MemberSince);
            Assert.AreEqual("", friend.Nickname);
            Assert.AreEqual(3600000, friend.OffsetFromUTCMillis);
            Assert.AreEqual("SUNDAY", friend.StartDayOfWeek);
            Assert.AreEqual(0, friend.StrideLengthRunning);
            Assert.AreEqual(0, friend.StrideLengthWalking);
            Assert.AreEqual("Europe/London", friend.Timezone);
            Assert.AreEqual(0, friend.Weight);

            friend = friends.Last();

            Assert.AreEqual("http://www.fitbit.com/images/profile/defaultProfile_100_male.gif", friend.Avatar);
            Assert.AreEqual("http://www.fitbit.com/images/profile/defaultProfile_150_male.gif", friend.Avatar150);
            Assert.AreEqual("GB", friend.Country);
            Assert.AreEqual(DateTime.Parse("1978-09-24"), friend.DateOfBirth);
            Assert.AreEqual("Michael", friend.DisplayName);
            Assert.AreEqual("24NXXX", friend.EncodedId);
            Assert.AreEqual("", friend.FullName);
            Assert.AreEqual(Gender.MALE, friend.Gender);
            Assert.AreEqual(190.5, friend.Height);
            Assert.AreEqual("en_GB", friend.Locale);
            Assert.AreEqual(DateTime.Parse("2013-01-01"), friend.MemberSince);
            Assert.AreEqual("", friend.Nickname);
            Assert.AreEqual(3600000, friend.OffsetFromUTCMillis);
            Assert.AreEqual("SUNDAY", friend.StartDayOfWeek);
            Assert.AreEqual(0, friend.StrideLengthRunning);
            Assert.AreEqual(0, friend.StrideLengthWalking);
            Assert.AreEqual("Europe/London", friend.Timezone);
            Assert.AreEqual(0, friend.Weight);
        }

        private void ValidateSingleFriend(List<UserProfile> friends)
        {
            Assert.IsTrue(friends.Count == 1);

            var friend = friends.First();
            Assert.AreEqual("http://www.fitbit.com/images/profile/defaultProfile_100_female.gif", friend.Avatar);
            Assert.AreEqual("http://www.fitbit.com/images/profile/defaultProfile_150_female.gif", friend.Avatar150);
            Assert.AreEqual("GB", friend.Country);
            Assert.AreEqual(DateTime.Parse("1984-09-07"), friend.DateOfBirth);
            Assert.AreEqual("Laura", friend.DisplayName);
            Assert.AreEqual("24WXXX", friend.EncodedId);
            Assert.AreEqual("", friend.FullName);
            Assert.AreEqual(Gender.FEMALE, friend.Gender);
            Assert.AreEqual(165, friend.Height);
            Assert.AreEqual("en_GB", friend.Locale);
            Assert.AreEqual(DateTime.Parse("2013-02-01"), friend.MemberSince);
            Assert.AreEqual("", friend.Nickname);
            Assert.AreEqual(3600000, friend.OffsetFromUTCMillis);
            Assert.AreEqual("SUNDAY", friend.StartDayOfWeek);
            Assert.AreEqual(0, friend.StrideLengthRunning);
            Assert.AreEqual(0, friend.StrideLengthWalking);
            Assert.AreEqual("Europe/London", friend.Timezone);
            Assert.AreEqual(0, friend.Weight);
        }

        private void ValidateSingleFriendNullDateOfBirth(List<UserProfile> friends)
        {
            Assert.IsTrue(friends.Count == 1);

            var friend = friends.First();
            Assert.AreEqual("http://www.fitbit.com/images/profile/defaultProfile_100_female.gif", friend.Avatar);
            Assert.AreEqual("http://www.fitbit.com/images/profile/defaultProfile_150_female.gif", friend.Avatar150);
            Assert.AreEqual("GB", friend.Country);
            Assert.AreEqual(DateTime.MinValue, friend.DateOfBirth);
            Assert.AreEqual("Laura", friend.DisplayName);
            Assert.AreEqual("24WXXX", friend.EncodedId);
            Assert.AreEqual("", friend.FullName);
            Assert.AreEqual(Gender.FEMALE, friend.Gender);
            Assert.AreEqual(165, friend.Height);
            Assert.AreEqual("en_GB", friend.Locale);
            Assert.AreEqual(DateTime.Parse("2013-02-01"), friend.MemberSince);
            Assert.AreEqual("", friend.Nickname);
            Assert.AreEqual(3600000, friend.OffsetFromUTCMillis);
            Assert.AreEqual("SUNDAY", friend.StartDayOfWeek);
            Assert.AreEqual(0, friend.StrideLengthRunning);
            Assert.AreEqual(0, friend.StrideLengthWalking);
            Assert.AreEqual("Europe/London", friend.Timezone);
            Assert.AreEqual(0, friend.Weight);
        }
    }
}


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { TablesRoutingModule } from './tables-routing.module';
import { TablesComponent } from './tables.component';
import { PageHeaderModule } from './../../shared';

@NgModule({
    imports: [CommonModule, TablesRoutingModule, PageHeaderModule],
    declarations: [TablesComponent]
})
export class TablesModule {}


text:
def chunks(data, size=30):
    """ Split iterable thing into n-sized chunks """
    for i in range(0, len(data), size):
        yield data[i : i + size]


text:
from the cloud-aws directory run the following make command:

```
make generate-zone-vms
```

##Currently supported regions: X means not supported:

- ap-south-1 - Asia Pacific (Mumbai) X
- ap-northeast-2 - Asia Pacific (Seoul)
- ap-southeast-1 - Asia Pacific (Singapore)
- ap-southeast-2 - Asia Pacific (Sydney)
- ap-northeast-1 - Asia Pacific (Tokyo)
- ca-central-1 - Canada (Central) X
- eu-central-1 - EU (Frankfurt)
- eu-west-1 - EU (Ireland)
- eu-west-2 - EU (London) X
- sa-east-1 - South America (Sao Paulo)
- us-east-1 - US East (N. Virginia)
- us-east-2 - US East (Ohio) X
- us-west-1 - US West (N. California)
- us-west-2 - US West (Oregon)


text:
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class ecoenergy_theme {
    function __construct(){

    }

    static function sc_line(){
        $html = '
';
        $html.=     '
';
        $html.=         '
';
        $html.=             '

';
        $html.= '

';
        return $html;

    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="97">
  <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
    <logicalFolder name="HeaderFiles"
                   displayName="Header Files"
                   projectFiles="true">
      <logicalFolder name="src" displayName="src" projectFiles="true">
        <logicalFolder name="f6" displayName="Backend" projectFiles="true">
          <logicalFolder name="f4" displayName="Catkin" projectFiles="true">
          </logicalFolder>
          <logicalFolder name="f2" displayName="CMake" projectFiles="true">
          </logicalFolder>
          <logicalFolder name="f1" displayName="Make" projectFiles="true">
          </logicalFolder>
          <logicalFolder name="f3" displayName="RosBuild" projectFiles="true">
          </logicalFolder>
          <logicalFolder name="f5" displayName="Scan" projectFiles="true">
            <itemPath>src/PkgScanner.h</itemPath>
          </logicalFolder>
        </logicalFolder>
        <logicalFolder name="f5" displayName="Frontend" projectFiles="true">
          <logicalFolder name="f1" displayName="EditorUi" projectFiles="true">
            <logicalFolder name="f1" displayName="PrettyPrint" projectFiles="true">
              <itemPath>src/CodeFoldingArea.h</itemPath>
              <itemPath>src/FileGui.h</itemPath>
              <itemPath>src/Highlighter.h</itemPath>
              <itemPath>src/LineNumberArea.h</itemPath>
              <itemPath>src/MirrorChar.h</itemPath>
            </logicalFolder>
            <itemPath>src/EditorCentralWid.h</itemPath>
            <itemPath>src/EditorGui.h</itemPath>
            <itemPath>src/SouthGui.h</itemPath>
            <itemPath>src/WestTab.h</itemPath>
          </logicalFolder>
          <logicalFolder name="f2" displayName="PagesUi" projectFiles="true">
            <itemPath>src/AdvOptPage_1.h</itemPath>
            <itemPath>src/AdvOptPage_2.h</itemPath>
            <itemPath>src/AdvOptPage_3.h</itemPath>
            <itemPath>src/AdvOptPage_4.h</itemPath>
            <itemPath>src/AdvOptPage_5.h</itemPath>
            <itemPath>src/AdvOptionsGui.h</itemPath>
            <itemPath>src/ConvOptPage.h</itemPath>
            <itemPath>src/ConvTypePage.h</itemPath>
            <itemPath>src/CustomMsgsPage.h</itemPath>
            <itemPath>src/CustomPkgsGui.h</itemPath>
            <itemPath>src/FileListingPage.h</itemPath>
            <itemPath>src/HelpGui.h</itemPath>
            <itemPath>src/InitialSetupPage.h</itemPath>
            <itemPath>src/OutputPage.h</itemPath>
            <itemPath>src/QCellWidget.h</itemPath>
            <itemPath>src/ReconfigCentralWid.h</itemPath>
            <itemPath>src/ReconfigDashboard.h</itemPath>
            <itemPath>src/ReconfigGui.h</itemPath>
            <itemPath>src/ReconfigToolBar.h</itemPath>
            <itemPath>src/ResultsPage.h</itemPath>
            <itemPath>src/SubPubPage.h</itemPath>
            <itemPath>src/SummaryPage.h</itemPath>
          </logicalFolder>
        </logicalFolder>
        <itemPath>src/RFile.h</itemPath>
        <itemPath>src/RideEnv.h</itemPath>
        <itemPath>src/RosEnv.h</itemPath>
        <itemPath>src/Saver.h</itemPath>
        <itemPath>src/UnixConsoleText.h</itemPath>
        <itemPath>src/WindowsConsoleText.h</itemPath>
      </logicalFolder>
    </logicalFolder>
    <logicalFolder name="ResourceFiles"
                   displayName="Resource Files"
                   projectFiles="true">
    </logicalFolder>
    <logicalFolder name="SourceFiles"
                   displayName="Source Files"
                   projectFiles="true">
      <logicalFolder name="src" displayName="src" projectFiles="true">
        <logicalFolder name="f6" displayName="Backend" projectFiles="true">
          <logicalFolder name="f4" displayName="Catkin" projectFiles="true">
          </logicalFolder>
          <logicalFolder name="f2" displayName="CMake" projectFiles="true">
          </logicalFolder>
          <logicalFolder name="f1" displayName="Make" projectFiles="true">
          </logicalFolder>
          <logicalFolder name="f3" displayName="RosBuild" projectFiles="true">
          </logicalFolder>
          <logicalFolder name="f5" displayName="Scan" projectFiles="true">
            <itemPath>src/PkgScanner.cpp</itemPath>
          </logicalFolder>
        </logicalFolder>
        <logicalFolder name="f5" displayName="Frontend" projectFiles="true">
          <logicalFolder name="f1" displayName="EditorUi" projectFiles="true">
            <logicalFolder name="f1" displayName="PrettyPrint" projectFiles="true">
              <itemPath>src/CodeFoldingArea.cpp</itemPath>
              <itemPath>src/FileGui.cpp</itemPath>
              <itemPath>src/Highlighter.cpp</itemPath>
              <itemPath>src/LineNumberArea.cpp</itemPath>
              <itemPath>src/MirrorChar.cpp</itemPath>
            </logicalFolder>
            <itemPath>src/EditorCentralWid.cpp</itemPath>
            <itemPath>src/EditorGui.cpp</itemPath>
            <itemPath>src/SouthGui.cpp</itemPath>
            <itemPath>src/WestTab.cpp</itemPath>
          </logicalFolder>
          <logicalFolder name="f2" displayName="PagesUi" projectFiles="true">
            <itemPath>src/AdvOptPage_1.cpp</itemPath>
            <itemPath>src/AdvOptPage_2.cpp</itemPath>
            <itemPath>src/AdvOptPage_3.cpp</itemPath>
            <itemPath>src/AdvOptPage_4.cpp</itemPath>
            <itemPath>src/AdvOptPage_5.cpp</itemPath>
            <itemPath>src/AdvOptionsGui.cpp</itemPath>
            <itemPath>src/ConvOptPage.cpp</itemPath>
            <itemPath>src/ConvTypePage.cpp</itemPath>
            <itemPath>src/CustomMsgsPage.cpp</itemPath>
            <itemPath>src/CustomPkgsGui.cpp</itemPath>
            <itemPath>src/FileListingPage.cpp</itemPath>
            <itemPath>src/HelpGui.cpp</itemPath>
            <itemPath>src/InitialSetupPage.cpp</itemPath>
            <itemPath>src/OutputPage.cpp</itemPath>
            <itemPath>src/QCellWidget.cpp</itemPath>
            <itemPath>src/ReconfigCentralWid.cpp</itemPath>
            <itemPath>src/ReconfigDashboard.cpp</itemPath>
            <itemPath>src/ReconfigGui.cpp</itemPath>
            <itemPath>src/ReconfigToolBar.cpp</itemPath>
            <itemPath>src/ResultsPage.cpp</itemPath>
            <itemPath>src/SubPubPage.cpp</itemPath>
            <itemPath>src/SummaryPage.cpp</itemPath>
          </logicalFolder>
        </logicalFolder>
        <itemPath>src/RFile.cpp</itemPath>
        <itemPath>src/RideEnv.cpp</itemPath>
        <itemPath>src/RosEnv.cpp</itemPath>
        <itemPath>src/Saver.cpp</itemPath>
        <itemPath>src/UnitTests.cpp</itemPath>
        <itemPath>src/UnixConsoleText.cpp</itemPath>
        <itemPath>src/WindowsConsoleText.cpp</itemPath>
        <itemPath>src/main.cpp</itemPath>
      </logicalFolder>
    </logicalFolder>
    <logicalFolder name="TestFiles"
                   displayName="Test Files"
                   projectFiles="false"
                   kind="TEST_LOGICAL_FOLDER">
    </logicalFolder>
    <logicalFolder name="ExternalFiles"
                   displayName="Important Files"
                   projectFiles="false"
                   kind="IMPORTANT_FILES_FOLDER">
      <itemPath>Makefile</itemPath>
    </logicalFolder>
  </logicalFolder>
  <sourceRootList>
    <Elem>src</Elem>
  </sourceRootList>
  <projectmakefile>Makefile</projectmakefile>
  <confs>
    <conf name="Debug" type="4">
      <toolsSet>
        <compilerSet>default</compilerSet>
        <dependencyChecking>true</dependencyChecking>
        <rebuildPropChanged>false</rebuildPropChanged>
      </toolsSet>
      <qt>
        <modules>core gui widgets</modules>
        <mocDir>src/moc</mocDir>
      </qt>
      <compileType>
      </compileType>
      <item path="src/AdvOptPage_1.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/AdvOptPage_1.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/AdvOptPage_2.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/AdvOptPage_2.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/AdvOptPage_3.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/AdvOptPage_3.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/AdvOptPage_4.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/AdvOptPage_4.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/AdvOptPage_5.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/AdvOptPage_5.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/AdvOptionsGui.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/AdvOptionsGui.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/CodeFoldingArea.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/CodeFoldingArea.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/ConvOptPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/ConvOptPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/ConvTypePage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/ConvTypePage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/CustomMsgsPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/CustomMsgsPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/CustomPkgsGui.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/CustomPkgsGui.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/EditorCentralWid.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/EditorCentralWid.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/EditorGui.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/EditorGui.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/FileGui.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/FileGui.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/FileListingPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/FileListingPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/HelpGui.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/HelpGui.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/Highlighter.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/Highlighter.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/InitialSetupPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/InitialSetupPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/LineNumberArea.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/LineNumberArea.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/MirrorChar.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/MirrorChar.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/OutputPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/OutputPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/PkgScanner.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/PkgScanner.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/QCellWidget.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/QCellWidget.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/RFile.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/RFile.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/ReconfigCentralWid.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/ReconfigCentralWid.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/ReconfigDashboard.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/ReconfigDashboard.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/ReconfigGui.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/ReconfigGui.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/ReconfigToolBar.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/ReconfigToolBar.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/ResultsPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/ResultsPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/RideEnv.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/RideEnv.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/RosEnv.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/RosEnv.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/Saver.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/Saver.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/SouthGui.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/SouthGui.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/SubPubPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/SubPubPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/SummaryPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/SummaryPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/UnitTests.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/UnixConsoleText.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/UnixConsoleText.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/WestTab.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/WestTab.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/WindowsConsoleText.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/WindowsConsoleText.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/main.cpp" ex="false" tool="1" flavor2="0">
      </item>
    </conf>
    <conf name="Release" type="4">
      <toolsSet>
        <compilerSet>default</compilerSet>
        <dependencyChecking>true</dependencyChecking>
        <rebuildPropChanged>false</rebuildPropChanged>
      </toolsSet>
      <qt>
        <buildMode>1</buildMode>
        <modules>core gui widgets</modules>
      </qt>
      <compileType>
        <cTool>
          <developmentMode>5</developmentMode>
        </cTool>
        <ccTool>
          <developmentMode>5</developmentMode>
        </ccTool>
        <fortranCompilerTool>
          <developmentMode>5</developmentMode>
        </fortranCompilerTool>
        <asmTool>
          <developmentMode>5</developmentMode>
        </asmTool>
      </compileType>
      <item path="src/AdvOptPage_1.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/AdvOptPage_1.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/AdvOptPage_2.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/AdvOptPage_2.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/AdvOptPage_3.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/AdvOptPage_3.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/AdvOptPage_4.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/AdvOptPage_4.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/AdvOptPage_5.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/AdvOptPage_5.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/AdvOptionsGui.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/AdvOptionsGui.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/CodeFoldingArea.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/CodeFoldingArea.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/ConvOptPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/ConvOptPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/ConvTypePage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/ConvTypePage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/CustomMsgsPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/CustomMsgsPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/CustomPkgsGui.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/CustomPkgsGui.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/EditorCentralWid.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/EditorCentralWid.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/EditorGui.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/EditorGui.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/FileGui.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/FileGui.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/FileListingPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/FileListingPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/HelpGui.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/HelpGui.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/Highlighter.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/Highlighter.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/InitialSetupPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/InitialSetupPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/LineNumberArea.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/LineNumberArea.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/MirrorChar.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/MirrorChar.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/OutputPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/OutputPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/PkgScanner.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/PkgScanner.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/QCellWidget.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/QCellWidget.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/RFile.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/RFile.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/ReconfigCentralWid.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/ReconfigCentralWid.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/ReconfigDashboard.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/ReconfigDashboard.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/ReconfigGui.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/ReconfigGui.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/ReconfigToolBar.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/ReconfigToolBar.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/ResultsPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/ResultsPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/RideEnv.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/RideEnv.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/RosEnv.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/RosEnv.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/Saver.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/Saver.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/SouthGui.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/SouthGui.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/SubPubPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/SubPubPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/SummaryPage.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/SummaryPage.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/UnitTests.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/UnixConsoleText.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/UnixConsoleText.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/WestTab.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/WestTab.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/WindowsConsoleText.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="src/WindowsConsoleText.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="src/main.cpp" ex="false" tool="1" flavor2="0">
      </item>
    </conf>
  </confs>
</configurationDescriptor>


text:
package esilegacy

/*
No image server for this datasource */
type GetAlliancesAllianceIdIconsNotFound struct {
	/*
	 error message */
	Error_ string `json:"error,omitempty"`
}


text:
package br.com.digitaldreams.popularmovies2.utils;

/**
 * Created by josecostamartins on 7/24/16.
 */
public abstract class Definitions {

}


text:
initialize_dataset "$BASE_URL_WRITABLE" "../../dataset.trig" "$ENDPOINT_URL_WRITABLE"

# check that missing ldt:update gives 501

curl -w "%{http_code}\n" -f -s \
  -X DELETE \
  "${BASE_URL_WRITABLE}missing-update" \
| grep -q "${STATUS_NOT_IMPLEMENTED}"


text:
id: 71
title: Breviario I
date: 2007-06-17T20:17:00+00:00
author: Alvar
layout: post
guid: http://www.acercadelaeducacion.com.ar/?p=71
disqus: true
subclass: 'post'
cover: false
navigation: True
logo: 'assets/images/lain.gif'
cover: 'assets/images/cover1.jpg'
permalink: /2007/06/breviario-i/
blogger_blog:
  - senderosilencioso.blogspot.com
  - senderosilencioso.blogspot.com
blogger_permalink:
  - /2007/06/la-ltima-semana-mientras-mis-compaeros.html
  - /2007/06/la-ltima-semana-mientras-mis-compaeros.html
aktt_tweeted:
  - "1"
podPressPostSpecific:
  - 'a:6:{s:15:"itunes:subtitle";s:15:"##PostExcerpt##";s:14:"itunes:summary";s:15:"##PostExcerpt##";s:15:"itunes:keywords";s:17:"##WordPressCats##";s:13:"itunes:author";s:10:"##Global##";s:15:"itunes:explicit";s:7:"Default";s:12:"itunes:block";s:7:"Default";}'
bitly_url:
  - http://bit.ly/1YF09JZ
bitly_hash:
  - 1YF09JZ
bitly_long_url:
  - http://www.acercadelaeducacion.com.ar/2007/06/breviario-i/
categories:
  - Alvar
tags:
  - tareas
---
La última semana mientras mis compañeros recorrían las colinas de youtube. Mi trabajo me obligo a ausentarme de las visitas guiadas, pero por las noches, en mi camarote recorría los comentarios y  escuchaba las canciones alegres que emitían los pasajeros de este mágico tren. Las obligaciones no terminaron pero los viajes que me alejaron de las colinas visitadas sí.
Entonces, en esta tarde de domingo, les dejo un breviario de mi selección. gustos amores y distracciones para la tarde del día del padre.
<object height="355" width="425">
<param name="movie" value="http://www.youtube.com/v/jzMUQQ0_PnI&rel=1&border=0"></param>
<param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/jzMUQQ0_PnI&rel=1&border=0" type="application/x-shockwave-flash" wmode="transparent" height="355" width="425"></embed></object></p>


text:
leveldb_store
=============

[![Build Status](https://travis-ci.org/eddyxu/leveldb_store.png?branch=master)](https://travis-ci.org/eddyxu/leveldb_store)

C++ Wrapper for LevelDB and provide STL-style iterator for easy access.

Dependancies
 * leveldb
 * snappy
 * google glog
 * boost filesystem and google gmock for testing.


text:
SlideSelection is inspired by [Daniel Hooper's Video](http://www.youtube.com/watch?v=RGQTaHGQ04Q "Hooper Selection (iPad Keyboard Prototype)") on how to improve editing text on the iPad by using gestures over the keyboard to manipulate the cursor and text selection.

SlideSelection allows you to move the cursor left, right, up or down using a one finger drag. A two-finger drag will select text instead.

### How to use in your application

**Subclass UIApplication**

-Create a class which is a subclass of UIApplication. This can be as simple as changing your AppDelegate's superclass from UIResponder to UIApplication.

-#import "CDKeyboardSelectionManager.h"

-Override the sendEvent: method.

		- (void)sendEvent:(UIEvent *)event
		{
				[super sendEvent:event];

		    [[CDKeyboardSelectionManager sharedManager] handleEvent:event];
		}

**Update main.m if needed**

-In main.m, make sure the third argument of UIApplicationMain is the name of the subclass.

		return UIApplicationMain(argc, argv, NSStringFromClass([AppDelegate class]), nil);

**Register your text inputs**

-For any text input (UITextView, UITextField etc.) that you want to use Hooper Selection, you must register it with the CDKeyboardSelectionManager.

		[[CDKeyboardSelectionManager sharedManager] registerForKeyboardSelection:textView];

-If you no longer want that text input to use Hooper Selection, you can unregister it.

		[[CDKeyboardSelectionManager sharedManager] unregisterForKeyboardSelection:textView];

**Requires iOS 5**


text:
namespace Microsoft.Azure.Management.SecurityInsights.Models
{
    using Newtonsoft.Json;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;

    public partial class InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem
    {
        /// <summary>
        /// Initializes a new instance of the
        /// InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem class.
        /// </summary>
        public InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the
        /// InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem class.
        /// </summary>
        /// <param name="filter">Insight column header.</param>
        /// <param name="summarize">Insight column header.</param>
        /// <param name="project">Insight column header.</param>
        /// <param name="linkColumnsDefinitions">Insight column header.</param>
        public InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem(string filter = default(string), string summarize = default(string), string project = default(string), IList<InsightQueryItemPropertiesTableQueryQueriesDefinitionsItemLinkColumnsDefinitionsItem> linkColumnsDefinitions = default(IList<InsightQueryItemPropertiesTableQueryQueriesDefinitionsItemLinkColumnsDefinitionsItem>))
        {
            Filter = filter;
            Summarize = summarize;
            Project = project;
            LinkColumnsDefinitions = linkColumnsDefinitions;
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets or sets insight column header.
        /// </summary>
        [JsonProperty(PropertyName = "filter")]
        public string Filter { get; set; }

        /// <summary>
        /// Gets or sets insight column header.
        /// </summary>
        [JsonProperty(PropertyName = "summarize")]
        public string Summarize { get; set; }

        /// <summary>
        /// Gets or sets insight column header.
        /// </summary>
        [JsonProperty(PropertyName = "project")]
        public string Project { get; set; }

        /// <summary>
        /// Gets or sets insight column header.
        /// </summary>
        [JsonProperty(PropertyName = "linkColumnsDefinitions")]
        public IList<InsightQueryItemPropertiesTableQueryQueriesDefinitionsItemLinkColumnsDefinitionsItem> LinkColumnsDefinitions { get; set; }

    }
}


text:
@import url(../../node_modules/bootstrap/dist/css/bootstrap.css);
@import url(../../node_modules/bootstrap/dist/css/bootstrap-theme.css);
body {
  background-color: #999; }

#wrapper {
  width: 100%; }

#page-wrapper {
  padding: 0 15px;
  min-height: 568px;
  background-color: white; }

@media (min-width: 768px) {
  #page-wrapper {
    position: inherit;
    margin: 0 0 0 250px;
    padding: 0 30px;
    border-left: 1px solid #888888; } }


text:
var http = require( 'http' );

http.createServer(function( req, res ) {
  var html = '<!doctype html>' +
      '<title>Hello world</title>' +
      '
Hello, world!
';

  res.writeHead( 200, {
    // set the type of content we're returning
    'Content-Type': 'text/html',
    // set the length of our content
    'Content-Length': html.length
  });

  // end the response, sending it and returning our HTML
  res.end( html );
}).listen( 8000, '127.0.0.1' );


text:
using System;
using Orchard.ContentManagement;
using ceenq.com.Core.ContentManagement;
using Orchard.ContentManagement.Records;

namespace ceenq.org.Resource.Models
{
    public sealed class SermonPart : ContentPart<SermonPartRecord>
    {
    }

    public class SermonPartRecord : ContentPartRecord
    {

    }
}


text:
package org.slf4j;

/**
 * Utility for Maven to access Slf4j internals through package access.
 * Use with precaution, since this is not normally intended for production use.
 */
public class MavenSlf4jFriend
{
    /**
     * Reset Slf4j internal state.
     */
    public static void reset()
    {
        LoggerFactory.reset();
    }
}


text:
package gregory.abc;
import gregory.abc.utility.GabcFilePaths;
import java.io.File;

/**
 *
GabcStatic

 * A class of static fields and methods.
 *

 * This class is for the static-initialization fields and methods that are relevant to the mod main class and across the
 * other mod-management classes. For the most part, they are the {@link String} fields, {@link File} paths, et cetera,
 * that are of use to one or more classes in the mod.
 * @author Gregory
 * @see #modAbbr modAbbr
 * @see #modDeps modDeps
 * @see #modName modName
 * @see #modVer1 modVer1
 * @see #modVer2 modVer2
 * @see #soundpacksPath soundpacksPath
 * @see #MaidSoundsStatic() MaidSoundsStatic()
 * @see #initialize() initialize()
 */
public class GabcStatic {
  // Notice: the public static String fields MUST be declared with the values in the same lines, not static initialized!

  /**
   * The static "modId" descriptor.
   *

   * Used throughout a mod. Should be the same as found in the {@code mcmod.info} file.
   */
  public static final String modAbbr = "gabc"; // NOI18N
  /**
   * Your mod dependencies.
   *

   * Should be the same as found in the {@code mcmod.info} file.
   */
  public static final String modDeps = "befor-all"; // NOI18N
  /**
   * Your "mod name" title.
   *

   * This is the more proper, full title, Should be the same as found in the {@code mcmod.info} file.
   */
  public static final String modName = "Gregory-AbacusCommonsLib"; // NOI18N
  /**
   * A static name for file paths.
   */
  public static final String modPath = "Abacus"; // NOI18N
  /**
   * The version of Minecraft expected. Should be the same as found in the {@code mcmod.info} file.
   */
  public static final String modVer1 = "1.7.10"; // NOI18N
  /**
   * The version of this mod. Should be the same as found in the {@code mcmod.info} file.
   */
  public static final String modVer2 = "0.0.1a"; // NOI18N

  /**
   * A private constructor.
   */
  private GabcStatic() {
  }

  protected static void initialize() {
    if(!GabcFilePaths.mcMods.exists() || !GabcFilePaths.mcMods.isDirectory() || GabcFilePaths.mcMods.mkdir()) {
      //TODO: Warn that the mods directory cannot be made....
    }
    // Additional initialization may occur here....
  }
}


text:
package com.fkeglevich.rawdumper.controller.adapter;

import android.view.View;
import android.view.ViewGroup;

import com.fkeglevich.rawdumper.R;
import com.fkeglevich.rawdumper.camera.data.Displayable;
import com.fkeglevich.rawdumper.controller.animation.ButtonDisabledStateController;
import com.fkeglevich.rawdumper.controller.feature.Dismissible;
import com.fkeglevich.rawdumper.controller.feature.DisplayableFeatureUi;
import com.fkeglevich.rawdumper.controller.feature.ExternalNotificationController;
import com.fkeglevich.rawdumper.controller.feature.OnClickNotifier;
import com.fkeglevich.rawdumper.ui.listener.ItemSelectedListener;
import com.transitionseverywhere.Fade;
import com.transitionseverywhere.TransitionManager;

import java.util.List;

import androidx.annotation.DrawableRes;
import androidx.core.content.ContextCompat;
import androidx.core.view.ViewCompat;

/**
 * TODO: Add class header
 * <p>
 * Created by Flávio Keglevich on 23/10/17.
 */

public class ButtonController implements DisplayableFeatureUi, Dismissible
{
    private final View button;
    private final DisplayableFeatureUi adapter;
    private final View chooser;
    private final ExternalNotificationController notificationController;
    private final OnClickNotifier clickNotifier;
    private final Fade fadeTransition;
    private final ButtonDisabledStateController buttonDisabledStateController;

    public static void changeButtonBackground(View button, @DrawableRes int id)
    {
        ViewCompat.setBackground(button, ContextCompat.getDrawable(button.getContext(), id));
        button.invalidate();
    }

    public ButtonController(View button, DisplayableFeatureUi adapter, View chooser,
                            ExternalNotificationController notificationController,
                            OnClickNotifier clickNotifier)
    {
        this.button = button;
        button.setOnClickListener(v -> toggleChooser());

        this.adapter = adapter;
        this.chooser = chooser;
        this.notificationController = notificationController;
        this.clickNotifier = clickNotifier;
        this.fadeTransition = new Fade();
        fadeTransition.setDuration(300L);

        this.buttonDisabledStateController = new ButtonDisabledStateController(button, false);
        hideChooser();
    }

    @Override
    public void setItems(List<String> items)
    {
        adapter.setItems(items);
    }

    @Override
    public void setSelectedIndex(int index)
    {
        adapter.setSelectedIndex(index);
    }

    @Override
    public void displayExternalChangeNotification(Displayable newValue)
    {
        adapter.displayExternalChangeNotification(newValue);
        notificationController.showNotification(newValue);
    }

    @Override
    public void setListener(ItemSelectedListener listener)
    {
        adapter.setListener(listener);
    }

    @Override
    public void enable()
    {
        adapter.enable();
        buttonDisabledStateController.enableAnimated();
    }

    @Override
    public void disable()
    {
        adapter.disable();
        buttonDisabledStateController.disableAnimated();
        hideChooser();
    }

    @Override
    public void dismiss()
    {
        hideChooser();
    }

    private void hideChooser()
    {
        TransitionManager.beginDelayedTransition((ViewGroup) chooser.getRootView(), fadeTransition);
        chooser.setVisibility(View.INVISIBLE);
        changeButtonBackground(button, R.drawable.round_button_default);
    }

    private void showChooser()
    {
        TransitionManager.beginDelayedTransition((ViewGroup) chooser.getRootView(), fadeTransition);
        chooser.setVisibility(View.VISIBLE);
        changeButtonBackground(button, R.drawable.round_button_toggled);
    }

    private void toggleChooser()
    {
        if (chooser.getVisibility() == View.VISIBLE)
            hideChooser();
        else
        {
            clickNotifier.notifyOnClick();
            showChooser();
        }
    }
}


text: require File.dirname(__FILE__) + '/../lib/keima.rb'