text:
feature 'Course show page' do

  it 'should have the name of the course in a breadcrumb' do
    course = create(:course)
    visit course_path(course)

    within '.breadcrumb' do
      expect(page).to have_content "Course: #{course.title}"
    end
  end

  it 'should have a bookmarklet notice' do
    course = create(:course)
    visit course_path(course)

    within '.alert' do
      expect(page).to have_content 'bookmarklet'
    end
  end

  context 'when NO skills for a course exist' do

    before(:each) do
      course = create(:course, skills: [])
      visit course_path(course)
    end

    it 'should not show an empty dag' do
      expect(page).not_to have_css('#dag')
    end

    it 'should show a message saying no skills' do
      expect(page).to have_content('No skills have been created yet.')
    end

  end

  context 'when skills for a course exist' do

    before(:each) do
      @course = create( :course, skills: create_list(:skill, 3) )
      visit course_path(@course)
    end

    describe 'the dag', js: true do

      it 'should show nodes for each skill' do
        within '#dag' do
          @course.skills.each do |skill|
            expect(page).to have_css("circle[data-original-title='#{skill.title}']")
          end
        end
      end

    end

    it 'should list each skill in a table' do
      within 'table#skills_table' do
        @course.skills.each do |skill|
          expect(page).to have_content(skill.title)
        end
      end
    end

    context 'in the table skill row' do

      before(:each) do
        signin
        @user = User.first
        @user.update_columns(username: '-!student')
        @user_skills  = create_list(:skill, 3, creator: @user, course: @course)
        visit course_path(@course)
      end

      context 'when the user is the creator of the skill' do

        context 'there are NO project completions for the skill' do

          it 'should show an edit button for the skill' do
            @user_skills.each do |skill|
              within "#skill_#{skill.id}" do
                expect(page).to have_link( 'Edit', edit_skill_path(skill) )
              end
            end
          end

          it 'should show a delete button for the skill' do
            @user_skills.each do |skill|
              within "#skill_#{skill.id}" do
                expect(page).to have_link( 'Delete', skill_path(skill) )
              end
            end
          end

        end

        context 'there are project completions for the skill' do

          before(:each) do
            @completed_skill = @user_skills.first
            create :project_completion, project: create(:project, :with_criteria, skill: @completed_skill)
            visit course_path(@course)
          end

          it 'should NOT show an edit button for the skill' do
            within "#skill_#{@completed_skill.id}" do
              expect(page).not_to have_link( 'Edit', edit_skill_path(@completed_skill) )
            end
          end

          it 'should NOT show a delete button for the skill' do
            within "#skill_#{@completed_skill.id}" do
              expect(page).not_to have_link( 'Delete', skill_path(@completed_skill) )
            end
          end

        end

      end

      context 'when the user is NOT the creator of the skill' do

        before(:each) do
          @other_skills = create_list :skill, 3, course: @course
          visit course_path(@course)
        end

        it 'should NOT show an edit button for the skill' do
          @other_skills.each do |skill|
            within "#skill_#{skill.id}" do
              expect(page).not_to have_link( 'Edit', edit_skill_path(skill) )
            end
          end
        end

        it 'should NOT show a delete button for the skill' do
          @other_skills.each do |skill|
            within "#skill_#{skill.id}" do
              expect(page).not_to have_link( 'Delete', skill_path(skill) )
            end
          end
        end

      end

    end

  end

end


text:
package model;

import java.awt.Color;
import java.io.Serializable;

/**
 * Extends AbstractTile, represents a tile that cannot be covered by a piece during gameplay.
 * @author hejohnson
 *
 */

public class EmptyTile extends AbstractTile implements Serializable{
	private static final long serialVersionUID = -8744970312057997685L;

