text:
app.service("analyticsService", function($window, config) {
  this.recordSearchEvent = function(query, type, status, latency) {
    this.recordEvent_("search", type, status, latency);
    if (status != "200") {
      this.recordEvent_("search_error", type, query);
    }
  };

  this.recordException = function(name, message) {
    this.recordEvent_("exception", name, message, 1);
  };

  this.recordGenerateDeckEvent = function(status, latency) {
    this.recordEvent_("generate_deck", status, "", latency);
  };

  this.recordEvent_ = function(category, action, label, value) {
    if (config.ENVIRONMENT == "PROD") {
      $window.ga("send", "event", category, action, label, value);
    } else {
      $window.console.log("Skipped recording event. Category: " + category +
          ". Action: " + action + ". Label: " + label + ". Value: " + value);
    }
  }
});


text:
if is_mac; then
  test -s $(brew --prefix asdf)/asdf.sh && source $(brew --prefix asdf)/asdf.sh
fi

redpajama_set_name: RedPajamaGithub


text:
require "spec_helper"

describe Mongoid::Criteria::Queryable::Selector do

  describe "merge!" do

    let(:selector) do
      described_class.new
    end

    context "when selector is nested" do

      before do
        selector[:field] = selection
        selector.merge!(other)
      end

      let(:selection) do
        { "$lt" => 50 }
      end

      context "when other contains same key with a hash" do

        let(:other) do
          { "field" => { "$gt" => 20 } }
        end

        it "deep merges" do
          expect(selector['field']).to eq({"$lt"=>50, "$gt" => 20})
        end
      end

      context "when other contains same key without hash" do

        let(:other) do
          { "field" => 10 }
        end

        it "merges" do
          expect(selector['field']).to eq(10)
        end
      end
    end

    context "when selector contains a $nin" do

      let(:initial) do
        { "$nin" => ["foo"] }
      end

      before do
        selector["field"] = initial
      end

      context "when merging in a new $nin" do

        let(:other) do
          { "field" => { "$nin" => ["bar"] } }
        end

        before do
          selector.merge!(other)
        end

        it "combines the two $nin queries into one" do
          expect(selector).to eq({
            "field" => { "$nin" => ["foo", "bar"] }
          })
        end
      end
    end

    context "when selector contains a $in" do

      let(:initial) do
        { "$in" => [1, 2] }
      end

      before do
        selector["field"] = initial
      end

      context "when merging in a new $in with an intersecting value" do

        let(:other) do
          { "field" => { "$in" => [1] } }
        end

        before do
          selector.merge!(other)
        end

        it "intersects the $in values" do
          expect(selector).to eq({
                                     "field" => { "$in" => [1] }
                                 })
        end
      end

      context "when merging in a new $in with no intersecting values" do

        let(:other) do
          { "field" => { "$in" => [3] } }
        end

        before do
          selector.merge!(other)
        end

        it "intersects the $in values" do
          expect(selector).to eq({
                                     "field" => { "$in" => [] }
                                 })
        end
      end
    end

    context "when selector is not nested" do

      before do
        selector[:field] = selection
        selector.merge!(other)
      end

      let(:selection) do
        50
      end

      let(:other) do
        { "field" => { "$gt" => 20 } }
      end

      it "merges" do
        expect(selector['field']).to eq({ "$gt" => 20 })
      end
    end

    context 'when an object does not support the | operator' do

      before do
        selector['start'] = selection
        selector.merge!(other)
      end

      let(:selection) do
        { '$lt' => Time.now }
      end

      let(:other) do
        { 'start' => selection, 'name' => 'test',  }
      end

      it "merges" do
        expect(selector['name']).to eq('test')
        expect(selector['start']).to eq(selection)
      end
    end

    context "when the selector contains an $or" do

      let(:initial) do
        [{ "value" => 1 }]
      end

      before do
        selector["$or"] = initial
      end

      context "when merging in a new $or" do

        let(:other) do
          [{ "value" => 2 }]
        end

        before do
          selector.merge!({ "$or" => other })
        end

        it "combines the two $or queries into one" do
          expect(selector).to eq({
            "$or" => [{ "value" => 1 }, { "value" => 2 }]
          })
        end
      end
    end

    context "when the selector contains an $and" do

      let(:initial) do
        [{ "value" => 1 }]
      end

      before do
        selector["$and"] = initial
      end

      context "when merging in a new $and" do

        let(:other) do
          [{ "value" => 2 }]
        end

        before do
          selector.merge!({ "$and" => other })
        end

        it "combines the two $and queries into one" do
          expect(selector).to eq({
            "$and" => [{ "value" => 1 }, { "value" => 2 }]
          })
        end
      end
    end

    context "when the selector contains a $nor" do

      let(:initial) do
        [{ "value" => 1 }]
      end

      before do
        selector["$nor"] = initial
      end

      context "when merging in a new $nor" do

        let(:other) do
          [{ "value" => 2 }]
        end

        before do
          selector.merge!({ "$nor" => other })
        end

        it "combines the two $nor queries into one" do
          expect(selector).to eq({
            "$nor" => initial + other
          })
        end
      end
    end
  end

  describe "#__deep_copy__" do

    let(:value) do
      [ 1, 2, 3 ]
    end

    let(:selection) do
      { "$in" => value }
    end

    let(:selector) do
      described_class.new
    end

    before do
      selector[:field] = selection
    end

    let(:cloned) do
      selector.__deep_copy__
    end

    it "returns an equal copy" do
      expect(cloned).to eq(selector)
    end

    it "performs a deep copy" do
      expect(cloned["field"]).to_not equal(selection)
    end

    it "clones n levels deep" do
      expect(cloned["field"]["$in"]).to_not equal(value)
    end
  end

  [ :store, :[]= ].each do |method|

    describe "##{method}" do

      context "when aliases are provided" do

        context "when the alias has no serializer" do

          let(:selector) do
            described_class.new({ "id" => "_id" })
          end

          before do
            selector.send(method, "id", 1)
          end

          it "stores the field in the selector by database name" do
            expect(selector["_id"]).to eq(1)
          end
        end

        context "when the alias has a serializer" do

          before(:all) do
            class Field
              def evolve(object)
                Integer.evolve(object)
              end

              def localized?
                false
              end
            end
          end

          after(:all) do
            Object.send(:remove_const, :Field)
          end

          let(:selector) do
            described_class.new(
              { "id" => "_id" }, { "_id" => Field.new }
            )
          end

          it "stores the serialized field in the selector by database name" do
            selector.send(method, "id", "1")
            expect(selector["_id"]).to eq(1)
          end

          it "stores the serialized field when selector is deeply nested" do
            selector.send(method, "$or", [{'$and' => [{'_id' => '5'}]}])
            expect(selector['$or'][0]['$and'][0]['_id']).to eq(5)
          end
        end
      end

      context "when no serializers are provided" do

        let(:selector) do
          described_class.new
        end

        context "when provided a standard object" do

          context "when the keys are strings" do

            it "does not serialize values" do
              expect(selector.send(method, "key", "5")).to eq("5")
            end
          end

          context "when the keys are symbols" do

            it "does not serialize values" do
              expect(selector.send(method, :key, "5")).to eq("5")
            end
          end
        end

        context "when provided a range" do

          before do
            selector.send(method, "key", 1..3)
          end

          it "serializes the range" do
            expect(selector["key"]).to eq({ "$gte" => 1, "$lte" => 3 })
          end
        end

        context "when providing an array" do

          let(:big_one) do
            BigDecimal.new("1.2321")
          end

          let(:big_two) do
            BigDecimal.new("4.2222")
          end

          let(:array) do
            [ big_one, big_two ]
          end

          before do
            selector.send(method, "key", array)
          end

          it "serializes each element in the array" do
            expect(selector["key"]).to eq([ big_one.to_s, big_two.to_s ])
          end
        end
      end

      context "when serializers are provided" do

        context "when the serializer is not localized" do

          before(:all) do
            class Field
              def evolve(object)
                Integer.evolve(object)
              end

              def localized?
                false
              end
            end
          end

          after(:all) do
            Object.send(:remove_const, :Field)
          end

          let(:selector) do
            described_class.new({}, { "key" => Field.new })
          end

          context "when the criterion is simple" do

            context "when the key is a string" do

              before do
                selector.send(method, "key", "5")
              end

              it "serializes the value" do
                expect(selector["key"]).to eq(5)
              end
            end

            context "when the key is a symbol" do

              before do
                selector.send(method, :key, "5")
              end

              it "serializes the value" do
                expect(selector["key"]).to eq(5)
              end
            end
          end

          context "when the criterion is complex" do

            context "when the field name is the key" do

              context "when the criterion is an array" do

                context "when the key is a string" do

                  before do
                    selector.send(method, "key", [ "1", "2" ])
                  end

                  it "serializes the value" do
                    expect(selector["key"]).to eq([ 1, 2 ])
                  end
                end

                context "when the key is a symbol" do

                  before do
                    selector.send(method, :key, [ "1", "2" ])
                  end

                  it "serializes the value" do
                    expect(selector["key"]).to eq([ 1, 2 ])
                  end
                end
              end

              context "when the criterion is a hash" do

                context "when the value is non enumerable" do

                  context "when the key is a string" do

                    before do
                      selector.send(method, "key", { "$gt" => "5" })
                    end

                    it "serializes the value" do
                      expect(selector["key"]).to eq({ "$gt" => 5 })
                    end
                  end

                  context "when the key is a symbol" do

                    before do
                      selector.send(method, :key, { "$gt" => "5" })
                    end

                    it "serializes the value" do
                      expect(selector["key"]).to eq({ "$gt" => 5 })
                    end
                  end
                end

                context "when the value is enumerable" do

                  context "when the key is a string" do

                    before do
                      selector.send(method, "key", { "$in" => [ "1", "2" ] })
                    end

                    it "serializes the value" do
                      expect(selector["key"]).to eq({ "$in" => [ 1, 2 ] })
                    end
                  end

                  context "when the key is a symbol" do

                    before do
                      selector.send(method, :key, { "$in" => [ "1", "2" ] })
                    end

                    it "serializes the value" do
                      expect(selector["key"]).to eq({ "$in" => [ 1, 2 ] })
                    end
                  end
                end

                [ "$and", "$or" ].each do |operator|

                  context "when the criterion is a #{operator}" do

                    context "when the individual criteria are simple" do

                      context "when the keys are strings" do

                        before do
                          selector.send(method, operator, [{ "key" => "1" }])
                        end

                        it "serializes the values" do
                          expect(selector[operator]).to eq([{ "key" => 1 }])
                        end
                      end

                      context "when the keys are symbols" do

                        before do
                          selector.send(method, operator, [{ key: "1" }])
                        end

                        it "serializes the values" do
                          expect(selector[operator]).to eq([{ "key" => 1 }])
                        end
                      end
                    end

                    context "when the individual criteria are complex" do

                      context "when the keys are strings" do

                        before do
                          selector.send(
                            method,
                            operator,
                            [{ "field" => "1" }, { "key" => { "$gt" => "2" }}]
                          )
                        end

                        it "serializes the values" do
                          expect(selector[operator]).to eq(
                            [{ "field" => "1" }, { "key" => { "$gt" => 2 }}]
                          )
                        end
                      end

                      context "when the keys are symbols" do

                        before do
                          selector.send(
                            method,
                            operator,
                            [{ field: "1" }, { key: { "$gt" => "2" }}]
                          )
                        end

                        it "serializes the values" do
                          expect(selector[operator]).to eq(
                            [{ "field" => "1" }, { "key" => { "$gt" => 2 }}]
                          )
                        end
                      end
                    end
                  end
                end
              end
            end
          end
        end

        context "when the serializer is localized" do

          before(:all) do
            class Field
              def evolve(object)
                Integer.evolve(object)
              end

              def localized?
                true
              end
            end
          end

          after(:all) do
            Object.send(:remove_const, :Field)
            ::I18n.locale = :en
          end

          let(:selector) do
            described_class.new({}, { "key" => Field.new })
          end

          before do
            ::I18n.locale = :de
          end

          context "when the criterion is simple" do

            context "when the key is a string" do

              before do
                selector.send(method, "key", "5")
              end

              it "serializes the value" do
                expect(selector["key.de"]).to eq(5)
              end
            end

            context "when the key is a symbol" do

              before do
                selector.send(method, :key, "5")
              end

              it "serializes the value" do
                expect(selector["key.de"]).to eq(5)
              end
            end
          end

          context "when the criterion is complex" do

            context "when the field name is the key" do

              context "when the criterion is an array" do

                context "when the key is a string" do

                  before do
                    selector.send(method, "key", [ "1", "2" ])
                  end

                  it "serializes the value" do
                    expect(selector["key.de"]).to eq([ 1, 2 ])
                  end
                end

                context "when the key is a symbol" do

                  before do
                    selector.send(method, :key, [ "1", "2" ])
                  end

                  it "serializes the value" do
                    expect(selector["key.de"]).to eq([ 1, 2 ])
                  end
                end
              end

              context "when the criterion is a hash" do

                context "when the value is non enumerable" do

                  context "when the key is a string" do

                    let(:hash) do
                      { "$gt" => "5" }
                    end

                    before do
                      selector.send(method, "key", hash)
                    end

                    it "serializes the value" do
                      expect(selector["key.de"]).to eq({ "$gt" => 5 })
                    end

                    it "sets the same hash instance" do
                      expect(selector["key.de"]).to equal(hash)
                    end
                  end

                  context "when the key is a symbol" do

                    before do
                      selector.send(method, :key, { "$gt" => "5" })
                    end

                    it "serializes the value" do
                      expect(selector["key.de"]).to eq({ "$gt" => 5 })
                    end
                  end
                end

                context "when the value is enumerable" do

                  context "when the key is a string" do

                    before do
                      selector.send(method, "key", { "$in" => [ "1", "2" ] })
                    end

                    it "serializes the value" do
                      expect(selector["key.de"]).to eq({ "$in" => [ 1, 2 ] })
                    end
                  end

                  context "when the key is a symbol" do

                    before do
                      selector.send(method, :key, { "$in" => [ "1", "2" ] })
                    end

                    it "serializes the value" do
                      expect(selector["key.de"]).to eq({ "$in" => [ 1, 2 ] })
                    end
                  end
                end

                [ "$and", "$or" ].each do |operator|

                  context "when the criterion is a #{operator}" do

                    context "when the individual criteria are simple" do

                      context "when the keys are strings" do

                        before do
                          selector.send(method, operator, [{ "key" => "1" }])
                        end

                        it "serializes the values" do
                          expect(selector[operator]).to eq([{ "key.de" => 1 }])
                        end
                      end

                      context "when the keys are symbols" do

                        before do
                          selector.send(method, operator, [{ key: "1" }])
                        end

                        it "serializes the values" do
                          expect(selector[operator]).to eq([{ "key.de" => 1 }])
                        end
                      end
                    end

                    context "when the individual criteria are complex" do

                      context "when the keys are strings" do

                        before do
                          selector.send(
                            method,
                            operator,
                            [{ "field" => "1" }, { "key" => { "$gt" => "2" }}]
                          )
                        end

                        it "serializes the values" do
                          expect(selector[operator]).to eq(
                            [{ "field" => "1" }, { "key.de" => { "$gt" => 2 }}]
                          )
                        end
                      end

                      context "when the keys are symbols" do

                        before do
                          selector.send(
                            method,
                            operator,
                            [{ field: "1" }, { key: { "$gt" => "2" }}]
                          )
                        end

                        it "serializes the values" do
                          expect(selector[operator]).to eq(
                            [{ "field" => "1" }, { "key.de" => { "$gt" => 2 }}]
                          )
                        end
                      end
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
  end

  describe "#to_pipeline" do

    let(:selector) do
      described_class.new
    end

    context "when the selector is empty" do

      let(:pipeline) do
        selector.to_pipeline
      end

      it "returns an empty array" do
        expect(pipeline).to be_empty
      end
    end

    context "when the selector is not empty" do

      before do
        selector["name"] = "test"
      end

      let(:pipeline) do
        selector.to_pipeline
      end

      it "returns the selector in a $match entry" do
        expect(pipeline).to eq([{ "$match" => { "name" => "test" }}])
      end
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
 ConnectBot: simple, powerful, open-source SSH client for Android
 Copyright 2007 Kenny Root, Jeffrey Sharkey

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          android:versionName="1.7.1-irssi"
          android:versionCode="393"
          android:installLocation="auto"
          package="org.woltage.irssiconnectbot" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://schemas.android.com/apk/res/android ">

    <uses-sdk android:targetSdkVersion="16" android:minSdkVersion="3"/>

    <application
            android:icon="@drawable/icon"
            android:label="@string/app_name"
            android:description="@string/app_desc"
            android:allowBackup="true"
            android:backupAgent=".service.BackupAgent"
            android:killAfterRestore="true"
            android:hardwareAccelerated="false">
        <activity android:name=".HostListActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.CREATE_SHORTCUT"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.PICK"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:scheme="mosh"/>
                <data android:scheme="ssh"/>
                <data android:scheme="telnet"/>
                <data android:scheme="local"/>
            </intent-filter>
        </activity>

        <activity android:name=".PubkeyListActivity" android:configChanges="keyboardHidden|orientation"/>
        <activity android:name=".GeneratePubkeyActivity" android:configChanges="keyboardHidden|orientation"/>
        <activity android:name=".HostEditorActivity" android:configChanges="keyboardHidden|orientation"/>
        <activity android:name=".PortForwardListActivity" android:configChanges="keyboardHidden|orientation"/>
        <activity android:name=".SettingsActivity" android:configChanges="keyboardHidden|orientation"/>
        <activity android:name=".WizardActivity" android:configChanges="keyboardHidden|orientation"/>
        <activity android:name=".HelpActivity" android:configChanges="keyboardHidden|orientation"/>
        <activity android:name=".HelpTopicActivity" android:configChanges="keyboardHidden|orientation"/>
        <activity android:name=".ColorsActivity" android:configChanges="keyboardHidden|orientation"/>

        <service android:name="org.woltage.irssiconnectbot.service.TerminalManager"
                 android:configChanges="keyboardHidden|orientation"
                 android:description="@string/service_desc"/>

        <activity android:name=".ConsoleActivity" android:configChanges="keyboardHidden|orientation"
            android:theme="@style/NoTitle" android:windowSoftInputMode="stateAlwaysVisible|adjustResize"
                  android:launchMode="singleTop">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="mosh"/>
                <data android:scheme="ssh"/>
                <data android:scheme="telnet"/>
                <data android:scheme="local"/>
                <!-- format:  mosh://user@host:sshport/#nickname  -->
                <!-- format:  ssh://user@host:port/#nickname  -->
                <!-- format:  telnet://host:port/#nickname  -->
                <!-- format:  local://  -->
            </intent-filter>
        </activity>

        <meta-data android:name="com.google.android.backup.api_key"
                   android:value="AEdPqrEAAAAIKAr77lssJ1BDO2gPUVlnYipcfQIpp0vj0fjUYw"/>

    </application>

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <supports-screens/>
</manifest>


text:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

    <EditTextPreference android:title="@string/preference_server_address"
                        android:key="serverAddress"
                        android:dialogTitle="@string/preference_server_address"
                        android:defaultValue="@string/default_server_address"
                        android:inputType="textUri"
                        android:persistent="true" />

    <EditTextPreference android:title="@string/preference_server_port"
                        android:key="serverPort"
                        android:dialogTitle="@string/preference_server_port"
                        android:defaultValue="@string/default_server_port"
                        android:inputType="number"
                        android:persistent="true" />

    <Preference android:title="@string/preference_save" android:key="save" />

</PreferenceScreen>


text:
#include "xenia/base/mapped_memory.h"

#include <sys/mman.h>
#include <cstdio>
#include <memory>

#include "xenia/base/string.h"

namespace xe {

class PosixMappedMemory : public MappedMemory {
 public:
  PosixMappedMemory(const std::filesystem::path& path, Mode mode)
      : MappedMemory(path, mode), file_handle(nullptr) {}

  ~PosixMappedMemory() override {
    if (data_) {
      munmap(data_, size_);
    }
    if (file_handle) {
      fclose(file_handle);
    }
  }

  FILE* file_handle;
};

std::unique_ptr<MappedMemory> MappedMemory::Open(
    const std::filesystem::path& path, Mode mode, size_t offset,
    size_t length) {
  const char* mode_str;
  int prot;
  switch (mode) {
    case Mode::kRead:
      mode_str = "rb";
      prot = PROT_READ;
      break;
    case Mode::kReadWrite:
      mode_str = "r+b";
      prot = PROT_READ | PROT_WRITE;
      break;
  }

  auto mm =
      std::unique_ptr<PosixMappedMemory>(new PosixMappedMemory(path, mode));

  mm->file_handle = fopen(path.c_str(), mode_str);
  if (!mm->file_handle) {
    return nullptr;
  }

  size_t map_length;
  map_length = length;
  if (!length) {
    fseeko(mm->file_handle, 0, SEEK_END);
    map_length = ftello(mm->file_handle);
    fseeko(mm->file_handle, 0, SEEK_SET);
  }
  mm->size_ = map_length;

  mm->data_ =
      mmap(0, map_length, prot, MAP_SHARED, fileno(mm->file_handle), offset);
  if (!mm->data_) {
    return nullptr;
  }

  return std::move(mm);
}

std::unique_ptr<ChunkedMappedMemoryWriter> ChunkedMappedMemoryWriter::Open(
    const std::filesystem::path& path, size_t chunk_size,
    bool low_address_space) {
  // TODO(DrChat)
  return nullptr;
}

}  // namespace xe