	/**
	 * Create EmptyTile at a given location (row column coordinates).
	 * @param row - int
	 * @param col - int
	 */
	public EmptyTile(int row, int col) {
		super(row, col);
		this.color = Color.LIGHT_GRAY;
		this.defaultColor = color;
		this.tileType = "empty";
	}
}

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System;
using System.Collections.Immutable;
using System.Linq;
using System.Reflection.PortableExecutable;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.CSharp.DynamicAnalysis.UnitTests
{
    public class DynamicAnalysisResourceTests : CSharpTestBase
    {
        const string InstrumentationHelperSource = @"
namespace Microsoft.CodeAnalysis.Runtime
{
    public static class Instrumentation
    {
        public static bool[] CreatePayload(System.Guid mvid, int methodToken, int fileIndex, ref bool[] payload, int payloadLength)
        {
            return payload;
        }

        public static bool[] CreatePayload(System.Guid mvid, int methodToken, int[] fileIndices, ref bool[] payload, int payloadLength)
        {
            return payload;
        }

        public static void FlushPayload()
        {
        }
    }
}
";

        const string ExampleSource = @"
using System;

public class C
{
    public static void Main()
    {
        Console.WriteLine(123);
        Console.WriteLine(123);
    }

    public static int Fred => 3;

    public static int Barney(int x) => x;

    public static int Wilma
    {
        get { return 12; }
        set { }
    }

    public static int Betty { get; }

    public static int Pebbles { get; set; }
}
";

        [Fact]
        public void TestSpansPresentInResource()
        {
            var c = CreateStandardCompilation(Parse(ExampleSource + InstrumentationHelperSource, @"C:\myproject\doc1.cs"));
            var peImage = c.EmitToArray(EmitOptions.Default.WithInstrumentationKinds(ImmutableArray.Create(InstrumentationKind.TestCoverage)));

            var peReader = new PEReader(peImage);
            var reader = DynamicAnalysisDataReader.TryCreateFromPE(peReader, "<DynamicAnalysisData>");

            VerifyDocuments(reader, reader.Documents,
                @"'C:\myproject\doc1.cs' 44-3F-7C-A1-EF-CA-A8-16-40-D2-09-4F-3E-52-7C-44-8D-22-C8-02 (SHA1)");

            Assert.Equal(13, reader.Methods.Length);

            string[] sourceLines = ExampleSource.Split('\n');

            VerifySpans(reader, reader.Methods[0], sourceLines,                         // Main
                new SpanResult(5, 4, 9, 5, "public static void Main()"),
                new SpanResult(7, 8, 7, 31, "Console.WriteLine(123)"),
                new SpanResult(8, 8, 8, 31, "Console.WriteLine(123)"));

            VerifySpans(reader, reader.Methods[1], sourceLines,                         // Fred get
                new SpanResult(11, 4, 11, 32, "public static int Fred => 3"),
                new SpanResult(11, 30, 11, 31, "3"));

            VerifySpans(reader, reader.Methods[2], sourceLines,                         // Barney
                new SpanResult(13, 4, 13, 41, "public static int Barney(int x) => x"),
                new SpanResult(13, 39, 13, 40, "x"));

            VerifySpans(reader, reader.Methods[3], sourceLines,                         // Wilma get
                new SpanResult(17, 8, 17, 26, "get { return 12; }"),
                new SpanResult(17, 14, 17, 24, "return 12"));

            VerifySpans(reader, reader.Methods[4], sourceLines,                         // Wilma set
                new SpanResult(18, 8, 18, 15, "set { }"));

            VerifySpans(reader, reader.Methods[5], sourceLines,                         // Betty get
                new SpanResult(21, 4, 21, 36, "public static int Betty { get; }"),
                new SpanResult(21, 30, 21, 34, "get"));

            VerifySpans(reader, reader.Methods[6], sourceLines,                         // Pebbles get
                new SpanResult(23, 4, 23, 43, "public static int Pebbles { get; set; }"),
                new SpanResult(23, 32, 23, 36, "get"));

            VerifySpans(reader, reader.Methods[7], sourceLines,                         // Pebbles set
                new SpanResult(23, 4, 23, 43, "public static int Pebbles { get; set; }"),
                new SpanResult(23, 37, 23, 41, "set"));

            VerifySpans(reader, reader.Methods[8]);
        }

        [Fact]
        public void ResourceStatementKinds()
        {
            string source = @"
using System;

public class C
{
    public static void Main()
    {
        int z = 11;
        int x = z + 10;
        switch (z)
        {
            case 1:
                break;
            case 2:
                break;
            case 3:
                break;
            default:
                break;
        }

        if (x > 10)
        {
            x++;
        }
        else
        {
            x--;
        }

        for (int y = 0; y < 50; y++)
        {
            if (y < 30)
            {
                x++;
                continue;
            }
            else
                break;
        }

        int[] a = new int[] { 1, 2, 3, 4 };
        foreach (int i in a)
        {
            x++;
        }

        while (x < 100)
        {
            x++;
        }

        try
        {
            x++;
            if (x > 10)
            {
                throw new System.Exception();
            }
            x++;
        }
        catch (System.Exception e)
        {
            x++;
        }
        finally
        {
            x++;
        }

        lock (new object())
        {
            ;
        }

        Console.WriteLine(x);

        try
        {
            using ((System.IDisposable)new object())
            {
                ;
            }
        }
        catch (System.Exception e)
        {
        }

        return;
    }
}
";

            var c = CreateStandardCompilation(Parse(source + InstrumentationHelperSource, @"C:\myproject\doc1.cs"));
            var peImage = c.EmitToArray(EmitOptions.Default.WithInstrumentationKinds(ImmutableArray.Create(InstrumentationKind.TestCoverage)));

            var peReader = new PEReader(peImage);
            var reader = DynamicAnalysisDataReader.TryCreateFromPE(peReader, "<DynamicAnalysisData>");

            VerifyDocuments(reader, reader.Documents,
                @"'C:\myproject\doc1.cs' 6A-DC-C0-8A-16-CB-7C-A5-99-8B-2E-0C-3C-81-69-2C-B2-10-EE-F1 (SHA1)");

            Assert.Equal(6, reader.Methods.Length);

            string[] sourceLines = source.Split('\n');

            VerifySpans(reader, reader.Methods[0], sourceLines,
                new SpanResult(5, 4, 89, 5, "public static void Main()"),
                new SpanResult(7, 8, 7, 19, "int z = 11"),
                new SpanResult(8, 8, 8, 23, "int x = z + 10"),
                new SpanResult(12, 16, 12, 22, "break"),
                new SpanResult(14, 16, 14, 22, "break"),
                new SpanResult(16, 16, 16, 22, "break"),
                new SpanResult(18, 16, 18, 22, "break"),
                new SpanResult(9, 16, 9, 17, "z"),
                new SpanResult(23, 12, 23, 16, "x++"),
                new SpanResult(27, 12, 27, 16, "x--"),
                new SpanResult(21, 12, 21, 18, "x > 10"),
                new SpanResult(30, 17, 30, 22, "y = 0"),
                new SpanResult(30, 32, 30, 35, "y++"),
                new SpanResult(34, 16, 34, 20, "x++"),
                new SpanResult(35, 16, 35, 25, "continue"),
                new SpanResult(38, 16, 38, 22, "break"),
                new SpanResult(32, 16, 32, 22, "y < 30"),
                new SpanResult(41, 8, 41, 43, "int[] a = new int[] { 1, 2, 3, 4 }"),
                new SpanResult(44, 12, 44, 16, "x++"),
                new SpanResult(42, 26, 42, 27, "a"),
                new SpanResult(49, 12, 49, 16, "x++"),
                new SpanResult(47, 15, 47, 22, "x < 100"),
                new SpanResult(54, 12, 54, 16, "x++"),
                new SpanResult(57, 16, 57, 45, "throw new System.Exception()"),
                new SpanResult(55, 16, 55, 22, "x > 10"),
                new SpanResult(59, 12, 59, 16, "x++"),
                new SpanResult(63, 12, 63, 16, "x++"),
                new SpanResult(67, 12, 67, 16, "x++"),
                new SpanResult(72, 12, 72, 13, ";"),
                new SpanResult(70, 14, 70, 26, "new object()"),
                new SpanResult(75, 8, 75, 29, "Console.WriteLine(x)"),
                new SpanResult(81, 16, 81, 17, ";"),
                new SpanResult(79, 19, 79, 51, "(System.IDisposable)new object()"),
                new SpanResult(88, 8, 88, 15, "return"));

            VerifySpans(reader, reader.Methods[1]);
        }

        [Fact]
        public void TestMethodSpansWithAttributes()
        {
            string source = @"
using System;
using System.Security;

public class C
{
    static int x;

    public static void Main()                       // Method 0
    {
        Fred();
    }

    [Obsolete()]
    static void Fred()                              // Method 1
    {
    }

    static C()                                      // Method 2
    {
        x = 12;
    }

    [Obsolete()]
    public C()                                      // Method 3
    {
    }

    int Wilma
    {
        [SecurityCritical]
        get { return 12; }                          // Method 4
    }

    [Obsolete()]
    int Betty => 13;                                // Method 5

    [SecurityCritical]
    int Pebbles()                                   // Method 6
    {
        return 3;
    }

    [SecurityCritical]
    ref int BamBam(ref int x)                       // Method 7
    {
        return ref x;
    }

    [SecurityCritical]
    C(int x)                                        // Method 8
    {
    }

    [Obsolete()]
    public int Barney => 13;                        // Method 9

    [SecurityCritical]
    public static C operator +(C a, C b)            // Method 10
    {
        return a;
    }
}
";

            var c = CreateStandardCompilation(Parse(source + InstrumentationHelperSource, @"C:\myproject\doc1.cs"));
            var peImage = c.EmitToArray(EmitOptions.Default.WithInstrumentationKinds(ImmutableArray.Create(InstrumentationKind.TestCoverage)));

            var peReader = new PEReader(peImage);
            var reader = DynamicAnalysisDataReader.TryCreateFromPE(peReader, "<DynamicAnalysisData>");

            VerifyDocuments(reader, reader.Documents,
                @"'C:\myproject\doc1.cs' A3-08-94-55-7C-64-8D-C7-61-7A-11-0B-4B-68-2C-3B-51-C3-C4-58 (SHA1)");

            Assert.Equal(15, reader.Methods.Length);

            string[] sourceLines = source.Split('\n');

            VerifySpans(reader, reader.Methods[0], sourceLines,
                new SpanResult(8, 4, 11, 5, "public static void Main()"),
                new SpanResult(10, 8, 10, 15, "Fred()"));

            VerifySpans(reader, reader.Methods[1], sourceLines,
                new SpanResult(14, 4, 16, 5, "static void Fred()"));

            VerifySpans(reader, reader.Methods[2], sourceLines,
                new SpanResult(18, 4, 21, 5, "static C()"),
                new SpanResult(20, 8, 20, 15, "x = 12"));

            VerifySpans(reader, reader.Methods[3], sourceLines,
                new SpanResult(24, 4, 26, 5, "public C()"));

            VerifySpans(reader, reader.Methods[4], sourceLines,
                new SpanResult(31, 8, 31, 26, "get {"),
                new SpanResult(31, 14, 31, 24, "return 12"));

            VerifySpans(reader, reader.Methods[5], sourceLines,
                new SpanResult(35, 4, 35, 20, "int Betty"),
                new SpanResult(35, 17, 35, 19, "13"));

            VerifySpans(reader, reader.Methods[6], sourceLines,
                new SpanResult(38, 4, 41, 5, "int Pebbles()"),
                new SpanResult(40, 8, 40, 17, "return 3"));

            VerifySpans(reader, reader.Methods[7], sourceLines,
                new SpanResult(44, 4, 47, 5, "ref int BamBam"),
                new SpanResult(46, 8, 46, 21, "return ref x"));

            VerifySpans(reader, reader.Methods[8], sourceLines,
                new SpanResult(50, 4, 52, 5, "C(int x)"));

            VerifySpans(reader, reader.Methods[9], sourceLines,
                new SpanResult(55, 4, 55, 28, "public int Barney"),
                new SpanResult(55, 25, 55, 27, "13"));

            VerifySpans(reader, reader.Methods[10], sourceLines,
                new SpanResult(58, 4, 61, 5, "public static C operator +"),
                new SpanResult(60, 8, 60, 17, "return a"));
        }

        [Fact]
        public void TestPatternSpans()
        {
            string source = @"
using System;

public class C
{
    public static void Main()                                   // Method 0
    {
        Student s = new Student();
        s.Name = ""Bozo"";
        s.GPA = 2.3;
        Operate(s);
    }

    static string Operate(Person p)                             // Method 1
    {
        switch (p)
        {
            case Student s when s.GPA > 3.5:
                return $""Student {s.Name} ({s.GPA:N1})"";
            case Student s when (s.GPA < 2.0):
                return $""Failing Student {s.Name} ({s.GPA:N1})"";
            case Student s:
                return $""Student {s.Name} ({s.GPA:N1})"";
            case Teacher t:
                return $""Teacher {t.Name} of {t.Subject}"";
            default:
                return $""Person {p.Name}"";
        }
    }
}

class Person { public string Name; }
class Teacher : Person { public string Subject; }
class Student : Person { public double GPA; }
";

            var c = CreateStandardCompilation(Parse(source + InstrumentationHelperSource, @"C:\myproject\doc1.cs"));
            var peImage = c.EmitToArray(EmitOptions.Default.WithInstrumentationKinds(ImmutableArray.Create(InstrumentationKind.TestCoverage)));

            var peReader = new PEReader(peImage);
            var reader = DynamicAnalysisDataReader.TryCreateFromPE(peReader, "<DynamicAnalysisData>");

            string[] sourceLines = source.Split('\n');

            VerifySpans(reader, reader.Methods[0], sourceLines,
                new SpanResult(5, 4, 11, 5, "public static void Main()"),
                new SpanResult(7, 8, 7, 34, "Student s = new Student()"),
                new SpanResult(8, 8, 8, 24, "s.Name = \"Bozo\""),
                new SpanResult(9, 8, 9, 20, "s.GPA = 2.3"),
                new SpanResult(10, 8, 10, 19, "Operate(s)"));

            VerifySpans(reader, reader.Methods[1], sourceLines,
                new SpanResult(13, 4, 28, 5, "static string Operate(Person p)"),
                new SpanResult(17, 27, 17, 43, "when s.GPA > 3.5"),
                new SpanResult(19, 27, 19, 45, "when (s.GPA < 2.0)"),
                new SpanResult(18, 16, 18, 56, "return $\"Student {s.Name} ({s.GPA:N1})\""),
                new SpanResult(20, 16, 20, 64, "return $\"Failing Student {s.Name} ({s.GPA:N1})\""),
                new SpanResult(22, 16, 22, 56, "return $\"Student {s.Name} ({s.GPA:N1})\""),
                new SpanResult(24, 16, 24, 58, "return $\"Teacher {t.Name} of {t.Subject}\""),
                new SpanResult(26, 16, 26, 42, "return $\"Person {p.Name}\""),
                new SpanResult(15, 16, 15, 17, "p"));
        }

        [Fact]
        public void TestDeconstructionSpans()
        {
            string source = @"
using System;

public class C
{
    public static void Main() // Method 1
    {
        var (x, y) = new C();
    }

    public void Deconstruct(out int x, out int y)
    {
        x = 1;
        y = 2;
    }
}
";
            var c = CreateStandardCompilation(Parse(source + InstrumentationHelperSource, @"C:\myproject\doc1.cs"), references: new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            var peImage = c.EmitToArray(EmitOptions.Default.WithInstrumentationKinds(ImmutableArray.Create(InstrumentationKind.TestCoverage)));

            var peReader = new PEReader(peImage);
            var reader = DynamicAnalysisDataReader.TryCreateFromPE(peReader, "<DynamicAnalysisData>");

            string[] sourceLines = source.Split('\n');

            VerifySpans(reader, reader.Methods[0], sourceLines,
                new SpanResult(5, 4, 8, 5, "public static void Main()"),
                new SpanResult(7, 8, 7, 29, "var (x, y) = new C()"));
        }

        [Fact]
        public void TestForeachSpans()
        {
            string source = @"
using System;

public class C
{
    public static void Main() // Method 1
    {
        C[] a = null;
        foreach
            (var x
            in a)
            ;
    }
}
";
            var c = CreateStandardCompilation(Parse(source + InstrumentationHelperSource, @"C:\myproject\doc1.cs"));
            var peImage = c.EmitToArray(EmitOptions.Default.WithInstrumentationKinds(ImmutableArray.Create(InstrumentationKind.TestCoverage)));

            var peReader = new PEReader(peImage);
            var reader = DynamicAnalysisDataReader.TryCreateFromPE(peReader, "<DynamicAnalysisData>");

            string[] sourceLines = source.Split('\n');

            VerifySpans(reader, reader.Methods[0], sourceLines,
                new SpanResult(5, 4, 12, 5, "public static void Main()"),
                new SpanResult(7, 8, 7, 21, "C[] a = null"),
                new SpanResult(11, 12, 11, 13, ";"),
                new SpanResult(10, 15, 10, 16, "a")
                );
        }

        [Fact]
        public void TestForeachDeconstructionSpans()
        {
            string source = @"
using System;

public class C
{
    public static void Main() // Method 1
    {
        C[] a = null;
        foreach
            (var (x, y)
            in a)
            ;
    }

    public void Deconstruct(out int x, out int y)
    {
        x = 1;
        y = 2;
    }
}
";
            var c = CreateStandardCompilation(Parse(source + InstrumentationHelperSource, @"C:\myproject\doc1.cs"), references: new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            var peImage = c.EmitToArray(EmitOptions.Default.WithInstrumentationKinds(ImmutableArray.Create(InstrumentationKind.TestCoverage)));

            var peReader = new PEReader(peImage);
            var reader = DynamicAnalysisDataReader.TryCreateFromPE(peReader, "<DynamicAnalysisData>");

            string[] sourceLines = source.Split('\n');

            VerifySpans(reader, reader.Methods[0], sourceLines,
                new SpanResult(5, 4, 12, 5, "public static void Main()"),
                new SpanResult(7, 8, 7, 21, "C[] a = null"),
                new SpanResult(11, 12, 11, 13, ";"),
                new SpanResult(10, 15, 10, 16, "a")
                );
        }

        [Fact]
        public void TestFieldInitializerSpans()
        {
            string source = @"
using System;

public class C
{
    public static void Main()                                   // Method 0
    {
        TestMain();
    }

    static void TestMain()                                      // Method 1
    {
        C local = new C(); local = new C(1, 2);
    }

    static int Init() => 33;                                    // Method 2

    C()                                                         // Method 3
    {
        _z = 12;
    }

    static C()                                                  // Method 4
    {
        s_z = 123;
    }

    int _x = Init();
    int _y = Init() + 12;
    int _z;
    static int s_x = Init();
    static int s_y = Init() + 153;
    static int s_z;

    C(int x)                                                    // Method 5
    {
        _z = x;
    }

    C(int a, int b)                                             // Method 6
    {
        _z = a + b;
    }

    int Prop1 { get; } = 15;
    static int Prop2 { get; } = 255;
}
";

            var c = CreateStandardCompilation(Parse(source + InstrumentationHelperSource, @"C:\myproject\doc1.cs"));
            var peImage = c.EmitToArray(EmitOptions.Default.WithInstrumentationKinds(ImmutableArray.Create(InstrumentationKind.TestCoverage)));

            var peReader = new PEReader(peImage);
            var reader = DynamicAnalysisDataReader.TryCreateFromPE(peReader, "<DynamicAnalysisData>");

            string[] sourceLines = source.Split('\n');

            VerifySpans(reader, reader.Methods[0], sourceLines,
                new SpanResult(5, 4, 8, 5, "public static void Main()"),
                new SpanResult(7, 8, 7, 19, "TestMain()"));

            VerifySpans(reader, reader.Methods[1], sourceLines,
                new SpanResult(10, 4, 13, 5, "static void TestMain()"),
                new SpanResult(12, 8, 12, 26, "C local = new C()"),
                new SpanResult(12, 27, 12, 47, "local = new C(1, 2)"));

            VerifySpans(reader, reader.Methods[2], sourceLines,
                new SpanResult(15, 4, 15, 28, "static int Init() => 33"),
                new SpanResult(15, 25, 15, 27, "33"));

            VerifySpans(reader, reader.Methods[3], sourceLines,
                new SpanResult(17, 4, 20, 5, "C()"),
                new SpanResult(27, 13, 27, 19, "Init()"),
                new SpanResult(28, 13, 28, 24, "Init() + 12"),
                new SpanResult(44, 25, 44, 27, "15"),
                new SpanResult(19, 8, 19, 16, "_z = 12"));

            VerifySpans(reader, reader.Methods[4], sourceLines,
                new SpanResult(22, 4, 25, 5, "static C()"),
                new SpanResult(30, 21, 30, 27, "Init()"),
                new SpanResult(31, 21, 31, 33, "Init() + 153"),
                new SpanResult(45, 32, 45, 35, "255"),
                new SpanResult(24, 8, 24, 18, "s_z = 123"));

            VerifySpans(reader, reader.Methods[5], sourceLines,
                new SpanResult(34, 4, 37, 5, "C(int x)"),
                new SpanResult(27, 13, 27, 19, "Init()"),
                new SpanResult(28, 13, 28, 24, "Init() + 12"),
                new SpanResult(44, 25, 44, 27, "15"),
                new SpanResult(36, 8, 36, 15, "_z = x"));

            VerifySpans(reader, reader.Methods[6], sourceLines,
                new SpanResult(39, 4, 42, 5, "C(int a, int b)"),
                new SpanResult(27, 13, 27, 19, "Init()"),
                new SpanResult(28, 13, 28, 24, "Init() + 12"),
                new SpanResult(44, 25, 44, 27, "15"),
                new SpanResult(41, 8, 41, 19, "_z = a + b"));
        }

        [Fact]
        public void TestImplicitConstructorSpans()
        {
            string source = @"
using System;

public class C
{
    public static void Main()                                   // Method 0
    {
        TestMain();
    }

    static void TestMain()                                      // Method 1
    {
        C local = new C();
    }

    static int Init() => 33;                                    // Method 2

    int _x = Init();
    int _y = Init() + 12;
    static int s_x = Init();
    static int s_y = Init() + 153;
    static int s_z = 144;

    int Prop1 { get; } = 15;
    static int Prop2 { get; } = 255;
}
";

            var c = CreateStandardCompilation(Parse(source + InstrumentationHelperSource, @"C:\myproject\doc1.cs"));
            var peImage = c.EmitToArray(EmitOptions.Default.WithInstrumentationKinds(ImmutableArray.Create(InstrumentationKind.TestCoverage)));

            var peReader = new PEReader(peImage);
            var reader = DynamicAnalysisDataReader.TryCreateFromPE(peReader, "<DynamicAnalysisData>");

            string[] sourceLines = source.Split('\n');

            VerifySpans(reader, reader.Methods[0], sourceLines,
                new SpanResult(5, 4, 8, 5, "public static void Main()"),
                new SpanResult(7, 8, 7, 19, "TestMain()"));

            VerifySpans(reader, reader.Methods[1], sourceLines,
                new SpanResult(10, 4, 13, 5, "static void TestMain()"),
                new SpanResult(12, 8, 12, 26, "C local = new C()"));

            VerifySpans(reader, reader.Methods[2], sourceLines,
               new SpanResult(15, 4, 15, 28, "static int Init() => 33"),
               new SpanResult(15, 25, 15, 27, "33"));

            VerifySpans(reader, reader.Methods[5], sourceLines,                     // Synthesized instance constructor
                new SpanResult(17, 13, 17, 19, "Init()"),
                new SpanResult(18, 13, 18, 24, "Init() + 12"),
                new SpanResult(23, 25, 23, 27, "15"));

            VerifySpans(reader, reader.Methods[6], sourceLines,                     // Synthesized static constructor
                new SpanResult(19, 21, 19, 27, "Init()"),
                new SpanResult(20, 21, 20, 33, "Init() + 153"),
                new SpanResult(21, 21, 21, 24, "144"),
                new SpanResult(24, 32, 24, 35, "255"));
        }

        [Fact]
        public void TestImplicitConstructorsWithLambdasSpans()
        {
            string source = @"
using System;

public class C
{
    public static void Main()                                   // Method 0
    {
        TestMain();
    }

    static void TestMain()                                      // Method 1
    {
        int y = s_c._function();
        D d = new D();
        int z = d._c._function();
        int zz = D.s_c._function();
    }

    public C(Func<int> f)                                       // Method 2
    {
        _function = f;
    }

    static C s_c = new C(() => 115);
    Func<int> _function;
}

class D
{
    public C _c = new C(() => 120);
    public static C s_c = new C(() => 144);
    public C _c1 = new C(() => 130);
    public static C s_c1 = new C(() => 156);
}

partial struct E
{
}

partial struct E
{
    public static C s_c = new C(() => 1444);
    public static C s_c1 = new C(() => { return 1567; });
}
";

            var c = CreateStandardCompilation(Parse(source + InstrumentationHelperSource, @"C:\myproject\doc1.cs"));
            var peImage = c.EmitToArray(EmitOptions.Default.WithInstrumentationKinds(ImmutableArray.Create(InstrumentationKind.TestCoverage)));

            var peReader = new PEReader(peImage);
            var reader = DynamicAnalysisDataReader.TryCreateFromPE(peReader, "<DynamicAnalysisData>");

            string[] sourceLines = source.Split('\n');

            VerifySpans(reader, reader.Methods[0], sourceLines,
                new SpanResult(5, 4, 8, 5, "public static void Main()"),
                new SpanResult(7, 8, 7, 19, "TestMain()"));

            VerifySpans(reader, reader.Methods[1], sourceLines,
                new SpanResult(10, 4, 16, 5, "static void TestMain()"),
                new SpanResult(12, 8, 12, 32, "int y = s_c._function()"),
                new SpanResult(13, 8, 13, 22, "D d = new D()"),
                new SpanResult(14, 8, 14, 33, "int z = d._c._function()"),
                new SpanResult(15, 8, 15, 35, "int zz = D.s_c._function()"));

            VerifySpans(reader, reader.Methods[2], sourceLines,
                new SpanResult(18, 4, 21, 5, "public C(Func<int> f)"),
                new SpanResult(20, 8, 20, 22, "_function = f"));

            VerifySpans(reader, reader.Methods[3], sourceLines,                     // Synthesized static constructor for C
                new SpanResult(23, 31, 23, 34, "115"),
                new SpanResult(23, 19, 23, 35, "new C(() => 115)"));

            VerifySpans(reader, reader.Methods[4], sourceLines,                     // Synthesized instance constructor for D
                new SpanResult(29, 30, 29, 33, "120"),
                new SpanResult(31, 31, 31, 34, "130"),
                new SpanResult(29, 18, 29, 34, "new C(() => 120)"),
                new SpanResult(31, 19, 31, 35, "new C(() => 130)"));

            VerifySpans(reader, reader.Methods[5], sourceLines,                     // Synthesized static constructor for D
                new SpanResult(30, 38, 30, 41, "144"),
                new SpanResult(32, 39, 32, 42, "156"),
                new SpanResult(30, 26, 30, 42, "new C(() => 144)"),
                new SpanResult(32, 27, 32, 43, "new C(() => 156"));

            VerifySpans(reader, reader.Methods[6], sourceLines,                     // Synthesized static constructor for E
                new SpanResult(41, 38, 41, 42, "1444"),
                new SpanResult(42, 41, 42, 53, "return 1567"),
                new SpanResult(41, 26, 41, 43, "new C(() => 1444)"),
                new SpanResult(42, 27, 42, 56, "new C(() => { return 1567; })"));
        }

        [Fact]
        public void TestLocalFunctionWithLambdaSpans()
        {
            string source = @"
using System;

public class C
{
    public static void Main()                                   // Method 0
    {
        TestMain();
    }

    static void TestMain()                                      // Method 1
    {
        new D().M1();
    }
}

public class D
{
    public void M1()                                            // Method 3
    {
        L1();
        void L1()
        {
            var f = new Func<int>(
                () => 1
            );

            f();

            var f1 = new Func<int>(
                () => { return 2; }
            );

            var f2 = new Func<int, int>(
                (x) => x + 3
            );

            var f3 = new Func<int, int>(
                x => x + 4
            );
        }
    }
}
";

            var c = CreateStandardCompilation(Parse(source + InstrumentationHelperSource, @"C:\myproject\doc1.cs"));
            var peImage = c.EmitToArray(EmitOptions.Default.WithInstrumentationKinds(ImmutableArray.Create(InstrumentationKind.TestCoverage)));

            var peReader = new PEReader(peImage);
            var reader = DynamicAnalysisDataReader.TryCreateFromPE(peReader, "<DynamicAnalysisData>");

            string[] sourceLines = source.Split('\n');

            VerifySpans(reader, reader.Methods[0], sourceLines,
                new SpanResult(5, 4, 8, 5, "public static void Main()"),
                new SpanResult(7, 8, 7, 19, "TestMain()"));

            VerifySpans(reader, reader.Methods[1], sourceLines,
                new SpanResult(10, 4, 13, 5, "static void TestMain()"),
                new SpanResult(12, 8, 12, 21, "new D().M1()"));

            VerifySpans(reader, reader.Methods[3], sourceLines,
                new SpanResult(18, 4, 41, 5, "public void M1()"),
                new SpanResult(20, 8, 20, 13, "L1()"),
                new SpanResult(24, 22, 24, 23, "1"),
                new SpanResult(23, 12, 25, 14, "var f = new Func<int>"),
                new SpanResult(27, 12, 27, 16, "f()"),
                new SpanResult(30, 24, 30, 33, "return 2"),
                new SpanResult(29, 12, 31, 14, "var f1 = new Func<int>"),
                new SpanResult(34, 23, 34, 28, "x + 3"),
                new SpanResult(33, 12, 35, 14, "var f2 = new Func<int, int>"),
                new SpanResult(38, 21, 38, 26, "x + 4"),
                new SpanResult(37, 12, 39, 14, "var f3 = new Func<int, int>"));
        }

        [Fact]
        public void TestDynamicAnalysisResourceMissingWhenInstrumentationFlagIsDisabled()
        {
            var c = CreateStandardCompilation(Parse(ExampleSource + InstrumentationHelperSource, @"C:\myproject\doc1.cs"));
            var peImage = c.EmitToArray(EmitOptions.Default);

            var peReader = new PEReader(peImage);
            var reader = DynamicAnalysisDataReader.TryCreateFromPE(peReader, "<DynamicAnalysisData>");

            Assert.Null(reader);
        }

        private class SpanResult
        {
            public int StartLine { get; }
            public int StartColumn { get; }
            public int EndLine { get; }
            public int EndColumn { get; }
            public string TextStart { get; }
            public SpanResult(int startLine, int startColumn, int endLine, int endColumn, string textStart)
            {
                StartLine = startLine;
                StartColumn = startColumn;
                EndLine = endLine;
                EndColumn = endColumn;
                TextStart = textStart;
            }
        }

        private static void VerifySpans(DynamicAnalysisDataReader reader, DynamicAnalysisMethod methodData, string[] sourceLines, params SpanResult[] expected)
        {
            ArrayBuilder<string> expectedSpanSpellings = ArrayBuilder<string>.GetInstance(expected.Length);
            foreach (SpanResult expectedSpanResult in expected)
            {
                Assert.True(sourceLines[expectedSpanResult.StartLine].Substring(expectedSpanResult.StartColumn).StartsWith(expectedSpanResult.TextStart));
                expectedSpanSpellings.Add(string.Format("({0},{1})-({2},{3})", expectedSpanResult.StartLine, expectedSpanResult.StartColumn, expectedSpanResult.EndLine, expectedSpanResult.EndColumn));
            }

            VerifySpans(reader, methodData, expectedSpanSpellings.ToArrayAndFree());
        }

        private static void VerifySpans(DynamicAnalysisDataReader reader, DynamicAnalysisMethod methodData, params string[] expected)
        {
            AssertEx.Equal(expected, reader.GetSpans(methodData.Blob).Select(s => $"({s.StartLine},{s.StartColumn})-({s.EndLine},{s.EndColumn})"));
        }

        private void VerifyDocuments(DynamicAnalysisDataReader reader, ImmutableArray<DynamicAnalysisDocument> documents, params string[] expected)
        {
            var sha1 = new Guid("ff1816ec-aa5e-4d10-87f7-6f4963833460");

            var actual = from d in documents
                         let name = reader.GetDocumentName(d.Name)
                         let hash = d.Hash.IsNil ? "" : " " + BitConverter.ToString(reader.GetBytes(d.Hash))
                         let hashAlgGuid = reader.GetGuid(d.HashAlgorithm)
                         let hashAlg = (hashAlgGuid == sha1) ? " (SHA1)" : (hashAlgGuid == default(Guid)) ? "" : " " + hashAlgGuid.ToString()
                         select $"'{name}'{hash}{hashAlg}";

            AssertEx.Equal(expected, actual);
        }
    }
}


text:
module Neo4r
  # REST API proxy class
  class RestWrapper
    @@rest = Neography::Rest.new
    def method_missing(name, *args, &block)
      # Create rest object everytyime to avoid exception
      @@rest.__send__ name, *args, &block
    end
  end
end


text:
class CreateOperations < ActiveRecord::Migration
  def change
    create_table :operations do |t|
      t.string :operator

      t.timestamps
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>db get</title>
    <link rel="stylesheet" href="apiReference.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB TCL API Reference" />
    <link rel="up" href="tclapi.html" title="Chapter 1.  Berkeley DB Tcl APIs" />
    <link rel="prev" href="db_del.html" title="db del" />
    <link rel="next" href="db_get_join.html" title="db get_join" />

Library Version 11.2.5.3

          db get

          Prev
          Chapter 1.
                Berkeley DB Tcl APIs

           Next

db get

db get
	[-consume]
	[-consume_wait]
	[-glob]
	[-partial {doff dlen}]
	[-recno]
	[-rmw]
	[-txn txnid]
	key

db get
	-get_both
	[-partial {doff dlen}]
	[-rmw]
	[-txn txnid]
	key data

         The db get
         command returns key/data pairs from the database.

         In the presence of duplicate key values, db
         get will return all duplicate items.
         Duplicates are sorted by insert order except where this order has been
         overridden by cursor operations.

        The options are as follows:

                 -consume

                 Return the record number and data from the available record closest to
                 the head of the queue, and delete the record. The cursor will be
                 positioned on the deleted record.  A record is available if it is not
                 deleted and is not currently locked.  The underlying database must be
                 of type Queue for -consume to be
                 specified.

                  -consume_wait

                 The same as the -consume flag except
                 that if the Queue database is empty, the thread of control will wait
                 until there is data in the queue before returning.  The underlying
                 database must be of type Queue for -consume_wait to be specified.

                  -get_both key data

                 Retrieve the key/data pair only if both the key and data match the
                 arguments.

                  -glob

                 Return all keys matching the given key, where the key is a simple
                 wildcard pattern.  Where it is used, it replaces the use of the key
                 with the given pattern of a set of keys.  Any characters after the
                 wildcard character are ignored.  For example, in a database of last
                 names, the command "db0 get Jones" will return all occurrences of
                 "Jones" in the database, and the command "db0 get -glob Jo*" will
                 return both "Jones" and "Johnson" from the database.  The command "db0
                 get -glob *" will return all of the key/data pairs in the database.
                 This option only works on databases using the Btree access method.

                  -partial {doff dlen}

                 The dlen bytes starting doff bytes from the beginning of the retrieved
                 data record are returned as if they comprised the entire record. If
                 any or all of the specified bytes do not exist in the record, the
                 command is successful and any existing bytes are returned.

                  -recno

                 Retrieve the specified numbered key/data pair from a database.  For
                 -recno to be specified, the specified
                 key must be a record number; and the underlying database must be of
                 type Recno or Queue, or of type Btree that was created with the
                 -recnum option.

                  -rmw

                 Acquire write locks instead of read locks when doing the retrieval.
                 Setting this flag may decrease the likelihood of deadlock during a
                 read-modify-write cycle by immediately acquiring the write lock during
                 the read part of the cycle so that another thread of control acquiring
                 a read lock for the same item, in its own read-modify-write cycle,
                 will not result in deadlock.

                 Because the db get command will not hold locks across Berkeley
                 DB interface calls in nontransactional environments, the -rmw argument to the db
                 get call is only meaningful in the
                 presence of transactions.

                  -txn txnid

                 If the operation is part of an application-specified transaction, the
                 txnid parameter is a transaction
                 handle returned from env txn.  If no transaction handle is specified,
                 but the operation occurs in a transactional database, the operation
                 will be implicitly transaction protected.

         If the underlying database is a Queue or Recno database, the given key
         will be interpreted by Tcl as an integer.  For all other database
         types, the key is interpreted by Tcl as a byte array, unless indicated
         by a given option.

         A list of key/data pairs is returned.  In the error case that no
         matching key exists, an empty list is returned.  In all other cases, a
         Tcl error is thrown.

          Prev

            Up

           Next

          db del

            Home

           db get_join


text:
from __future__ import print_function, absolute_import
from reid.utils.serialization import save_checkpoint, load_checkpoint
from reid.models import model_utils as mu
from reid import models
from reid.config import Config
from reid import datasets
import torch
import os
import argparse
import numpy as np

parser = argparse.ArgumentParser(description='Full supervised Test')

parser.add_argument('-d', '--dataset', type=str, default='market1501std',
                    choices=datasets.names())
parser.add_argument('-a', '--arch', type=str, default='resnet50')
parser.add_argument('--height', type=int, default=256)
parser.add_argument('--width', type=int, default=128)
parser.add_argument('--batch-size', type=int, default=32)
parser.add_argument('--evaluate', dest='evaluate', action='store_true', help='evaluate model on validation set')
parser.add_argument('--checkpoint', default='', type=str)
args = parser.parse_args()

config = Config(model_name=args.arch,img_translation=None,
                height=args.height, width=args.width)
# config1.height = 224
# config1.width = 224
# config1.epochs = 200
dataset = args.dataset
cur_path = os.getcwd()
logs_dir = os.path.join(cur_path, 'logs')
data_dir = os.path.join(cur_path,'data',dataset)

data = datasets.create(dataset, data_dir)
# train_data,untrain_data = dp.split_dataset(data.trainval, 0.2)

if args.checkpoint is not None:

    model = models.create(config.model_name, num_features=config.num_features,
                          dropout=config.dropout, num_classes=config.num_classes)
    model = torch.nn.DataParallel(model).cuda()

    save_pth = os.path.join(config.logs_dir, config.model_name, '%s'%(args.checkpoint))
    if os.path.exists(save_pth) is not True:
        raise ValueError('wrong model pth')
    checkpoint = load_checkpoint(save_pth)
    state_dict = {k:v for k,v in checkpoint['state_dict'].items()
                  if k in model.state_dict().keys()}
    model.load_state_dict(state_dict)
else:
    model = mu.train(data.trainval, data.images_dir, config)

    save_checkpoint({
        'state_dict': model.state_dict(),
        'epoch': 0,
        'train_data': data.trainval}, False,
        fpath=os.path.join(config.logs_dir, config.model_name, 'full_supervised')
    )
mu.evaluate(model, data, config)

if args.evaluate is True:
    train_data = checkpoint['train_data']
    weight = [w for (_,_,_,w) in train_data]
    print(np.median(weight))
    print(np.mean(weight))


text:
from flask import Flask, render_template, request, redirect

from astropy.time import Time
from astropy.coordinates import EarthLocation, get_sun, AltAz
from moon import moon_distance, get_umbra, estimate_umbra

app = Flask(__name__)

app.vars = dict()
app.vars['location'] = 'Nashville, TN'
app.vars['c2time'] = '18:27:03.9'
app.vars['c3time'] = '18:29:43.0'
app.vars['d_est'] = ''
app.vars['d_real'] = ''
app.vars['su_est'] = ''
app.vars['su_real'] = ''
app.vars['lat'] = ''
app.vars['long'] = ''

# Redirect to the main page
@app.route('/')
@app.route('/index.html')
@app.route('/query.html')
@app.route('/query')
def bdnyc_home():
    return redirect('/index')

# Page with a text box to take the user parameters
@app.route('/index', methods=['GET', 'POST'])
def bdnyc_query():
    return render_template('index.html', location=app.vars['location'],
                           c2time=app.vars['c2time'], c3time=app.vars['c3time'])

# Grab results of query and calculate the distance
@app.route('/runcalc', methods=['POST'])
def bdnyc_runquery():
    app.vars['location'] = request.form['location']
    app.vars['c2time'] = request.form['c2time']
    app.vars['c3time'] = request.form['c3time']

    loc = EarthLocation.of_address(app.vars['location'])
    t2 = Time('2017-08-21 ' + app.vars['c2time'])
    t3 = Time('2017-08-21 ' + app.vars['c3time'])
    dm, reald = moon_distance(loc, t2, t3)

    sun = get_sun(t2)
    sun_altaz = sun.transform_to(AltAz(obstime=t2, location=loc))

    su_est = estimate_umbra(loc, t2, t3)
    su_real = get_umbra(loc, t2)

    app.vars['d_est'] = '{:.7}'.format(dm)
    app.vars['d_real'] = '{:.7}'.format(reald)
    app.vars['su_est'] = '{:.4}'.format(su_est)
    app.vars['su_real'] = '{:.4}'.format(su_real)
    app.vars['lat'] = '{:.4}'.format(loc.latitude.value)
    app.vars['long'] = '{:.4}'.format(loc.longitude.value)

    sun_alt = '{:.4}'.format(sun_altaz.alt.value)
    percent_diff = '{:.2}'.format((dm - reald) / reald * 100.)

    print(loc, t2, t3)
    print(app.vars['c2time'], app.vars['c3time'])
    print(request.form['c2time'], request.form['c3time'])
    print(su_est, app.vars['su_est'])

    return render_template('view.html', location=app.vars['location'],
                           c2time=app.vars['c2time'], d_est=app.vars['d_est'], d_real=app.vars['d_real'],
                           su_real=app.vars['su_real'], lat=app.vars['lat'], su_est=app.vars['su_est'],
                           long=app.vars['long'], sun_alt=sun_alt, percent_diff=percent_diff)

# Called when you click clear button
@app.route('/clear')
def app_clear():
    clear_values()
    return redirect('/index')

def clear_values():
    for key in app.vars.keys():
        app.vars[key] = ''
    return


text:
package edu.isi.pegasus.common.logging;

import edu.isi.pegasus.common.util.FactoryException;

/**
 * Class to notify of failures while instantiating Log Formatter implementations.
 *
 * @author Karan Vahi
 * @version $Revision$
 */
public class LogFormatterFactoryException extends FactoryException {

    /** The default classname that is associated with the exception. */
    public static final String DEFAULT_NAME = "Log Formatter";

    /**
     * Constructs a LogFormatterFactoryException with no detail message. The associated
     * classname is set to value specified by DEFAULT_NAME.
     *
     * @param msg the detailed message.
     * @see #DEFAULT_NAME
     */
    public LogFormatterFactoryException(String msg) {
        super(msg);
        mClassname = LogFormatterFactoryException.DEFAULT_NAME;
    }

    /**
     * Constructs a LogFormatterFactoryException with the specified detailed message.
     *
     * @param msg is the detailed message.
     * @param classname the name of class that was trying to be instantiated or some other signifier
     *     like module name.
     */
    public LogFormatterFactoryException(String msg, String classname) {
        super(msg, classname);
    }

    /**
     * Constructs a LogFormatterFactoryException with the specified detailed message
     * and a cause. The associated classname is set to value specified by DEFAULT_NAME.
     *
     * @param msg is the detailed message that is to be logged.
     * @param cause is the cause (which is saved for later retrieval by the {@link
     *     java.lang.Throwable#getCause()} method). A null value is permitted, and
     *     indicates that the cause is nonexistent or unknown.
     * @see #DEFAULT_NAME
     */
    public LogFormatterFactoryException(String msg, Throwable cause) {
        super(msg, cause);
        mClassname = LogFormatterFactoryException.DEFAULT_NAME;
    }

    /**
     * Constructs a LogFormatterFactoryException with the specified detailed message
     * and a cause.
     *
     * @param msg is the detailed message that is to be logged.
     * @param classname the name of class that was trying to be instantiated.
     * @param cause is the cause (which is saved for later retrieval by the {@link
     *     java.lang.Throwable#getCause()} method). A null value is permitted, and
     *     indicates that the cause is nonexistent or unknown.
     */
    public LogFormatterFactoryException(String msg, String classname, Throwable cause) {

        super(msg, cause);
        mClassname = classname;
    }
}


text:
package SysInfo;

import java.io.IOException;

public class SysInfo{

    public String getSysInfo() throws IOException{

        OSInfo os = new OSInfo();
        CPUInfo cpu = new CPUInfo();
        UserInfo user = new UserInfo();
        NetInfo net = new NetInfo();

        return jsonifySysInfo(os.getOSInfo(), cpu.getCPUInfo(os.getName().toLowerCase()), user.getUserInfo(), net.getNetInfo());
    }

    private String jsonifySysInfo(String os, String cpu, String user, String net){

        String json = "{" + os + "," + cpu + "," + user + "," + net + "}";
        return json;
    }
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net;
using System.Reflection;
using System.Threading.Tasks;
using System.Threading;
using NUnit.Framework;

namespace Refit.Tests
{
    [Headers("User-Agent: RefitTestClient", "Api-Version: 1")]
    public interface IRestMethodInfoTests
    {
        [Get("@)!@_!($_!@($\\\\|||::::")]
        Task<string> GarbagePath();

        [Get("/foo/bar/{id}")]
        Task<string> FetchSomeStuffMissingParameters();

        [Get("/foo/bar/{id}")]
        Task<string> FetchSomeStuff(int id);

        [Get("/foo/bar/{id}?baz=bamf")]
        Task<string> FetchSomeStuffWithHardcodedQueryParam(int id);

        [Get("/foo/bar/{id}?baz=bamf")]
        Task<string> FetchSomeStuffWithQueryParam(int id, string search);

        [Get("/foo/bar/{id}")]
        Task<string> FetchSomeStuffWithAlias([AliasAs("id")] int anId);

        [Get("/foo/bar/{width}x{height}")]
        Task<string> FetchAnImage(int width, int height);

        [Get("/foo/bar/{id}")]
        IObservable<string> FetchSomeStuffWithBody([AliasAs("id")] int anId, [Body] Dictionary<int, string> theData);

        [Post("/foo/bar/{id}")]
        IObservable<string> PostSomeUrlEncodedStuff([AliasAs("id")] int anId, [Body(BodySerializationMethod.UrlEncoded)] Dictionary<string, string> theData);

        [Get("/foo/bar/{id}")]
        [Headers("Api-Version: 2 ")]
        Task<string> FetchSomeStuffWithHardcodedHeaders(int id);

        [Get("/foo/bar/{id}")]
        Task<string> FetchSomeStuffWithDynamicHeader(int id, [Header("Authorization")] string authorization);

        [Post("/foo/{id}")]
        Task<bool> OhYeahValueTypes(int id, [Body] int whatever);

        [Post("/foo/{id}")]
        Task VoidPost(int id);

        [Post("/foo/{id}")]
        string AsyncOnlyBuddy(int id);

        [Patch("/foo/{id}")]
        IObservable<string> PatchSomething(int id, [Body] string someAttribute);
    }

    [TestFixture]
    public class RestMethodInfoTests
    {
        [Test]
        public void GarbagePathsShouldThrow()
        {
            bool shouldDie = true;

            try {
                var input = typeof(IRestMethodInfoTests);
                var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "GarbagePath"));
            } catch (ArgumentException) {
                shouldDie = false;
            }

            Assert.IsFalse(shouldDie);
        }

        [Test]
        public void MissingParametersShouldBlowUp()
        {
            bool shouldDie = true;

            try {
                var input = typeof(IRestMethodInfoTests);
                var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "FetchSomeStuffMissingParameters"));
            } catch (ArgumentException) {
                shouldDie = false;
            }

            Assert.IsFalse(shouldDie);
        }

        [Test]
        public void ParameterMappingSmokeTest()
        {
            var input = typeof(IRestMethodInfoTests);
            var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "FetchSomeStuff"));
            Assert.AreEqual("id", fixture.ParameterMap[0]);
            Assert.AreEqual(0, fixture.QueryParameterMap.Count);
            Assert.IsNull(fixture.BodyParameterInfo);
        }

        [Test]
        public void ParameterMappingWithQuerySmokeTest()
        {
            var input = typeof(IRestMethodInfoTests);
            var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "FetchSomeStuffWithQueryParam"));
            Assert.AreEqual("id", fixture.ParameterMap[0]);
            Assert.AreEqual("search", fixture.QueryParameterMap[1]);
            Assert.IsNull(fixture.BodyParameterInfo);
        }

        [Test]
        public void ParameterMappingWithHardcodedQuerySmokeTest()
        {
            var input = typeof(IRestMethodInfoTests);
            var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "FetchSomeStuffWithHardcodedQueryParam"));
            Assert.AreEqual("id", fixture.ParameterMap[0]);
            Assert.AreEqual(0, fixture.QueryParameterMap.Count);
            Assert.IsNull(fixture.BodyParameterInfo);
        }

        [Test]
        public void AliasMappingShouldWork()
        {
            var input = typeof(IRestMethodInfoTests);
            var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "FetchSomeStuffWithAlias"));
            Assert.AreEqual("id", fixture.ParameterMap[0]);
            Assert.AreEqual(0, fixture.QueryParameterMap.Count);
            Assert.IsNull(fixture.BodyParameterInfo);
        }

        [Test]
        public void MultipleParametersPerSegmentShouldWork()
        {
            var input = typeof(IRestMethodInfoTests);
            var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "FetchAnImage"));
            Assert.AreEqual("width", fixture.ParameterMap[0]);
            Assert.AreEqual("height", fixture.ParameterMap[1]);
            Assert.AreEqual(0, fixture.QueryParameterMap.Count);
            Assert.IsNull(fixture.BodyParameterInfo);
        }

        [Test]
        public void FindTheBodyParameter()
        {
            var input = typeof(IRestMethodInfoTests);
            var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "FetchSomeStuffWithBody"));
            Assert.AreEqual("id", fixture.ParameterMap[0]);

            Assert.IsNotNull(fixture.BodyParameterInfo);
            Assert.AreEqual(0, fixture.QueryParameterMap.Count);
            Assert.AreEqual(1, fixture.BodyParameterInfo.Item2);
        }

        [Test]
        public void AllowUrlEncodedContent()
        {
            var input = typeof(IRestMethodInfoTests);
            var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "PostSomeUrlEncodedStuff"));
            Assert.AreEqual("id", fixture.ParameterMap[0]);

            Assert.IsNotNull(fixture.BodyParameterInfo);
            Assert.AreEqual(0, fixture.QueryParameterMap.Count);
            Assert.AreEqual(BodySerializationMethod.UrlEncoded, fixture.BodyParameterInfo.Item1);
        }

        [Test]
        public void HardcodedHeadersShouldWork()
        {
            var input = typeof(IRestMethodInfoTests);
            var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "FetchSomeStuffWithHardcodedHeaders"));
            Assert.AreEqual("id", fixture.ParameterMap[0]);
            Assert.AreEqual(0, fixture.QueryParameterMap.Count);
            Assert.IsNull(fixture.BodyParameterInfo);

            Assert.IsTrue(fixture.Headers.ContainsKey("Api-Version"), "Headers include Api-Version header");
            Assert.AreEqual("2", fixture.Headers["Api-Version"]);
            Assert.IsTrue(fixture.Headers.ContainsKey("User-Agent"), "Headers include User-Agent header");
            Assert.AreEqual("RefitTestClient", fixture.Headers["User-Agent"]);
            Assert.AreEqual(2, fixture.Headers.Count);
        }

        [Test]
        public void DynamicHeadersShouldWork()
        {
            var input = typeof(IRestMethodInfoTests);
            var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "FetchSomeStuffWithDynamicHeader"));
            Assert.AreEqual("id", fixture.ParameterMap[0]);
            Assert.AreEqual(0, fixture.QueryParameterMap.Count);
            Assert.IsNull(fixture.BodyParameterInfo);

            Assert.AreEqual("Authorization", fixture.HeaderParameterMap[1]);
            Assert.IsTrue(fixture.Headers.ContainsKey("User-Agent"), "Headers include User-Agent header");
            Assert.AreEqual("RefitTestClient", fixture.Headers["User-Agent"]);
            Assert.AreEqual(2, fixture.Headers.Count);
        }

        [Test]
        public void ValueTypesDontBlowUp()
        {
            var input = typeof(IRestMethodInfoTests);
            var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "OhYeahValueTypes"));
            Assert.AreEqual("id", fixture.ParameterMap[0]);
            Assert.AreEqual(0, fixture.QueryParameterMap.Count);
            Assert.AreEqual(BodySerializationMethod.Json, fixture.BodyParameterInfo.Item1);
            Assert.AreEqual(1, fixture.BodyParameterInfo.Item2);

            Assert.AreEqual(typeof(bool), fixture.SerializedReturnType);
        }

        [Test]
        public void ReturningTaskShouldWork()
        {
            var input = typeof(IRestMethodInfoTests);
            var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "VoidPost"));
            Assert.AreEqual("id", fixture.ParameterMap[0]);

            Assert.AreEqual(typeof(Task), fixture.ReturnType);
            Assert.AreEqual(typeof(void), fixture.SerializedReturnType);
        }

        [Test]
        public void SyncMethodsShouldThrow()
        {
            bool shouldDie = true;

            try {
                var input = typeof(IRestMethodInfoTests);
                var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "AsyncOnlyBuddy"));
            } catch (ArgumentException) {
                shouldDie = false;
            }

            Assert.IsFalse(shouldDie);
        }

        [Test]
        public void UsingThePatchAttributeSetsTheCorrectMethod()
        {
            var input = typeof(IRestMethodInfoTests);
            var fixture = new RestMethodInfo(input, input.GetMethods().First(x => x.Name == "PatchSomething"));

            Assert.AreEqual("PATCH", fixture.HttpMethod.Method);
        }
    }

    [Headers("User-Agent: RefitTestClient", "Api-Version: 1")]
    public interface IDummyHttpApi
    {
        [Get("/foo/bar/{id}")]
        Task<string> FetchSomeStuff(int id);

        [Get("/foo/bar/{id}?baz=bamf")]
        Task<string> FetchSomeStuffWithHardcodedQueryParameter(int id);

        [Get("/foo/bar/{id}?baz=bamf")]
        Task<string> FetchSomeStuffWithHardcodedAndOtherQueryParameters(int id, [AliasAs("search_for")] string searchQuery);

        [Get("/{id}/{width}x{height}/foo")]
        Task<string> FetchSomethingWithMultipleParametersPerSegment(int id, int width, int height);

        [Get("/foo/bar/{id}")]
        [Headers("Api-Version: 2")]
        Task<string> FetchSomeStuffWithHardcodedHeader(int id);

        [Get("/foo/bar/{id}")]
        [Headers("Api-Version")]
        Task<string> FetchSomeStuffWithNullHardcodedHeader(int id);

        [Get("/foo/bar/{id}")]
        [Headers("Api-Version: ")]
        Task<string> FetchSomeStuffWithEmptyHardcodedHeader(int id);

        [Post("/foo/bar/{id}")]
        [Headers("Content-Type: literally/anything")]
        Task<string> PostSomeStuffWithHardCodedContentTypeHeader(int id, [Body] string content);

        [Get("/foo/bar/{id}")]
        [Headers("Authorization: SRSLY aHR0cDovL2kuaW1ndXIuY29tL0NGRzJaLmdpZg==")]
        Task<string> FetchSomeStuffWithDynamicHeader(int id, [Header("Authorization")] string authorization);

        [Get("/foo/bar/{id}")]
        Task<string> FetchSomeStuffWithCustomHeader(int id, [Header("X-Emoji")] string custom);

        [Post("/foo/bar/{id}")]
        Task<string> PostSomeStuffWithCustomHeader(int id, [Body] object body, [Header("X-Emoji")] string emoji);

        [Get("/string")]
        Task<string> FetchSomeStuffWithoutFullPath();

        [Get("/void")]
        Task FetchSomeStuffWithVoid();

        [Post("/foo/bar/{id}")]
        Task<string> PostSomeUrlEncodedStuff(int id, [Body(BodySerializationMethod.UrlEncoded)] object content);

        [Post("/foo/bar/{id}")]
        Task<string> PostSomeAliasedUrlEncodedStuff(int id,[Body(BodySerializationMethod.UrlEncoded)] SomeRequestData content);

        string SomeOtherMethod();

        [Put("/foo/bar/{id}")]
        Task PutSomeContentWithAuthorization(int id, [Body] object content, [Header("Authorization")] string authorization);

        [Put("/foo/bar/{id}")]
        Task<string> PutSomeStuffWithDynamicContentType(int id, [Body] string content, [Header("Content-Type")] string contentType);

        [Post("/foo/bar/{id}")]
        Task<bool> PostAValueType(int id, [Body] Guid? content);

        [Patch("/foo/bar/{id}")]
        IObservable<string> PatchSomething(int id, [Body] string someAttribute);
    }

    public class SomeRequestData
    {
        [AliasAs("rpn")]
        public int ReadablePropertyName { get; set; }
    }

    public class TestHttpMessageHandler : HttpMessageHandler
    {
        public HttpRequestMessage RequestMessage { get; private set; }
        public int MessagesSent { get; set; }
        public HttpContent Content { get; set; }

        public Func<HttpContent> ContentFactory { get; set; }

        public TestHttpMessageHandler(string content = "test")
        {
            Content = new StringContent(content);
            ContentFactory = () => Content;
        }

        protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            RequestMessage = request;
            MessagesSent++;
            return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK) { Content = ContentFactory() });
        }
    }

    public class TestUrlParameterFormatter : IUrlParameterFormatter
    {
        readonly string constantParameterOutput;

        public TestUrlParameterFormatter(string constantOutput)
        {
            constantParameterOutput = constantOutput;
        }

        public string Format(object value, ParameterInfo parameterInfo)
        {
            return constantParameterOutput;
        }
    }

    [TestFixture]
    public class RequestBuilderTests
    {
        [Test]
        public void HttpContentTest()
        {
            var fixture = new RequestBuilderImplementation(typeof(IHttpContentApi));
            var factory = fixture.BuildRestResultFuncForMethod("PostFileUpload");
            var testHttpMessageHandler = new TestHttpMessageHandler();
            var retContent = new StreamContent(new MemoryStream());
            testHttpMessageHandler.Content = retContent;

            var mpc = new MultipartContent("foosubtype");

            var task = (Task<HttpContent>)factory(new HttpClient(testHttpMessageHandler) { BaseAddress = new Uri("http://api/") }, new object[] { mpc });
            task.Wait();

            Assert.AreEqual(testHttpMessageHandler.RequestMessage.Content, mpc);
            Assert.AreEqual(retContent, task.Result);
        }

        [Test]
        public void MethodsThatDontHaveAnHttpMethodShouldFail()
        {
            var failureMethods = new[] {
                "SomeOtherMethod",
                "weofjwoeijfwe",
                null,
            };

            var successMethods = new[] {
                "FetchSomeStuff",
            };

            foreach (var v in failureMethods) {
                bool shouldDie = true;

                try {
                    var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
                    fixture.BuildRequestFactoryForMethod(v);
                } catch (Exception) {
                    shouldDie = false;
                }
                Assert.IsFalse(shouldDie);
            }

            foreach (var v in successMethods) {
                bool shouldDie = false;

                try {
                    var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
                    fixture.BuildRequestFactoryForMethod(v);
                } catch (Exception ex) {
                    shouldDie = true;
                }

                Assert.IsFalse(shouldDie);
            }
        }

        [Test]
        public void HardcodedQueryParamShouldBeInUrl()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("FetchSomeStuffWithHardcodedQueryParameter");
            var output = factory(new object[] { 6 });

            var uri = new Uri(new Uri("http://api"), output.RequestUri);
            Assert.AreEqual("/foo/bar/6?baz=bamf", uri.PathAndQuery);
        }

        [Test]
        public void ParameterizedQueryParamsShouldBeInUrl()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("FetchSomeStuffWithHardcodedAndOtherQueryParameters");
            var output = factory(new object[] { 6, "foo" });

            var uri = new Uri(new Uri("http://api"), output.RequestUri);
            Assert.AreEqual("/foo/bar/6?baz=bamf&search_for=foo", uri.PathAndQuery);
        }

        [Test]
        public void MultipleParametersInTheSameSegmentAreGeneratedProperly()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("FetchSomethingWithMultipleParametersPerSegment");
            var output = factory(new object[] { 6, 1024, 768 });

            var uri = new Uri(new Uri("http://api"), output.RequestUri);
            Assert.AreEqual("/6/1024x768/foo", uri.PathAndQuery);
        }

        [Test]
        public void HardcodedHeadersShouldBeInHeaders()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("FetchSomeStuffWithHardcodedHeader");
            var output = factory(new object[] { 6 });

            Assert.IsTrue(output.Headers.Contains("User-Agent"), "Headers include User-Agent header");
            Assert.AreEqual("RefitTestClient", output.Headers.UserAgent.ToString());
            Assert.IsTrue(output.Headers.Contains("Api-Version"), "Headers include Api-Version header");
            Assert.AreEqual("2", output.Headers.GetValues("Api-Version").Single());
        }

        [Test]
        public void EmptyHardcodedHeadersShouldBeInHeaders()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("FetchSomeStuffWithEmptyHardcodedHeader");
            var output = factory(new object[] { 6 });

            Assert.IsTrue(output.Headers.Contains("User-Agent"), "Headers include User-Agent header");
            Assert.AreEqual("RefitTestClient", output.Headers.UserAgent.ToString());
            Assert.IsTrue(output.Headers.Contains("Api-Version"), "Headers include Api-Version header");
            Assert.AreEqual("", output.Headers.GetValues("Api-Version").Single());
        }
        [Test]
        public void NullHardcodedHeadersShouldNotBeInHeaders()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("FetchSomeStuffWithNullHardcodedHeader");
            var output = factory(new object[] { 6 });

            Assert.IsTrue(output.Headers.Contains("User-Agent"), "Headers include User-Agent header");
            Assert.AreEqual("RefitTestClient", output.Headers.UserAgent.ToString());
            Assert.IsFalse(output.Headers.Contains("Api-Version"), "Headers include Api-Version header");
        }

        [Test]
        public void ContentHeadersCanBeHardcoded()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("PostSomeStuffWithHardCodedContentTypeHeader");
            var output = factory(new object[] { 6, "stuff" });

            Assert.IsTrue(output.Content.Headers.Contains("Content-Type"), "Content headers include Content-Type header");
            Assert.AreEqual("literally/anything", output.Content.Headers.ContentType.ToString());
        }

        [Test]
        public void DynamicHeaderShouldBeInHeaders()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("FetchSomeStuffWithDynamicHeader");
            var output = factory(new object[] { 6, "Basic RnVjayB5ZWFoOmhlYWRlcnMh" });

            Assert.IsNotNull(output.Headers.Authorization, "Headers include Authorization header");
            Assert.AreEqual("RnVjayB5ZWFoOmhlYWRlcnMh", output.Headers.Authorization.Parameter);
        }

        [Test]
        public void CustomDynamicHeaderShouldBeInHeaders()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("FetchSomeStuffWithCustomHeader");
            var output = factory(new object[] { 6, ":joy_cat:" });

            Assert.IsTrue(output.Headers.Contains("X-Emoji"), "Headers include X-Emoji header");
            Assert.AreEqual(":joy_cat:", output.Headers.GetValues("X-Emoji").First());
        }

        [Test]
        public void EmptyDynamicHeaderShouldBeInHeaders()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("FetchSomeStuffWithCustomHeader");
            var output = factory(new object[] { 6, "" });

            Assert.IsTrue(output.Headers.Contains("X-Emoji"), "Headers include X-Emoji header");
            Assert.AreEqual("", output.Headers.GetValues("X-Emoji").First());
        }

        [Test]
        public void NullDynamicHeaderShouldNotBeInHeaders()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("FetchSomeStuffWithDynamicHeader");
            var output = factory(new object[] { 6, null });

            Assert.IsNull(output.Headers.Authorization, "Headers include Authorization header");
        }

        [Test]
        public void AddCustomHeadersToRequestHeadersOnly()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("PostSomeStuffWithCustomHeader");
            var output = factory(new object[] { 6, new { Foo = "bar" }, ":smile_cat:" });

            Assert.IsTrue(output.Headers.Contains("Api-Version"), "Headers include Api-Version header");
            Assert.IsTrue(output.Headers.Contains("X-Emoji"), "Headers include X-Emoji header");
            Assert.IsFalse(output.Content.Headers.Contains("Api-Version"), "Content headers include Api-Version header");
            Assert.IsFalse(output.Content.Headers.Contains("X-Emoji"), "Content headers include X-Emoji header");
        }

        [Test]
        public void HttpClientShouldPrefixedAbsolutePathToTheRequestUri()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRestResultFuncForMethod("FetchSomeStuffWithoutFullPath");
            var testHttpMessageHandler = new TestHttpMessageHandler();

            var task = (Task)factory(new HttpClient(testHttpMessageHandler) { BaseAddress = new Uri("http://api/foo/bar") }, new object[0]);
            task.Wait();

            Assert.AreEqual("http://api/foo/bar/string", testHttpMessageHandler.RequestMessage.RequestUri.ToString());
        }

        [Test]
        public void HttpClientForVoidMethodShouldPrefixedAbsolutePathToTheRequestUri()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRestResultFuncForMethod("FetchSomeStuffWithVoid");
            var testHttpMessageHandler = new TestHttpMessageHandler();

            var task = (Task)factory(new HttpClient(testHttpMessageHandler) { BaseAddress = new Uri("http://api/foo/bar") }, new object[0]);
            task.Wait();

            Assert.AreEqual("http://api/foo/bar/void", testHttpMessageHandler.RequestMessage.RequestUri.ToString());
        }

        [Test]
        public void HttpClientShouldNotPrefixEmptyAbsolutePathToTheRequestUri()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRestResultFuncForMethod("FetchSomeStuff");
            var testHttpMessageHandler = new TestHttpMessageHandler();

            var task = (Task)factory(new HttpClient(testHttpMessageHandler) { BaseAddress = new Uri("http://api/") }, new object[] { 42 });
            task.Wait();

            Assert.AreEqual("http://api/foo/bar/42", testHttpMessageHandler.RequestMessage.RequestUri.ToString());
        }

        [Test]
        public void DontBlowUpWithDynamicAuthorizationHeaderAndContent()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("PutSomeContentWithAuthorization");
            var output = factory(new object[] { 7, new { Octocat = "Dunetocat" }, "Basic RnVjayB5ZWFoOmhlYWRlcnMh" });

            Assert.IsNotNull(output.Headers.Authorization, "Headers include Authorization header");
            Assert.AreEqual("RnVjayB5ZWFoOmhlYWRlcnMh", output.Headers.Authorization.Parameter);
        }

        [Test]
        public void SuchFlexibleContentTypeWow()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("PutSomeStuffWithDynamicContentType");
            var output = factory(new object[] { 7, "such \"refit\" is \"amaze\" wow", "text/dson" });

            Assert.IsNotNull(output.Content, "Request has content");
            Assert.IsNotNull(output.Content.Headers.ContentType, "Headers include Content-Type header");
            Assert.AreEqual("text/dson", output.Content.Headers.ContentType.MediaType, "Content-Type header has the expected value");
        }

        [Test]
        public async Task BodyContentGetsUrlEncoded()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("PostSomeUrlEncodedStuff");
            var output = factory(
                new object[] {
                    6,
                    new {
                        Foo = "Something",
                        Bar = 100,
                        Baz = default(string)
                    }
                });

            string content = await output.Content.ReadAsStringAsync();

            Assert.AreEqual("Foo=Something&Bar=100&Baz=", content);
        }

        [Test]
        public async Task FormFieldGetsAliased()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("PostSomeAliasedUrlEncodedStuff");
            var output = factory(
                new object[] {
                    6,
                    new SomeRequestData {
                        ReadablePropertyName = 99
                    }
                });

            string content = await output.Content.ReadAsStringAsync();

            Assert.AreEqual("rpn=99", content);
        }

        [Test]
        public async Task CustomParmeterFormatter()
        {
            var settings = new RefitSettings { UrlParameterFormatter = new TestUrlParameterFormatter("custom-parameter") };
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi), settings);

            var factory = fixture.BuildRequestFactoryForMethod("FetchSomeStuff");
            var output = factory(new object[] { 5 });

            var uri = new Uri(new Uri("http://api"), output.RequestUri);
            Assert.AreEqual("/foo/bar/custom-parameter", uri.PathAndQuery);
        }

        [Test]
        public async Task ICanPostAValueTypeIfIWantYoureNotTheBossOfMe()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("PostAValueType");
            var guid = Guid.NewGuid();
            var expected = string.Format("\"{0}\"", guid);
            var output = factory(new object[] { 7, guid });

            var content = await output.Content.ReadAsStringAsync();

            Assert.AreEqual(expected, content);
        }

        [Test]
        public async Task SupportPATCHMethod()
        {
            var fixture = new RequestBuilderImplementation(typeof(IDummyHttpApi));
            var factory = fixture.BuildRequestFactoryForMethod("PatchSomething");
            var output = factory(new object[] { "testData" });

            Assert.AreEqual("PATCH", output.Method.Method);
        }
    }
}