text:
using System;

namespace InOrderPostOrder
{
    class Program
    {
        static void Main(string[] args)
        {
            Tree myTree = new Tree(1)
            {
                Left = new Tree(2)
                {
                    Left = new Tree(3),
                    Right = new Tree(4)
                },
                Right = new Tree(5)
                {
                    Left = new Tree(6),
                    Right = new Tree(7)
                }
            };

            //Pre Order Traversal
            Console.WriteLine("Pre-Order Traversal:");
            myTree.PreOrderTraversal();

            //In Order Traversal
            Console.WriteLine("In-Order Traversal:");
            myTree.InOrderTraversal();

            //Post Order Traversal
            Console.WriteLine("Post-Order Traversal:");
            myTree.PostOrderTraversal();
            Console.Read();
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~  Copyright © 2017-2019 Cask Data, Inc.
  ~
  ~  Licensed under the Apache License, Version 2.0 (the "License"); you may not
  ~  use this file except in compliance with the License. You may obtain a copy of
  ~  the License at
  ~
  ~  http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~  Unless required by applicable law or agreed to in writing, software
  ~  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  ~  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  ~  License for the specific language governing permissions and limitations under
  ~  the License.
  -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <parent>
    <artifactId>wrangler</artifactId>
    <groupId>io.cdap.wrangler</groupId>
    <version>4.9.0-SNAPSHOT</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>wrangler-test</artifactId>
  <name>Wrangler Testing Framework</name>

  <dependencies>
    <dependency>
      <groupId>io.cdap.wrangler</groupId>
      <artifactId>wrangler-core</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.cdap.cdap</groupId>
      <artifactId>cdap-api</artifactId>
      <version>${cdap.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.cdap.cdap</groupId>
      <artifactId>cdap-etl-api</artifactId>
      <version>${cdap.version}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

</project>


text:
import unittest

import torch
from parameterized import parameterized

from monai.networks.layers import DropPath

TEST_CASES = [
    [{"drop_prob": 0.0, "scale_by_keep": True}, (1, 8, 8)],
    [{"drop_prob": 0.7, "scale_by_keep": False}, (2, 16, 16, 16)],
    [{"drop_prob": 0.3, "scale_by_keep": True}, (6, 16, 12)],
]

TEST_ERRORS = [[{"drop_prob": 2, "scale_by_keep": False}, (1, 24, 6)]]

class TestDropPath(unittest.TestCase):
    @parameterized.expand(TEST_CASES)
    def test_shape(self, input_param, input_shape):
        im = torch.rand(input_shape)
        dr_path = DropPath(**input_param)
        out = dr_path(im)
        self.assertEqual(out.shape, input_shape)

    @parameterized.expand(TEST_ERRORS)
    def test_ill_arg(self, input_param, input_shape):
        with self.assertRaises(ValueError):
            DropPath(**input_param)

if __name__ == "__main__":
    unittest.main()


text:
package com.unibeta.cloudtest.config;

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

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlValue;

@XmlRootElement(name = "testsuite")
public class TestSuite {

    @XmlAttribute
    public long errors = 0;
    @XmlAttribute
    public long failures = 0;
    @XmlAttribute
    public String hostname ="";
    @XmlAttribute
    public String name = "";
    @XmlAttribute
    public long tests = 0;
    @XmlAttribute
    public double time = 0.0;
    @XmlAttribute
    public String timestamp = "";

    @XmlElement(name = "property")
    @XmlElementWrapper (name = "properties")
    public List<Property> properties = new ArrayList<TestSuite.Property>();
    @XmlElement
    public Error error = new Error();

    public static class Property {

        @XmlAttribute
        public String name = "";
        @XmlAttribute
        public String value = "";
    }

    public static class Error {

        @XmlAttribute
        public String message = "";
        @XmlAttribute
        public String type = "";
        @XmlValue
        public String errorMessage = "";
    }
}


text:
namespace memhook {
  class NetworkMappedStorage : public MappedStorage {
  public:
    NetworkMappedStorage(const char *host, int port);
    ~NetworkMappedStorage();

    void Add(uintptr_t address, std::size_t memsize,
            const CallStackInfo &callstack,
            const chrono::system_clock::time_point &timestamp);
    bool Remove(uintptr_t address);
    bool UpdateSize(uintptr_t address, std::size_t memsize);
    void Clear();
    void Flush();
    std::string GetName() const;

  private:
    void Send(const NetRequest &request);

    std::string m_host;
    int         m_port;

    boost::asio::ip::tcp::iostream m_iostream;
    boost::asio::streambuf         m_sbuf;
    boost::mutex                   m_sbuf_mutex;
  };

  class NetworkMappedStorageCreator : public MappedStorageCreator {
  public:
      NetworkMappedStorageCreator(const char *host, int port);
      unique_ptr<MappedStorage> New(uintptr_t guide) const;

  private:
      std::string m_host;
      int m_port;
  };
}

#endif