text:
package org.neo4j.jdbc;

import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

/**
 * Implementation of PreparedStatement. Parameters in Cypher queries have to be done as {nr}, as calls to methods
 * here will be saved in a parameter map with "nr"->value, since JDBC does not support named parameters.
 */
public class Neo4jPreparedStatement extends AbstractPreparedStatement
{
    private String query;
    private Map<String, Object> parameters = new HashMap<String, Object>();

    public Neo4jPreparedStatement( Neo4jConnection connection, String query )
    {
        super( connection );
        this.query = query;
    }

    @Override
    public ResultSet executeQuery() throws SQLException
    {
        resultSet = connection.executeQuery( query, parameters );
        return resultSet;
    }

    @Override
    public boolean execute() throws SQLException
    {
        resultSet = connection.executeQuery( query, parameters );
        return true;
    }

    @Override
    public int executeUpdate() throws SQLException
    {
        resultSet = connection.executeQuery( query, parameters );
        while ( resultSet.next() )
        {
            ;
        }
        return 0; // todo
    }

    private void add( int parameterIndex, Object value )
    {
        parameters.put( Integer.toString( parameterIndex ), value );
    }

    @Override
    public ResultSetMetaData getMetaData() throws SQLException
    {
        if ( resultSet == null )
        {
            execute();
        }

        return resultSet.getMetaData();
    }

    @Override
    public void setNull( int parameterIndex, int sqlType ) throws SQLException
    {
        add( parameterIndex, null );
        // todo is that the correct behaviour for cypher ?
        // parameters.remove(Integer.toString(parameterIndex));
    }

    @Override
    public void setBoolean( int parameterIndex, boolean value ) throws SQLException
    {
        add( parameterIndex, value );
    }

    @Override
    public void setByte( int parameterIndex, byte value ) throws SQLException
    {
        add( parameterIndex, value );
    }

    @Override
    public void setShort( int parameterIndex, short value ) throws SQLException
    {
        add( parameterIndex, value );
    }

    @Override
    public void setInt( int parameterIndex, int value ) throws SQLException
    {
        add( parameterIndex, value );
    }

    @Override
    public void setLong( int parameterIndex, long value ) throws SQLException
    {
        add( parameterIndex, value );
    }

    @Override
    public void setFloat( int parameterIndex, float value ) throws SQLException
    {
        add( parameterIndex, value );
    }

    @Override
    public void setDouble( int parameterIndex, double value ) throws SQLException
    {
        add( parameterIndex, value );
    }

    @Override
    public void setBigDecimal( int parameterIndex, BigDecimal value ) throws SQLException
    {
        add( parameterIndex, value );
    }

    @Override
    public void setString( int parameterIndex, String value ) throws SQLException
    {
        add( parameterIndex, value );
    }

    @Override
    public void setBytes( int parameterIndex, byte[] value ) throws SQLException
    {
        add( parameterIndex, value );
    }

    @Override
    public void clearParameters() throws SQLException
    {
        parameters.clear();
    }

    @Override
    public void setObject( int parameterIndex, Object value, int targetSqlType ) throws SQLException
    {
        add( parameterIndex, value );
    }

    @Override
    public void setObject( int parameterIndex, Object value ) throws SQLException
    {
        add( parameterIndex, value );
    }

    @Override
    public void setNull( int parameterIndex, int sqlType, String typeName ) throws SQLException
    {
        add( parameterIndex, null );
        // parameters.remove(Integer.toString(parameterIndex));
    }

    @Override
    public void setObject( int parameterIndex, Object value, int targetSqlType, int scaleOrLength ) throws SQLException
    {
        add( parameterIndex, value );
    }
}


text:
/* eslint quote-props:0 */

export default {
  toggleConnectDialog: index => ({
    type: `TOGGLE_CONNECT_DIALOG`,
    index,
  }),

  toggleChangePassDialog: () => ({
    type: `TOGGLE_CHANGEPASS_DIALOG`,
  }),

  connectPasswordChange: value => ({
    type: `CONNECT_PASSWORD_VALUE_CHANGED`,
    value,
  }),

  checkForceConnect: value => ({
    type: `CONNECT_FORCE_CHECKED`,
    value,
  }),

  changePassFieldChange: (fieldName, value) => ({
    type: `CHANGEPASS_VALUE_CHANGED`,
    fieldName,
    value,
  }),

  rescan: () => ({
    types: [
      `RESCAN_REQUEST`,
      `RESCAN_SUCCESS`,
      `RESCAN_ERROR`,
    ],

    promiseProducer: (store) => {
      const token = store.getState().jwt;

      return fetch(`api/access_points`, {
        method: `GET`,
        headers: {
          'Authorization': `Bearer ${token}`,
          'Accept': `application/json`,
        },
      }).then((res) => {
        if (!res.ok) {
          return res.json().then(json =>
            Promise.reject({
              message: json.message,
              status: res.status,
            }));
        }

        return res.json();
      });
    },
  }),

  getActiveConnections: () => ({
    types: [
      `ACTIVECONNECTION_REQUEST`,
      `ACTIVECONNECTION_SUCCESS`,
      `ACTIVECONNECTION_ERROR`,
    ],

    promiseProducer: store =>
      fetch(`api/wifi_active_connections`, {
        headers: {
          'Authorization': `Bearer ${store.getState().jwt}`,
          'Accept': `application/json`,
        },
      })
      .then((res) => {
        if (!res.ok) {
          return res.json().then(json =>
            Promise.reject({
              message: json.message,
              status: res.status,
            }));
        }

        return res.json();
      }),
  }),

  connectWifi: () => ({
    types: [
      `CONNECTWIFI_REQUEST`,
      `CONNECTWIFI_SUCCESS`,
      `CONNECTWIFI_ERROR`,
    ],

    promiseProducer: (store) => {
      const state = store.getState();
      const body = JSON.stringify({
        ssid: state.connect.ssidValue,
        password: state.connect.password,
        force: state.connect.force,
      });

      return fetch(`api/connect`, {
        method: `POST`,
        headers: {
          'Content-Type': `application/json`,
          'Authorization': `Bearer ${store.getState().jwt}`,
          'Accept': `application/json`,
        },
        body,
      })
      .then((res) => {
        if (!res.ok) {
          return res.json().then(json =>
            Promise.reject({
              message: json.message,
              status: res.status,
            }));
        }

        return res.json();
      });
    },
  }),

  disconnect: iface => ({
    types: [
      `DISCONNECT_REQUEST`,
      `DISCONNECT_SUCCESS`,
      `DISCONNECT_ERROR`,
    ],

    promiseProducer: (store) => {
      const body = JSON.stringify({
        iface,
      });

      return fetch(`/api/disconnect`, {
        method: `POST`,
        headers: {
          'Content-Type': `application/json`,
          'Authorization': `Bearer ${store.getState().jwt}`,
          'Accept': `application/json`,
        },
        body,
      })
      .then((res) => {
        if (!res.ok) {
          return res.json().then(json =>
            Promise.reject({
              message: json.message,
              status: res.status,
            }));
        }

        return res.json();
      });
    },
  }),

  logout: () => ({
    type: `LOGOUT`,
  }),

  loginFormFieldChange: (fieldName, value) => ({
    type: `LOGINFORM_FIELD_CHANGE`,
    fieldName,
    value,
  }),

  loginFormSubmit: () => ({
    types: [
      `LOGIN_REQUEST`,
      `LOGIN_SUCCESS`,
      `LOGIN_ERROR`,
    ],

    promiseProducer: (store) => {
      const { username, password } = store.getState().login;
      const body = JSON.stringify({ username, password });

      if (!username || !password) {
        return Promise.reject({
          message: `Username & password must not be empty!`,
        });
      }

      return fetch(`/api/login`, {
        method: `POST`,
        headers: {
          'Content-Type': `application/json`,
          'Accept': `application/json`,
        },
        body,
      })
      .then((res) => {
        if (!res.ok) {
          return res.json().then(json =>
            Promise.reject({
              message: json.message,
              status: res.status,
            }));
        }

        return res.json();
      });
    },
  }),

  closeSnackbar: () => ({
    type: `CLOSE_SNACKBAR`,
  }),

  changePassword: () => ({
    types: [
      `CHANGEPASS_REQUEST`,
      `CHANGEPASS_SUCCESS`,
      `CHANGEPASS_ERROR`,
    ],

    promiseProducer: (store) => {
      const { oldPassword, newPassword, confirmNewPassword } = store.getState().changePassword;
      const body = JSON.stringify({ oldPassword, newPassword, confirmNewPassword });

      if (!oldPassword || !newPassword || !confirmNewPassword) {
        return Promise.reject({
          message: `All field must not be empty!`,
        });
      }

      if (newPassword !== confirmNewPassword) {
        return Promise.reject({
          message: `New password & confirm password do not match`,
        });
      }

      return fetch(`/api/change_pass`, {
        method: `POST`,
        headers: {
          'Content-Type': `application/json`,
          'Accept': `application/json`,
          'Authorization': `Bearer ${store.getState().jwt}`,
        },
        body,
      })
      .then((res) => {
        if (!res.ok) {
          return res.json().then(json =>
            Promise.reject({
              message: json.message,
              status: res.status,
            }));
        }

        return res.json();
      });
    },
  }),
};