text:
function registerTreeView(salix) {

	function node2stateMap(nodes, map) {
		for (var i = 0; i < nodes.length; i++) {
			var node = nodes[i];
			map[node.data.id] = {};
			for (var k in node.state) {
				if (node.state.hasOwnProperty(k)) {
					map[node.data.id][k] = node.state[k];
				}
			}
			if (node.nodes) {
				node2stateMap(node.nodes, map);
			}
		}
		return map;
	}

	function fromTreeNode(treeNodes, prevState) {
		var tree = [];
		for (var i = 0; i < treeNodes.length; i++) {
			var cur = treeNodes[i];
			var node = {text: cur.tree.text};
			node.data = {id: cur.tree.text};
			if (cur.tree.nodes) {
				node.nodes = fromTreeNode(cur.tree.nodes, prevState);
			}
			if (cur.tree.attrs) {
				var attrs = cur.tree.attrs;
				if (attrs.id) {
					node.data = {id: attrs.id};
				}
				for (var k in attrs) {
					if (attrs.hasOwnProperty(k)) {
						if (k === 'checked' || k === 'disabled' || k === 'expanded' || k === 'selected') {
							if (!node.state) {
								node.state = {checked: false, disabled: false, expanded: false, selected: false};
							}
							node.state[k] = Boolean(attrs[k]);
						}
						else {
							node[k] = attrs[k];
						}
					}
				}
			}
			if (prevState && prevState.hasOwnProperty(node.data.id)) {
				var myState = prevState[node.data.id];
				for (var k in myState) {
					if (myState.hasOwnProperty(k)) {
						if (!node.state) {
							node.state = {};
						}
						if (!node.state.hasOwnProperty(k)) {
							// if it's not set by the server...
							node.state[k] = myState[k];
						}
					}
				}
			}
			tree.push(node);
		}
		return tree;
	}

	salix.Decoders.node = function (args) {
		return function (event, node) {
			return {type: 'nodeId', node: node.data.id};
		}
	};

//	salix.Decoders.results = function (args) {
//		return function (event, nodes) {
//			var nodeIds = [];
//			for (var i = 0; i < nodes.length; i++) {
//				nodeIds.push(nodes[i].data.id);
//			}
//			return  {type: 'listOfNodeId', results: JSON.stringify(toTreeNodes(nodes))};
//		};
//	};

	function addEvents(jqElt, myHandlers, events) {
		for (var key in events) {
			if (events.hasOwnProperty(key)) {
				var handler = salix.getNativeHandler(events[key]);
				myHandlers[key] = handler;
				jqElt.on(key, handler);
			}
		}
	}

	function reinstallHandlers(jqElt, myHandlers) {
		for (var ev in myHandlers) {
			if (myHandlers.hasOwnProperty(ev)) {
				jqElt.on(ev, myHandlers[ev]);
			}
		}
	}

	function treeView(attach, id, attrs, props, events, extra) {
		var div = document.createElement('div');
		div.id = id;
		attach(div);

		// for remove event.
		var myHandlers = {};

		var treeNode = extra.data;
		var options = attrs;
		options.data = fromTreeNode(treeNode);
		var dom = '#' + id;
		$(dom).treeview(options);
		addEvents($(dom), myHandlers, events);

		function patch(edits, attach) {
			edits = edits || [];

			for (var i = 0; i < edits.length; i++) {
				var edit = edits[i];
				var type = salix.nodeType(edit);

				switch (type) {

				case 'setExtra':
					var oldNodes = [];
					var root = $(dom).treeview(true).getNode(0);
					oldNodes.push(root);
					var siblings = $(dom).treeview(true).getSiblings(root);
					oldNodes = oldNodes.concat(siblings);
					//console.log($(dom).treeview(true));
					options.data = fromTreeNode(edit[type].value, node2stateMap(oldNodes, {}));
					// PROBLEM: this resets expanded/selected/etc.
					// state. So this would suggest that we
					// *do* want a dedicate tree data type to be
					// used as (view) model of viewTree...
					// but it also means that we need to deal
					// with all events that change this state.
					// or we just copy the old state elements to the new one
					// since nodes have ids anyway.
					$(dom).treeview(options);
					reinstallHandlers($(dom), myHandlers);
					break;

				case 'setAttribute':
					options[edit[type].name] = edit[type].value;
					$(dom).treeview(options);
					reinstallHandlers($(dom), myHandlers);
					break;

				case 'removeAttribute':
					delete options[edit[type].name];
					$(dom).treeview(options);
					reinstallHandlers($(dom), myHandlers);
					break;

				case 'replace':
					salix.build(edit[type].html, attach);
					break;

				case 'setEvent':
					var key = edit[type].name;
					var handler = salix.getNativeHandler(edit[type].handler);
					myHandlers[key] = handler;
					$(dom).on(key, handler);
					break

				case 'removeEvent':
					var key = edit[type].name
					$(dom).off(key, myHandlers[key]);
					delete myHandlers[key];
					break;

				default:
					throw 'unsupported edit: ' + JSON.stringify(edit);

				}
			}
		}

		div.salix_native = {patch: patch};
	}

	function doCommand(cmd) {
		// TODO
	}

	salix.registerNative('treeView', treeView);
};


text:
namespace prefs {

extern const char kBookmarkEditorExpandedNodes[];
extern const char kEditBookmarksEnabled[];
extern const char kManagedBookmarks[];
extern const char kShowAppsShortcutInBookmarkBar[];
extern const char kShowManagedBookmarksInBookmarkBar[];
extern const char kShowBookmarkBar[];

}  // namespace prefs

#endif  // COMPONENTS_BOOKMARKS_COMMON_BOOKMARK_PREF_NAMES_H_

redpajama_set_name: RedPajamaGithub


text:
package majhenriquboss.smithcraft.items;

import majhenriquboss.smithcraft.Smithcraft;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;

/**
*@author MajhenriquBoss
*/

public class ItemSC extends Item {

    public ItemSC() {
        this.setCreativeTab(Smithcraft.tabSmithcraft);
    }

    @Override
    public void registerIcons(IIconRegister register) {
        itemIcon = register.registerIcon(Smithcraft.MODID.toLowerCase() + ":" + this.getClass().getSimpleName());
    }
}


text:
/*
 * 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.
 */
package io.trino.orc.stream;

import io.airlift.slice.Slice;
import io.trino.orc.OrcCorruptionException;
import io.trino.orc.OrcDecompressor;
import io.trino.orc.checkpoint.DecimalStreamCheckpoint;
import io.trino.spi.type.Int128;
import org.testng.annotations.Test;

import java.io.IOException;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Random;

import static io.trino.memory.context.AggregatedMemoryContext.newSimpleAggregatedMemoryContext;
import static io.trino.orc.OrcDecompressor.createOrcDecompressor;
import static io.trino.orc.metadata.CompressionKind.SNAPPY;

public class TestLongDecimalStream
        extends AbstractTestValueStream<Int128, DecimalStreamCheckpoint, DecimalOutputStream, DecimalInputStream>
{
    @Test
    public void test()
            throws IOException
    {
        Random random = new Random(0);
        List<List<Int128>> groups = new ArrayList<>();
        for (int groupIndex = 0; groupIndex < 3; groupIndex++) {
            List<Int128> group = new ArrayList<>();
            for (int i = 0; i < 1000; i++) {
                BigInteger value = new BigInteger(120, random);
                group.add(Int128.valueOf(value));
            }
            groups.add(group);
        }
        testWriteValue(groups);
    }

    @Override
    protected DecimalOutputStream createValueOutputStream()
    {
        return new DecimalOutputStream(SNAPPY, COMPRESSION_BLOCK_SIZE);
    }

    @Override
    protected void writeValue(DecimalOutputStream outputStream, Int128 value)
    {
        outputStream.writeUnscaledValue(value);
    }

    @Override
    protected DecimalInputStream createValueStream(Slice slice)
            throws OrcCorruptionException
    {
        Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
        return new DecimalInputStream(OrcChunkLoader.create(ORC_DATA_SOURCE_ID, slice, orcDecompressor, newSimpleAggregatedMemoryContext()));
    }

    @Override
    protected Int128 readValue(DecimalInputStream valueStream)
            throws IOException
    {
        long[] decimal = new long[2];
        valueStream.nextLongDecimal(decimal, 1);
        return Int128.valueOf(decimal);
    }
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Mussaenda latisepala Homolle

### Remarks
null


text:
<?php

namespace Amranidev\Ajaxis;

use Amranidev\Ajaxis\Autoarray\AutoArray;
use Amranidev\Ajaxis\Bootstrap\Builders\BootstrapDeleteConfirmationMessage;
use Amranidev\Ajaxis\Bootstrap\Builders\BootstrapDisplayBuilder;
use Amranidev\Ajaxis\Bootstrap\Builders\BootstrapModalBuilder;
use Amranidev\Ajaxis\Materialize\Builders\MaterializeDeleteConfirmationMessage;
use Amranidev\Ajaxis\Materialize\Builders\MaterializeDisplayBuilder;
use Amranidev\Ajaxis\Materialize\Builders\MaterializeModalBuilder;
use Amranidev\Ajaxis\Modal\ModalDirector;
use Illuminate\Database\Eloquent\Model;

/**
 * class AjaxisGenerate
 *
 * @package ajaxis
 * @author Amrani Houssain <amranidev@gmail.com>
 */
class AjaxisGenerate
{
    /**
     * ModalDirector instance
     *
     * @var $modalDorector
     */
    private $modalDirector;

    /**
     * Materialize Modal Content
     *
     * @var MtModal
     */
    private $MtModal;

    /**
     * Bootstrap Modal Content
     *
     * @var $btModal;
     */
    private $BtModal;

    /**
     * create new AjaxisGenerate instrance
     */
    public function __construct()
    {
        $this->modalDirector = new ModalDirector();

        $this->MtModal = new MaterializeModalBuilder();

        $this->BtModal = new BootstrapModalBuilder();
    }

    /**
     * Show Ajaxis materialize form to edit specified resource.
     *
     * @param  Array $input
     * @param  String $link
     * @return String
     */
    public function MteditFormModal($input, $link)
    {
        $modal = $this->modalDirector->build('Edit', 'update', $input, $link, $modal);

        return $modal->modalHead . $modal->modalBody . $modal->modalFooter;
    }

    /**
     * Show Ajaxis materialize form to create specified resource.
     *
     * @param  Array $input
     * @param  String $link
     * @return String
     */
    public function MtcreateFormModal($input, $link)
    {
        $modal = $this->modalDirector->build('New', 'create', $input, $link, $this->MtModal);

        return $modal->modalHead . $modal->modalBody . $modal->modalFooter;
    }

    /**
     * Show materialize confirmation message to delete  specified resource.
     *
     * @param  String $title
     * @param  String $message
     * @param  String $link
     * @return String
     */
    public function MtDeleting($title, $message, $link)
    {
        $modal = new MaterializeDeleteConfirmationMessage();

        $modal = $this->modalDirector->build($title, 'Delete', $message, $link, $modal);

        return $modal->modalHead . $modal->modalBody . $modal->modalFooter;
    }

    /**
     * Show materialize modal to displa specified resource.
     *
     * @param  Array $input
     * @return String
     */
    public function MtDisplay($input)
    {
        $modal = new MaterializeDisplayBuilder();

        $modal = $this->modalDirector->build(null, null, $input, null, $modal);

        return $modal->modalHead . $modal->modalBody . $modal->modalFooter;
    }

    /**
     * Show bootsrap modal to delete specified resource.
     *
     * @param  String $title
     * @param  String $body
     * @param  String $link
     * @return String
     */
    public function BtDeleting($title, $body, $link)
    {
        $modal = new BootstrapDeleteConfirmationMessage();

        $modal = $this->modalDirector->build($title, 'Agree', $body, $link, $modal);

        return $modal->modalHead . $modal->modalBody . $modal->modalFooter;
    }

    /**
     * Show Ajaxis bootstrap form to create specified resource.
     *
     * @param  Array $input
     * @param  String $link
     * @return String
     */
    public function BtCreateFormModal($input, $link)
    {
        $modal = $this->modalDirector->build('New', 'Create', $input, $link, $this->BtModal);

        return $modal->modalHead . $modal->modalBody . $modal->modalFooter;
    }

    /**
     * Show Ajaxis bootstrap form to edite specified resource.
     * @param  Array $input
     * @param  String $link
     * @return String
     */
    public function BtEditFormModal($input, $link)
    {
        $modal = $this->modalDirector->build('Edit', 'update', $input, $link, $this->BtModal);

        return $modal->modalHead . $modal->modalBody . $modal->modalFooter;
    }

    /**
     * Show bootstrap modal to display specified resource.
     * @param  Array $input
     * @return String
     */
    public function BtDisplay($input)
    {
        $modal = new BootstrapDisplayBuilder();

        $modal = $this->modalDirector->build('Dsiplay', 'ok', $input, null, $modal);

        return $modal->modalHead . $modal->modalBody . $modal->modalFooter;
    }

    /**
     * build Materialize modal quickly by a table name
     *
     * @var String $table
     * @var String $link
     *
     * @return String
     */
    public function MtGet($table, $link)
    {
        $result = new AutoArray($table);

        $modal = $this->modalDirector->build('New', 'Create', $result->merge(), $link, $this->MtModal);

        return $modal->modalHead . $modal->modalBody . $modal->modalFooter;
    }

    /**
     * build modal quickly by Eloquent model
     *
     * @var Model $model
     * @var String $link
     *
     *  @return String
     */
    public function MteditText(Model $model, $link)
    {
        $result = new AutoArray('');

        $modal = $this->modalDirector->build('Edit', 'Update', $result->getModelArray($model), $link, $this->MtModal);

        return $modal->modalHead . $modal->modalBody . $modal->modalFooter;
    }

    /**
     * build Bootstrap modal quickly by a table name
     *
     * @var String $table
     * @var String $link
     *
     * @return String
     */
    public function BtGet($table, $link)
    {
        $result = new AutoArray($table);

        $modal = $this->modalDirector->build('New', 'Create', $result->merge(), $link, $this->BtModal);

        return $modal->modalHead . $modal->modalBody . $modal->modalFooter;
    }

    /**
     * build modal quickly by Eloquent model
     *
     * @var Model $model
     * @var String $link
     *
     *  @return String
     */
    public function BteditText(Model $model, $link)
    {
        $result = new AutoArray('');

        $modal = $this->modalDirector->build('Edit', 'Update', $result->getModelArray($model), $link, $this->BtModal);

        return $modal->modalHead . $modal->modalBody . $modal->modalFooter;
    }
}


text:
var _ = require('underscore');
var Crypto = require('crypto');
var b62 = require('base62');
var Config = require('./config');
var Bignum = require('bignum');
var Base58 = require('base58-native');

//TODO: need to redo this with big int
// Convert string to 61 base number
exports.idToDBIndex = function (s) {
  //our index starts at 1
  return b62.decode(s);
};

exports.dbIndexToId = function (i) {
  return b62.encode(i);
};

var MD5 = exports.MD5 = function (data) {
  data = data || ''
  return Crypto.createHash('md5').update(data).digest('hex').toString();
};

// we take md5 of each piece of request and XOR the hashes to generate hash to store to DB
exports.hashForCreateReq = function (request) {
  var hash = Bignum(MD5(request.address), 16).xor(MD5(request.amount)).xor(MD5(request.memo)).xor(MD5(request.ackmemo));
  return hash.toString(16);
};

exports.paymentURIFromId = function (id) {
  return Config.server.api.uri + '/pay/' + id;
};

exports.sendURIFromId = function (id) {
  return Config.server.api.uri + '/send/' + id;
}

//Bitcoin utils
var sha256 = exports.sha256 = function (data) {
  return new Buffer(Crypto.createHash('sha256').update(data).digest('binary'), 'binary');
};

var ripe160 = exports.ripe160 = function (data) {
  return new Buffer(Crypto.createHash('rmd160').update(data).digest('binary'), 'binary');
};
var twoSha256 = exports.twoSha256 = function (data) {
  return sha256(sha256(data));
};

var getPublicKeyHash = exports.getPublicKeyHash = function (address) {
  var decodedAddr = Base58.decode(address);
  decodedAddr = '' + decodedAddr.toString('hex');
  if (decodedAddr.length === 50) {
    var ripe160 = decodedAddr.substring(0, 42);
    console.log(ripe160);
    var checksum = decodedAddr.substring(42);
    console.log(checksum);

    //make sure checksum checks out
    //1. Add version byte in front of RIPEMD-160 hash (0x00 for Main Network)
    //2. Perform SHA-256 hash on the extended RIPEMD-160 result
    //3. Perform SHA-256 hash on the result of the previous SHA-256 hash
    //4. Take the first 4 bytes of the second SHA-256 hash. This is the address checksum

    var calculatedCS = Util.twoSha256(new Buffer(ripe160, 'hex'));
    calculatedCS = '' + calculatedCS.toString('hex');
    calculatedCS = calculatedCS.substring(0, 8);
    if (calculatedCS == checksum) {
      console.log("yup, checksum validated");
      return ripe160.substring(2);
    } else {
      console.log("Address not valid, checksum cannot be validated");
    }
  } else {
    console.log("decoded address len: " + decodedAddr.length);
  }
};


text:
namespace CSBackend
{
	namespace Android
	{
		//----------------------------------------------------
		/// Class for posting messages and request
		/// to the Facebook wall via the Android Facebook SDK.
		///
		/// @author R Henning
		//----------------------------------------------------
		class FacebookPostSystem final : public CSSocial::FacebookPostSystem
		{
		public:
			CS_DECLARE_NAMEDTYPE(FacebookPostSystem);
			//----------------------------------------------------
            /// @author R Henning
            ///
            /// @param Interface ID to compare
            ///
            /// @return Whether the object has the same interface ID
            //----------------------------------------------------
			bool IsA(CSCore::InterfaceIDType in_interfaceId) const override;
			//----------------------------------------------------
            /// Post the wall of the user specified in the post
            /// description. If no user is specified then post
            /// to the wall of the currently authenticated user.
            ///
            /// Note: For the time being only one post can
            /// happen at a time
            ///
            /// @author R Henning
            ///
            /// @param Post description
            /// @param Connection to result delegate
            //----------------------------------------------------
            void Post(const PostDesc& in_desc, PostResultDelegate::Connection&& in_delegateConnection) override;
            //---------------------------------------------------
            /// Send a request to a group of friends using the
            /// Android Facebook SDK
            ///
            /// Note: For the time being only one request can
            /// happen at a time
            ///
            /// @author A Mackie
            ///
            /// @param Request description
            /// @param Connection to result delegate
            //---------------------------------------------------
            void SendRequest(const RequestDesc& in_desc, PostResultDelegate::Connection&& in_delegateConnection) override;

            //---Internal functions called by the JNI
            //---------------------------------------------------
            /// Called by JNI when the Facebook SDK has
            /// finished posting to the wall
            ///
            /// @author R Henning
            ///
            /// @param Result
            //---------------------------------------------------
			void OnPostToFeedComplete(PostResult in_result);
            //---------------------------------------------------
            /// Called by JNI when the Facebook SDK has
            /// finished requesting.
            ///
            /// @author A Mackie
            ///
            /// @param Result
            //---------------------------------------------------
			void OnPostRequestComplete(PostResult in_result);

		private:
			friend CSSocial::FacebookPostSystemUPtr CSSocial::FacebookPostSystem::Create();
			//----------------------------------------------------
            /// Private constructor to force the use of the
            /// factory method.
            ///
            /// @author Ian Copland
            //----------------------------------------------------
            FacebookPostSystem() = default;
            //------------------------------------------------
            /// Initialisation method called at a time when
            /// all App Systems have been created. System
            /// initialisation occurs in the order they were
            /// created.
            ///
            /// @author T Kane
            //------------------------------------------------
            void OnInit() override;
            //------------------------------------------------
            /// Called when the application is being destroyed.
            /// This should be used to cleanup memory and
            /// references to other systems. System destruction
            /// occurs in the reverse order to which they
            /// were created
            ///
            /// @author T Kane
            //------------------------------------------------
            void OnDestroy() override;

		private:
			FacebookJavaInterfaceSPtr m_javaInterface;
			CSSocial::FacebookAuthenticationSystem* m_authSystem;
            PostResultDelegate::Connection m_postCompleteDelegateConnection;
            PostResultDelegate::Connection m_requestCompleteDelegateConnection;
		};
	}
}

#endif

#endif


text:
<!doctype html>

  <meta charset="utf-8"/>
  <title>Inner Page</title>

Site Wide Header

This is the heading of the article

flex: 5 1 auto;Lorem ipsum dolor sit amet, consectetur adipiscing elit. In erat mauris, faucibus quis pharetra sit amet, pretium ac libero. Etiam vehicula eleifend bibendum. Morbi gravida metus ut sapien condimentum sodales mollis augue sodales. Vestibulum quis quam at sem placerat aliquet. Curabitur a felis at sapien ullamcorper fermentum. Mauris molestie arcu et lectus iaculis sit amet eleifend eros posuere. Fusce nec porta orci.

Aside Heading

flex: 2 1 auto;Mauris molestie arcu et lectus iaculis sit amet eleifend eros posuere. Fusce nec porta orci.

          Home
          About
          Careers
          Contact Us
          flex: 2 1 auto;

Copyright © 2017 My Site


text:
package com.android.tools.idea.gradle.editor.parser;

import com.android.tools.idea.gradle.editor.entity.ExternalDependencyGradleEditorEntity;
import com.android.tools.idea.gradle.editor.entity.GradleEditorSourceBinding;
import com.android.tools.idea.gradle.editor.metadata.GradleEditorEntityMetaData;
import com.google.common.collect.Sets;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Collections;
import java.util.List;
import java.util.Set;

import static com.android.tools.idea.gradle.editor.parser.GradleEditorParserTestUtil.text;

public class ExternalDependencyChecker {

  private final ScopeChecker myScopeExpectations = new ScopeChecker();
  private final GroupChecker myGroupExpectations = new GroupChecker();
  private final ArtifactChecker myArtifactExpectations = new ArtifactChecker();
  private final VersionChecker myVersionExpectations = new VersionChecker();
  private final Set<GradleEditorEntityMetaData> myExpectedMetaData = Sets.newHashSet();

  @Nullable private String myExpectedEntityText;

  private ExternalDependencyChecker() {
  }

  @NotNull
  public static ExternalDependencyChecker create() {
    return new ExternalDependencyChecker();
  }

  @NotNull
  public ExternalDependencyChecker scope(@NotNull String value) {
    myScopeExpectations.setExpectedValue(value);
    return this;
  }

  @SuppressWarnings("UnusedDeclaration")
  @NotNull
  public ExternalDependencyChecker scopeBinding(@NotNull String... bindingsText) {
    myScopeExpectations.setExpectedDefinitionValueBindings(bindingsText);
    return this;
  }

  @NotNull
  public ExternalDependencyChecker group(@NotNull String value) {
    myGroupExpectations.setExpectedValue(value);
    return this;
  }

  @NotNull
  public ExternalDependencyChecker groupBinding(@NotNull String ... bindingsText) {
    myGroupExpectations.setExpectedDefinitionValueBindings(bindingsText);
    return this;
  }

  @NotNull
  public ExternalDependencyChecker artifact(@NotNull String value) {
    myArtifactExpectations.setExpectedValue(value);
    return this;
  }

  @NotNull
  public ExternalDependencyChecker artifactBinding(@NotNull String ... bindingsText) {
    myArtifactExpectations.setExpectedDefinitionValueBindings(bindingsText);
    return this;
  }

  @NotNull
  public ExternalDependencyChecker version(@NotNull String value) {
    myVersionExpectations.setExpectedValue(value);
    return this;
  }

  @NotNull
  public ExternalDependencyChecker versionBinding(@NotNull String ... bindingsText) {
    myVersionExpectations.setExpectedDefinitionValueBindings(bindingsText);
    return this;
  }

  @NotNull
  public ExternalDependencyChecker versionDeclarationValue(@NotNull String text) {
    myVersionExpectations.setExpectedDeclarationValue(text);
    return this;
  }

  @NotNull
  public ExternalDependencyChecker entityText(@NotNull String text) {
    myExpectedEntityText = text;
    return this;
  }

  @NotNull
  public ExternalDependencyChecker metaData(@NotNull GradleEditorEntityMetaData... metaData) {
    Collections.addAll(myExpectedMetaData, metaData);
    return this;
  }

  @Nullable
  public String matches(@NotNull ExternalDependencyGradleEditorEntity actual) {
    if (myExpectedEntityText != null && !myExpectedEntityText.equals(text(actual.getEntityLocation()))) {
      return String.format("expected entity text mismatch - expected: '%s', actual: '%s'",
                           myExpectedEntityText, text(actual.getEntityLocation()));
    }
    String reason = myScopeExpectations.apply(actual);
    if (reason != null) {
      return reason;
    }
    reason = myGroupExpectations.apply(actual);
    if (reason != null) {
      return reason;
    }
    reason = myArtifactExpectations.apply(actual);
    if (reason != null) {
      return reason;
    }
    reason = myVersionExpectations.apply(actual);
    if (reason != null) {
      return reason;
    }
    if (!myExpectedMetaData.equals(actual.getMetaData())) {
      return String.format("expected meta-data %s but found %s", myExpectedMetaData, actual.getMetaData());
    }
    return null;
  }

  @Override
  public String toString() {
    return String.format("%s %s:%s:%s", myScopeExpectations, myGroupExpectations, myArtifactExpectations, myVersionExpectations);
  }

  private static class ScopeChecker extends AbstractPropertyChecker<ExternalDependencyGradleEditorEntity> {

    @Nullable
    @Override
    protected String deriveActualValue(@NotNull ExternalDependencyGradleEditorEntity entity) {
      return entity.getScope();
    }

    @NotNull
    @Override
    protected List<GradleEditorSourceBinding> deriveDefinitionValueSourceBindings(@NotNull ExternalDependencyGradleEditorEntity entity) {
      return entity.getScopeBindings();
    }
  }

  private static class GroupChecker extends AbstractPropertyChecker<ExternalDependencyGradleEditorEntity> {

    @Nullable
    @Override
    protected String deriveActualValue(@NotNull ExternalDependencyGradleEditorEntity entity) {
      return entity.getGroupId();
    }

    @NotNull
    @Override
    protected List<GradleEditorSourceBinding> deriveDefinitionValueSourceBindings(@NotNull ExternalDependencyGradleEditorEntity entity) {
      return entity.getGroupIdSourceBindings();
    }
  }

  private static class ArtifactChecker extends AbstractPropertyChecker<ExternalDependencyGradleEditorEntity> {

    @Nullable
    @Override
    protected String deriveActualValue(@NotNull ExternalDependencyGradleEditorEntity entity) {
      return entity.getArtifactId();
    }

    @NotNull
    @Override
    protected List<GradleEditorSourceBinding> deriveDefinitionValueSourceBindings(@NotNull ExternalDependencyGradleEditorEntity entity) {
      return entity.getArtifactIdSourceBindings();
    }
  }

  private static class VersionChecker extends AbstractPropertyChecker<ExternalDependencyGradleEditorEntity> {

    @Nullable
    @Override
    protected String deriveActualValue(@NotNull ExternalDependencyGradleEditorEntity entity) {
      return entity.getVersion();
    }

    @NotNull
    @Override
    protected List<GradleEditorSourceBinding> deriveDefinitionValueSourceBindings(@NotNull ExternalDependencyGradleEditorEntity entity) {
      return entity.getVersionSourceBindings();
    }
  }
}


text:
package com.gl.monitor.gather.service;

import java.util.concurrent.BlockingQueue;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.gl.monitor.gather.vo.ComputerInfo;

public class ComputerInfoInternalSender {
	private static final Logger log = LoggerFactory.getLogger(ComputerInfoInternalSender.class);
	private BlockingQueue<ComputerInfo> infoQueue;

	public ComputerInfoInternalSender(BlockingQueue<ComputerInfo> queue){
		this.infoQueue = queue;
	}

	public void send(ComputerInfo info) {
		info.setBizSeq(String.format("911%s", System.nanoTime()));

		try {
			infoQueue.put(info);
		} catch (InterruptedException e) {
			log.error("", e);
		}
	}
}


text:
package org.jkiss.dbeaver.registry.driver;

import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.connection.DBPNativeClientLocation;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.registry.NativeClientDescriptor;
import org.jkiss.dbeaver.registry.NativeClientDistributionDescriptor;

import java.io.File;

/**
 * LocalNativeClientLocation
 */
public class RemoteNativeClientLocation implements DBPNativeClientLocation {
    private final NativeClientDescriptor clientDescriptor;

    public RemoteNativeClientLocation(NativeClientDescriptor clientDescriptor) {
        this.clientDescriptor = clientDescriptor;
    }

    @Override
    public String getName() {
        return clientDescriptor.getId();
    }

    @Override
    public File getPath() {
        NativeClientDistributionDescriptor distribution = clientDescriptor.findDistribution();
        if (distribution != null) {
            File driversHome = DriverDescriptor.getCustomDriversHome();
            return new File(driversHome, distribution.getTargetPath());
        }
        return new File(getName());
    }

    @Override
    public String getDisplayName() {
        return clientDescriptor.getLabel();
    }

    @Override
    public boolean validateFilesPresence(DBRProgressMonitor progressMonitor) throws DBException, InterruptedException {
        NativeClientDistributionDescriptor distribution = clientDescriptor.findDistribution();
        if (distribution != null) {
            return distribution.downloadFiles(progressMonitor, this);
        }
        return false;
    }

    @Override
    public String toString() {
        return "Remote: " + clientDescriptor.getId();
    }
}


text:
package chroma

type Group struct {
	Id   string
	Name string
}

type GroupAttributes struct {
	// Action *Action `json:"action"` -- not implemented yet, low priority

	Name   string   `json:"name"`
	Lights []string `json:"lights"`
}

type GroupStateChange struct {
	Hue                *int        `json:"hue,omitempty"`
	On                 *bool       `json:"on,omitempty"`
	Effect             string      `json:"effect,omitempty"`
	Alert              string      `json:"alert,omitempty"`
	Brightness         *int        `json:"bri,omitempty"`
	Saturation         *int        `json:"sat,omitempty"`
	ColorTemperature   *int        `json:"ct,omitempty"`
	ColorSpaceLocation *[2]float64 `json:"xy,omitempty"`
	TransitionTime     *int        `json:"transitiontime,omitempty"`
}

func (c *Client) Groups() (groups []*Group, err error) {
	var resp map[string]map[string]string
	_, err = c.get(c.buildApiUrl("groups"), &resp)
	if err != nil {
		return
	}

	groups = make([]*Group, 0, 16)
	for k, v := range resp {
		groups = append(groups, &Group{
			Id:   k,
			Name: v["name"],
		})
	}

	return
}

func (c *Client) GroupAttributes(id string) (attributes *GroupAttributes, err error) {
	_, err = c.get(c.buildApiUrl("groups/"+id), &attributes)
	return
}

func (c *Client) SetGroupState(id string, change *GroupStateChange) (err error) {
	var resp interface{}
	_, err = c.put(c.buildApiUrl("groups/"+id+"/action"), change, &resp)
	return
}


text:
import {NgModule, ModuleWithProviders} from "@angular/core";
import {IMAGELAZYLOAD_DIRECTIVES} from './src/app/directives/image-lazy-load.directive';
import {ImageLazyLoaderService} from './src/app/services/image-lazy-load.service';
import {WebWorkerService} from './src/app/services/web-worker.service';

// for manual imports
export * from './src/app/services/image-lazy-load.service';
export * from './src/app/services/web-worker.service';
export * from './src/app/directives/image-lazy-load.directive';

@NgModule({
  declarations: [
    IMAGELAZYLOAD_DIRECTIVES
  ],
  providers: [
    ImageLazyLoaderService,
    WebWorkerService
  ],
  exports: [
    IMAGELAZYLOAD_DIRECTIVES
  ]
})
export class ImageLazyLoadModule {

  static forRoot(configuredProviders: Array<any>): ModuleWithProviders {
    return {
      ngModule: ImageLazyLoadModule,
      providers: configuredProviders
    };
  }
}


text:
from __future__ import absolute_import
from agms.agms import Agms
from agms.request.report_request import ReportRequest
from agms.response.report_response import ReportResponse
from agms.exception.invalid_request_exception import InvalidRequestException

class Report(Agms):
    """
    A class representing AGMS Report objects.
    """

    def __init__(self):
        Agms.__init__(self)
        self._api_url = None
        self._trans_api_url = 'https://gateway.agms.com/roxapi/agms.asmx'
        self._safe_api_url = 'https://gateway.agms.com/roxapi/AGMS_SAFE_API.asmx'
        self._requestObject = ReportRequest
        self._responseObject = ReportResponse

    def list_transactions(self, params):
        self._op = 'TransactionAPI'
        self._reset_parameters()
        for param, config in params.items():
            self._set_parameter(param, config)
        self._execute()
        return self.response.to_array()

    def list_SAFEs(self, params):
        self._op = 'QuerySAFE'
        self._reset_parameters()
        for param, config in params.items():
            self._set_parameter(param, config)
        self._execute()
        return self.response.to_array()

    def _execute(self):
        if self._op == 'TransactionAPI':
            self._api_url = self._trans_api_url
            self._do_connect('TransactionAPI', self._responseObject)
        elif self._op == 'QuerySAFE':
            self._api_url = self._safe_api_url
            self._do_connect('QuerySAFE', self._responseObject)
        else:
            raise InvalidRequestException('Invalid request to Invoicing API ' + self.op)


text:
package com.xxl.job.admin.core.route.strategy;

import com.xxl.job.admin.core.route.ExecutorRouter;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.biz.model.TriggerParam;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * 单个JOB对应的每个执行器,使用频率最低的优先被选举
 *      a(*)、LFU(Least Frequently Used):最不经常使用,频率/次数
 *      b、LRU(Least Recently Used):最近最久未使用,时间
 *
 * Created by xuxueli on 17/3/10.
 */
public class ExecutorRouteLFU extends ExecutorRouter {

    private static ConcurrentMap<Integer, HashMap<String, Integer>> jobLfuMap = new ConcurrentHashMap<Integer, HashMap<String, Integer>>();
    private static long CACHE_VALID_TIME = 0;

    public String route(int jobId, List<String> addressList) {

        // cache clear
        if (System.currentTimeMillis() > CACHE_VALID_TIME) {
            jobLfuMap.clear();
            CACHE_VALID_TIME = System.currentTimeMillis() + 1000*60*60*24;
        }

        // lfu item init
        HashMap<String, Integer> lfuItemMap = jobLfuMap.get(jobId);     // Key排序可以用TreeMap+构造入参Compare;Value排序暂时只能通过ArrayList;
        if (lfuItemMap == null) {
            lfuItemMap = new HashMap<String, Integer>();
            jobLfuMap.putIfAbsent(jobId, lfuItemMap);   // 避免重复覆盖
        }

        // put new
        for (String address: addressList) {
            if (!lfuItemMap.containsKey(address) || lfuItemMap.get(address) >1000000 ) {
                lfuItemMap.put(address, new Random().nextInt(addressList.size()));  // 初始化时主动Random一次,缓解首次压力
            }
        }
        // remove old
        List<String> delKeys = new ArrayList<>();
        for (String existKey: lfuItemMap.keySet()) {
            if (!addressList.contains(existKey)) {
                delKeys.add(existKey);
            }
        }
        if (delKeys.size() > 0) {
            for (String delKey: delKeys) {
                lfuItemMap.remove(delKey);
            }
        }

        // load least userd count address
        List<Map.Entry<String, Integer>> lfuItemList = new ArrayList<Map.Entry<String, Integer>>(lfuItemMap.entrySet());
        Collections.sort(lfuItemList, new Comparator<Map.Entry<String, Integer>>() {
            @Override
            public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
                return o1.getValue().compareTo(o2.getValue());
            }
        });

        Map.Entry<String, Integer> addressItem = lfuItemList.get(0);
        String minAddress = addressItem.getKey();
        addressItem.setValue(addressItem.getValue() + 1);

        return addressItem.getKey();
    }

    @Override
    public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) {
        String address = route(triggerParam.getJobId(), addressList);
        return new ReturnT<String>(address);
    }

}


text:
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    ZFNetReuqestModel *requestModel = [ZFNetReuqestModel modelWithPath:@"/data/sk/101010100.html"];
    requestModel.requestMethod = NBNetRequestMethodGet;
    requestModel.useAccount = NO;
    requestModel.refreshCache = YES;
    [ZFNetRequest startWithRequestModel:requestModel completionBlockWithSuccess:^(NBBaseNetRequest *request) {

    } failure:^(NBBaseNetRequest *request) {
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end


text:
require_relative "../helper"

describe Alexa::API::CategoryListings do
  describe "parsing xml" do
    before do
      @category_listings = Alexa::API::CategoryListings.new(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY)
      VCR.use_cassette("category_listings/card_games") do
        @category_listings.fetch(:path => "Top/Games/Card_Games")
      end
    end

    it "returns recursive count" do
      assert_equal 799, @category_listings.recursive_count
    end

    it "returns count" do
      assert_equal 0, @category_listings.count
    end

    it "returns listings" do
      assert_equal 20, @category_listings.listings.size
    end

    it "has success status code" do
      assert_equal "Success", @category_listings.status_code
    end

    it "has request id" do
      refute_nil @category_listings.request_id
    end
  end
end


text: MAP Client plugin presenting a simple interface for visualising a model using OpenCMISS-Zinc.


text:
package de.kaiserpfalzedv.office.tenant.api.commands;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import de.kaiserpfalzedv.commons.api.commands.CrudCommands;

import javax.validation.constraints.NotNull;
import java.util.UUID;

/**
 * @author klenkes {@literal <rlichti@kaiserpfalz-edv.de>}
 * @version 1.0.0
 * @since 2016-09-25
 */
public class TenantRetrieveCommand extends TenantIdContainingBaseCommand {
    private static final long serialVersionUID = -1871568351897272565L;
    private static final CrudCommands CRUD_TYPE = CrudCommands.RETRIEVE;

    @JsonCreator
    TenantRetrieveCommand(
            @JsonProperty("source") @NotNull final UUID source,
            @JsonProperty("command") @NotNull final UUID commandId,
            @JsonProperty("tenant") @NotNull final UUID tenant
    ) {
        super(CRUD_TYPE, source, commandId, tenant);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FriendsApi.Models;
using FriendsApi.Representations;
using Nancy;

namespace FriendsApi.Modules
{
    public class FriendsModule : NancyModule
    {
        public FriendsModule()
        {
            // Make sure to call with the HTTP header
            // Accept: application/hal+json
            Get[FriendsLinks.Friends] = _ =>
            {
                var friend1 = new Friend()
                {
                    FullName = "Anders Ljusberg",
                    Slug = "anderslj",
                    Blog = "http://coding-insomnia.com",
                    Workplace = new Company()
                    {
                        Name = "Aptitud",
                        Web = "https://aptitud.se"
                    }
                };
                var friend2 = new Friend()
                {
                    FullName = "Glenn Block",
                    Slug = "gblock",
                    Blog = "http://codebetter.com/glennblock/"
                };

                // Create the represenation for a list of friends
                var friends = new FriendsRepresentation();

                // Create each friend resource and embed them in the list
                friends.EmbedResource("friend", new FriendRepresentation(friend1));
                friends.EmbedResource("friend", new FriendRepresentation(friend2));

                return friends;
            };
        }
    }
}


text:
package com.pauselabs.pause.model;

import android.content.Context;
import android.content.SharedPreferences;
import com.pauselabs.pause.Injector;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.inject.Inject;
import org.json.JSONArray;
import org.json.JSONException;

/**
 * This class will construct a randomized String from a given JSON file.
 *
 *
NOTE: The JSON file must be in the assets folder
 *
 *
Created by mpollin on 11/7/14.
 */
public class StringRandomizer {

  @Inject SharedPreferences prefs;

  protected Context mContext;
  protected Random randNumGenerator;
  private ArrayList<ArrayList<String>> components;

  /**
   * Construct a StringRandomizer without an initial JSON file
   *
   *
NOTE: without a file this class is useless
   *
   * @param context
   */
  public StringRandomizer(Context context) {
    this(context, null);
  }

  /**
   * Construct a StringRandomizer with an initial JSON file
   *
   * @param c
   * @param filename The name of the JSON file
   */
  public StringRandomizer(Context c, String filename) {
    mContext = c;
    randNumGenerator = new Random();
    components = new ArrayList<ArrayList<String>>();

    Injector.inject(this);

    try {
      parseFile(filename);
    } catch (JSONException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

  /**
   * @return A randomized String generated from the given JSON file. Returns null if there is no
   *     JSON file.
   */
  public String getString(String contactName) {
    if (components.isEmpty()) return null;

    Pattern contactPattern = Pattern.compile("%contact");
    Pattern namePattern = Pattern.compile("%name");
    Pattern genderPattern = Pattern.compile("%gender");
    Matcher m;

    String genderValue = prefs.getString(Constants.Settings.GENDER_KEY, "");

    StringBuilder sb = new StringBuilder();

    for (int i = 0; i < components.size(); i++) {
      ArrayList<String> component = components.get(i);

      int index = randNumGenerator.nextInt(component.size());
      String text = component.get(index);

      m = contactPattern.matcher(text);
      text = m.replaceAll(contactName);

      m = namePattern.matcher(text);
      text = m.replaceAll(prefs.getString(Constants.Settings.NAME_KEY, ""));

      m = genderPattern.matcher(text);
      text = m.replaceAll(genderValue);

      sb.append(text);

      if (i != components.size()) sb.append(' ');
    }

    return sb.toString();
  }

  /**
   * Set the JSON file to be used for generating Strings
   *
   * @param filename
   */
  public void setFile(String filename) {
    try {
      parseFile(filename);
    } catch (JSONException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

  protected void parseFile(String filename) throws JSONException, IOException {
    components.clear();
    if (filename == null) return;

    InputStream is = mContext.getAssets().open(filename);
    int size = is.available();

    byte[] buffer = new byte[size];

    is.read(buffer);

    is.close();

    JSONArray in = new JSONArray(new String(buffer, "UTF-8"));
    for (int i = 0; i < in.length(); i++) parseComponent(in.getJSONArray(i));
  }

  public void parseComponent(JSONArray strings) throws JSONException {
    ArrayList<String> component = new ArrayList<String>();
    for (int i = 0; i < strings.length(); i++) component.add(strings.getString(i));

    this.components.add(component);
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 The Chromium Authors
     Use of this source code is governed by a BSD-style license that can be
     found in the LICENSE file.
 -->

<org.chromium.chrome.browser.gesturenav.NavigationBubble
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:minHeight="@dimen/navigation_bubble_size"
    android:layout_width="wrap_content"
    android:gravity="center_vertical"
    android:background="@drawable/navigation_bubble_shadow"
    android:animateLayoutChanges="true"
    android:orientation="horizontal">

    <org.chromium.ui.widget.ChromeImageView
        android:id="@+id/navigation_bubble_arrow"
        android:layout_width="@dimen/navigation_bubble_arrow_size"
        android:layout_height="@dimen/navigation_bubble_arrow_size"
        app:srcCompat="@drawable/ic_arrow_back_24dp"
        android:visibility="gone"
        android:paddingStart="@dimen/navigation_bubble_start_padding"
        android:paddingTop="@dimen/navigation_bubble_top_padding"
        android:paddingBottom="@dimen/navigation_bubble_bottom_padding"
        android:importantForAccessibility="no" />
    <TextView
        android:id="@+id/navigation_bubble_text"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="center"
        android:textAppearance="@style/TextAppearance.TextMediumThick.Accent1"
        android:paddingTop="@dimen/navigation_bubble_text_top_padding"
        android:paddingStart="@dimen/navigation_bubble_text_start_padding"
        android:paddingEnd="@dimen/navigation_bubble_text_end_padding"
        android:paddingBottom="@dimen/navigation_bubble_text_bottom_padding"
        android:visibility="gone"
        android:maxLines="1" />
</org.chromium.chrome.browser.gesturenav.NavigationBubble>


text:
/**
 * A sum expression. Represents addition of two expressions.
 * @author (Kevin Dittmar)
 * @author (William Ezekiel)
 * @author (Joseph Alacqua)
 * @version Mar 29 2016
 */
public class Sum extends Exp{

  /**
   * Create a Sum
   * @param l the left expression
   * @param r the right expression
   */
  public Sum(Exp l, Exp r) {
    left = l;
    right = r;
  }

  /**
   * Accept a visitor.
   * @param v a visitor
   * @return the object produced by the visit.
   */
  public Object accept(Visitor v) {
    return v.visit(this);
  }
}


text:
'use strict';

module.exports = c => ({value: c.value + 1});


text:
layout: model
title: Detect Problems, Tests and Treatments (ner_crf)
author: John Snow Labs
name: ner_crf
class: NerCrfModel
language: en
repository: clinical/models
date: 2020-01-28
task: Named Entity Recognition
edition: Healthcare NLP 2.4.0
spark_version: 2.4
tags: [ner]
supported: true
annotator: NerCrfModel
article_header:
   type: cover
use_language_switcher: "Python-Scala-Java"
---

{:.h2_title}
## Description
Named Entity recognition annotator allows for a generic model to be trained by CRF model
Clinical NER (Large) is a Named Entity Recognition model that annotates text to find references to clinical events. The entities it annotates are Problem, Treatment, and Test. Clinical NER is trained with the 'embeddings_clinical' word embeddings model, so be sure to use the same embeddings in the pipeline.

## Predicted Entities
`Problem`, `Test`, `Treatment`

{:.btn-box}
<button class="button button-orange" disabled>Live Demo</button>
<button class="button button-orange" disabled>Open in Colab</button>
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/clinical/models/ner_crf_en_2.4.0_2.4_1580237286004.zip){:.button.button-orange.button-orange-trans.arr.button-icon}
{:.h2_title}
## How to use
<div class="tabs-box" markdown="1">

{% include programmingLanguageSelectScalaPython.html %}

```python
model = NerCrfModel.pretrained("ner_crf","en","clinical/models")\
	.setInputCols("sentence","token","pos","word_embeddings")\
	.setOutputCol("ner")
```

```scala
val model = NerCrfModel.pretrained("ner_crf","en","clinical/models")
	.setInputCols("sentence","token","pos","word_embeddings")
	.setOutputCol("ner")
```
</div>

{:.model-param}
## Model Information

{:.table-model}
|---------------|---------------------------------------|
| Name:          | ner_crf                               |
| Type:   | NerCrfModel                           |
| Compatibility: | Spark NLP 2.4.0+                                 |
| License:       | Licensed                              |
| Edition:       | Official                            |
|Input labels:        | [sentence, token, pos, word_embeddings] |
|Output labels:       | [ner]                                   |
| Language:      | en                                    |
| Dependencies: | embeddings_clinical                   |

{:.h2_title}
## Data Source
Trained on i2b2 augmented data with `clinical_embeddings`
FILLUP


text:
@extends('admin::layouts.admin')

@section('admin-content')

Pages

			Create page

			{!! $navigation !!}

@stop


text:
using System.Collections;

namespace WpfApplication1
{
    class RectangularComparer : IComparer
    {
        // maintain a reference to the 2-dimensional array being sorted
        private double[,] sortArray;

        // constructor initializes the sortArray reference
        public RectangularComparer(double[,] theArray)
        {
            sortArray = theArray;
        }

        public int Compare(object x, object y)
        {
            // x and y are integer row numbers into the sortArray
            int i1 = (int)x;
            int i2 = (int)y;

            // compare the items in the sortArray
            return sortArray[i1, 3].CompareTo(sortArray[i2, 3]);
        }
    }
}


text:
<?php

spl_autoload_register(function($className) {
    $filename = str_replace(array('\\', '_'), DIRECTORY_SEPARATOR, $className) . '.php';
    $path = __DIR__ . "/src/" . $filename;

    if (is_file($path)) {
        include $path;
        return true;
    }
    return false;
});


text:
#ifndef _LIBDWFL_H
#define _LIBDWFL_H	1

#include "libdw.h"
#include <stdio.h>

/* Handle for a session using the library.  */
typedef struct Dwfl Dwfl;

/* Handle for a module.  */
typedef struct Dwfl_Module Dwfl_Module;

/* Handle describing a line record.  */
typedef struct Dwfl_Line Dwfl_Line;

/* Callbacks.  */
typedef struct
{
  int (*find_elf) (Dwfl_Module *mod, void **userdata,
		   const char *modname, Dwarf_Addr base,
		   char **file_name, Elf **elfp);

  int (*find_debuginfo) (Dwfl_Module *mod, void **userdata,
			 const char *modname, Dwarf_Addr base,
			 const char *file_name,
			 const char *debuglink_file, GElf_Word debuglink_crc,
			 char **debuginfo_file_name);

  /* Fill *ADDR with the loaded address of the section called SECNAME in
     the given module.  Use (Dwarf_Addr) -1 if this section is omitted from
     accessible memory.  This is called exactly once for each SHF_ALLOC
     section that relocations affecting DWARF data refer to, so it can
     easily be used to collect state about the sections referenced.  */
  int (*section_address) (Dwfl_Module *mod, void **userdata,
			  const char *modname, Dwarf_Addr base,
			  const char *secname,
			  GElf_Word shndx, const GElf_Shdr *shdr,
			  Dwarf_Addr *addr);

  char **debuginfo_path;	/* See dwfl_standard_find_debuginfo.  */
} Dwfl_Callbacks;

#ifdef __cplusplus
extern "C" {
#endif

/* Start a new session with the library.  */
extern Dwfl *dwfl_begin (const Dwfl_Callbacks *callbacks)
  __nonnull_attribute__ (1);

/* End a session.  */
extern void dwfl_end (Dwfl *);

/* Return implementation's version string suitable for printing.  */
extern const char *dwfl_version (Dwfl *);

/* Return error code of last failing function call.  This value is kept
   separately for each thread.  */
extern int dwfl_errno (void);

/* Return error string for ERROR.  If ERROR is zero, return error string
   for most recent error or NULL if none occurred.  If ERROR is -1 the
   behaviour is similar to the last case except that not NULL but a legal
   string is returned.  */
extern const char *dwfl_errmsg (int err);

/* Start reporting the current set of segments and modules to the library.
   All existing segments are wiped.  Existing modules are marked to be
   deleted, and will not be found via dwfl_addrmodule et al if they are not
   re-reported before dwfl_report_end is called.  */
extern void dwfl_report_begin (Dwfl *dwfl);

/* Report that segment NDX begins at PHDR->p_vaddr + BIAS.
   If NDX is < 0, the value succeeding the last call's NDX
   is used instead (zero on the first call).

   If nonzero, the smallest PHDR->p_align value seen sets the
   effective page size for the address space DWFL describes.
   This is the granularity at which reported module boundary
   addresses will be considered to fall in or out of a segment.

   Returns -1 for errors, or NDX (or its assigned replacement) on success.

   When NDX is the value succeeding the last call's NDX (or is implicitly
   so as above), IDENT is nonnull and matches the value in the last call,
   and the PHDR and BIAS values reflect a segment that would be contiguous,
   in both memory and file, with the last segment reported, then this
   segment may be coalesced internally with preceding segments.  When given
   an address inside this segment, dwfl_addrsegment may return the NDX of a
   preceding contiguous segment.  To prevent coalesced segments, always
   pass a null pointer for IDENT.

   The values passed are not stored (except to track coalescence).
   The only information that can be extracted from DWFL later is the
   mapping of an address to a segment index that starts at or below
   it.  Reporting segments at all is optional.  Its only benefit to
   the caller is to offer this quick lookup via dwfl_addrsegment,
   or use other segment-based calls.  */
extern int dwfl_report_segment (Dwfl *dwfl, int ndx,
				const GElf_Phdr *phdr, GElf_Addr bias,
				const void *ident);

/* Report that a module called NAME spans addresses [START, END).
   Returns the module handle, either existing or newly allocated,
   or returns a null pointer for an allocation error.  */
extern Dwfl_Module *dwfl_report_module (Dwfl *dwfl, const char *name,
					Dwarf_Addr start, Dwarf_Addr end);

/* Report a module with start and end addresses computed from the ELF
   program headers in the given file, plus BASE.  For an ET_REL file,
   does a simple absolute section layout starting at BASE.
   FD may be -1 to open FILE_NAME.  On success, FD is consumed by the
   library, and the `find_elf' callback will not be used for this module.  */
extern Dwfl_Module *dwfl_report_elf (Dwfl *dwfl, const char *name,
				     const char *file_name, int fd,
				     GElf_Addr base);

/* Similar, but report the module for offline use.  All ET_EXEC files
   being reported must be reported before any relocatable objects.
   If this is used, dwfl_report_module and dwfl_report_elf may not be
   used in the same reporting session.  */
extern Dwfl_Module *dwfl_report_offline (Dwfl *dwfl, const char *name,
					 const char *file_name, int fd);

/* Finish reporting the current set of modules to the library.
   If REMOVED is not null, it's called for each module that
   existed before but was not included in the current report.
   Returns a nonzero return value from the callback.
   The callback may call dwfl_report_module; doing so with the
   details of the module being removed prevents its removal.
   DWFL cannot be used until this function has returned zero.  */
extern int dwfl_report_end (Dwfl *dwfl,
			    int (*removed) (Dwfl_Module *, void *,
					    const char *, Dwarf_Addr,
					    void *arg),
			    void *arg);

/* Start reporting additional modules to the library.  No calls but
   dwfl_report_* can be made on DWFL until dwfl_report_end is called.
   This is like dwfl_report_begin, but all the old modules are kept on.
   More dwfl_report_* calls can follow to add more modules.
   When dwfl_report_end is called, no old modules will be removed.  */
extern void dwfl_report_begin_add (Dwfl *dwfl);

/* Return the name of the module, and for each non-null argument store
   interesting details: *USERDATA is a location for storing your own
   pointer, **USERDATA is initially null; *START and *END give the address
   range covered by the module; *DWBIAS is the address bias for debugging
   information, and *SYMBIAS for symbol table entries (either is -1 if not
   yet accessed); *MAINFILE is the name of the ELF file, and *DEBUGFILE the
   name of the debuginfo file (might be equal to *MAINFILE; either is null
   if not yet accessed).  */
extern const char *dwfl_module_info (Dwfl_Module *mod, void ***userdata,
				     Dwarf_Addr *start, Dwarf_Addr *end,
				     Dwarf_Addr *dwbias, Dwarf_Addr *symbias,
				     const char **mainfile,
				     const char **debugfile);

/* Iterate through the modules, starting the walk with OFFSET == 0.
   Calls *CALLBACK for each module as long as it returns DWARF_CB_OK.
   When *CALLBACK returns another value, the walk stops and the
   return value can be passed as OFFSET to resume it.  Returns 0 when
   there are no more modules, or -1 for errors.  */
extern ptrdiff_t dwfl_getmodules (Dwfl *dwfl,
				  int (*callback) (Dwfl_Module *, void **,
						   const char *, Dwarf_Addr,
						   void *arg),
				  void *arg,
				  ptrdiff_t offset);

/* Find the module containing the given address.  */
extern Dwfl_Module *dwfl_addrmodule (Dwfl *dwfl, Dwarf_Addr address);

/* Find the segment, if any, and module, if any, containing ADDRESS.
   Returns a segment index returned by dwfl_report_segment, or -1
   if no segment matches the address.  Regardless of the return value,
   *MOD is always set to the module containing ADDRESS, or to null.  */
extern int dwfl_addrsegment (Dwfl *dwfl, Dwarf_Addr address, Dwfl_Module **mod);

/* Report the known build ID bits associated with a module.
   If VADDR is nonzero, it gives the absolute address where those
   bits are found within the module.  This can be called at any
   time, but is usually used immediately after dwfl_report_module.
   Once the module's main ELF file is opened, the ID note found
   there takes precedence and cannot be changed.  */
extern int dwfl_module_report_build_id (Dwfl_Module *mod,
					const unsigned char *bits, size_t len,
					GElf_Addr vaddr)
  __nonnull_attribute__ (2);

/* Extract the build ID bits associated with a module.
   Returns -1 for errors, 0 if no ID is known, or the number of ID bytes.
   When an ID is found, *BITS points to it; *VADDR is the absolute address
   at which the ID bits are found within the module, or 0 if unknown.

   This returns 0 when the module's main ELF file has not yet been loaded
   and its build ID bits were not reported.  To ensure the ID is always
   returned when determinable, call dwfl_module_getelf first.  */
extern int dwfl_module_build_id (Dwfl_Module *mod,
				 const unsigned char **bits, GElf_Addr *vaddr)
  __nonnull_attribute__ (2, 3);

/*** Standard callbacks ***/

/* These standard find_elf and find_debuginfo callbacks are
   controlled by a string specifying directories to look in.
   If `debuginfo_path' is set in the Dwfl_Callbacks structure
   and the char * it points to is not null, that supplies the
   string.  Otherwise a default path is used.

   If the first character of the string is + or - that enables or
   disables CRC32 checksum validation when it's necessary.  The
   remainder of the string is composed of elements separated by
   colons.  Each element can start with + or - to override the
   global checksum behavior.  This flag is never relevant when
   working with build IDs, but it's always parsed in the path
   string.  The remainder of the element indicates a directory.

   Searches by build ID consult only the elements naming absolute
   directory paths.  They look under those directories for a link
   named ".build-id/xx/yy" or ".build-id/xx/yy.debug", where "xxyy"
   is the lower-case hexadecimal representation of the ID bytes.

   In searches for debuginfo by name, if the remainder of the
   element is empty, the directory containing the main file is
   tried; if it's an absolute path name, the absolute directory path
   containing the main file is taken as a subdirectory of this path;
   a relative path name is taken as a subdirectory of the directory
   containing the main file.  Hence for /bin/ls, the default string
   ":.debug:/usr/lib/debug" says to look in /bin, then /bin/.debug,
   then /usr/lib/debug/bin, for the file name in the .gnu_debuglink
   section (or "ls.debug" if none was found).  */

/* Standard find_elf callback function working solely on build ID.
   This can be tried first by any find_elf callback, to use the
   bits passed to dwfl_module_report_build_id, if any.  */
extern int dwfl_build_id_find_elf (Dwfl_Module *, void **,
				   const char *, Dwarf_Addr,
				   char **, Elf **);

/* Standard find_debuginfo callback function working solely on build ID.
   This can be tried first by any find_debuginfo callback,
   to use the build ID bits from the main file when present.  */
extern int dwfl_build_id_find_debuginfo (Dwfl_Module *, void **,
					 const char *, Dwarf_Addr,
					 const char *, const char *,
					 GElf_Word, char **);

/* Standard find_debuginfo callback function.
   If a build ID is available, this tries first to use that.
   If there is no build ID or no valid debuginfo found by ID,
   it searches the debuginfo path by name, as described above.
   Any file found in the path is validated by build ID if possible,
   or else by CRC32 checksum if enabled, and skipped if it does not match.  */
extern int dwfl_standard_find_debuginfo (Dwfl_Module *, void **,
					 const char *, Dwarf_Addr,
					 const char *, const char *,
					 GElf_Word, char **);

/* This callback must be used when using dwfl_offline_* to report modules,
   if ET_REL is to be supported.  */
extern int dwfl_offline_section_address (Dwfl_Module *, void **,
					 const char *, Dwarf_Addr,
					 const char *, GElf_Word,
					 const GElf_Shdr *,
					 Dwarf_Addr *addr);

/* Callbacks for working with kernel modules in the running Linux kernel.  */
extern int dwfl_linux_kernel_find_elf (Dwfl_Module *, void **,
				       const char *, Dwarf_Addr,
				       char **, Elf **);
extern int dwfl_linux_kernel_module_section_address (Dwfl_Module *, void **,
						     const char *, Dwarf_Addr,
						     const char *, GElf_Word,
						     const GElf_Shdr *,
						     Dwarf_Addr *addr);

/* Call dwfl_report_elf for the running Linux kernel.
   Returns zero on success, -1 if dwfl_report_module failed,
   or an errno code if opening the kernel binary failed.  */
extern int dwfl_linux_kernel_report_kernel (Dwfl *dwfl);

/* Call dwfl_report_module for each kernel module in the running Linux kernel.
   Returns zero on success, -1 if dwfl_report_module failed,
   or an errno code if reading the list of modules failed.  */
extern int dwfl_linux_kernel_report_modules (Dwfl *dwfl);

/* Report a kernel and its modules found on disk, for offline use.
   If RELEASE starts with '/', it names a directory to look in;
   if not, it names a directory to find under /lib/modules/;
   if null, /lib/modules/`uname -r` is used.
   Returns zero on success, -1 if dwfl_report_module failed,
   or an errno code if finding the files on disk failed.

   If PREDICATE is not null, it is called with each module to be reported;
   its arguments are the module name, and the ELF file name or null if unknown,
   and its return value should be zero to skip the module, one to report it,
   or -1 to cause the call to fail and return errno.  */
extern int dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release,
					     int (*predicate) (const char *,
							       const char *));

/* Call dwfl_report_module for each file mapped into the address space of PID.
   Returns zero on success, -1 if dwfl_report_module failed,
   or an errno code if opening the kernel binary failed.  */
extern int dwfl_linux_proc_report (Dwfl *dwfl, pid_t pid);

/* Similar, but reads an input stream in the format of Linux /proc/PID/maps
   files giving module layout, not the file for a live process.  */
extern int dwfl_linux_proc_maps_report (Dwfl *dwfl, FILE *);

/* Trivial find_elf callback for use with dwfl_linux_proc_report.
   This uses the module name as a file name directly and tries to open it
   if it begin with a slash, or handles the magic string "[vdso]".  */
extern int dwfl_linux_proc_find_elf (Dwfl_Module *mod, void **userdata,
				     const char *module_name, Dwarf_Addr base,
				     char **file_name, Elf **);

/* Standard argument parsing for using a standard callback set.  */
struct argp;
extern const struct argp *dwfl_standard_argp (void) __attribute__ ((const));

/*** Relocation of addresses from Dwfl ***/

/* Return the number of relocatable bases associated with the module,
   which is zero for ET_EXEC and one for ET_DYN.  Returns -1 for errors.  */
extern int dwfl_module_relocations (Dwfl_Module *mod);

/* Return the relocation base index associated with the *ADDRESS location,
   and adjust *ADDRESS to be an offset relative to that base.
   Returns -1 for errors.  */
extern int dwfl_module_relocate_address (Dwfl_Module *mod,
					 Dwarf_Addr *address);

/* Return the ELF section name for the given relocation base index;
   if SHNDXP is not null, set *SHNDXP to the ELF section index.
   For ET_DYN, returns "" and sets *SHNDXP to SHN_ABS; the relocation
   base is the runtime start address reported for the module.
   Returns null for errors.  */
extern const char *dwfl_module_relocation_info (Dwfl_Module *mod,
						unsigned int idx,
						GElf_Word *shndxp);

/* Validate that ADDRESS and ADDRESS+OFFSET lie in a known module
   and both within the same contiguous region for relocation purposes.
   Returns zero for success and -1 for errors.  */
extern int dwfl_validate_address (Dwfl *dwfl,
				  Dwarf_Addr address, Dwarf_Sword offset);

/*** ELF access functions ***/

/* Fetch the module main ELF file (where the allocated sections
   are found) for use with libelf.  If successful, fills in *BIAS
   with the difference between addresses within the loaded module
   and those in symbol tables or Dwarf information referring to it.  */
extern Elf *dwfl_module_getelf (Dwfl_Module *, GElf_Addr *bias);

/* Return the number of symbols in the module's symbol table,
   or -1 for errors.  */
extern int dwfl_module_getsymtab (Dwfl_Module *mod);

/* Fetch one entry from the module's symbol table.  On errors, returns
   NULL.  If successful, fills in *SYM and returns the string for st_name.
   This works like gelf_getsym except that st_value is always adjusted
   to an absolute value based on the module's location.  If SHNDXP is
   non-null, it's set with the section index (whether from st_shndx or
   extended index table).  */
extern const char *dwfl_module_getsym (Dwfl_Module *mod, int ndx,
				       GElf_Sym *sym, GElf_Word *shndxp)
  __nonnull_attribute__ (3);

/* Find the symbol that ADDRESS lies inside, and return its name.  */
extern const char *dwfl_module_addrname (Dwfl_Module *mod, GElf_Addr address);

/* Find the symbol that ADDRESS lies inside, and return detailed
   information as for dwfl_module_getsym (above).  */
extern const char *dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr address,
					GElf_Sym *sym, GElf_Word *shndxp)
  __nonnull_attribute__ (3);

/* Find the ELF section that *ADDRESS lies inside and return it.
   On success, adjusts *ADDRESS to be relative to the section,
   and sets *BIAS to the difference between addresses used in
   the returned section's headers and run-time addresses.  */
extern Elf_Scn *dwfl_module_address_section (Dwfl_Module *mod,
					     Dwarf_Addr *address,
					     Dwarf_Addr *bias)
  __nonnull_attribute__ (2, 3);

/*** Dwarf access functions ***/

/* Fetch the module's debug information for use with libdw.
   If successful, fills in *BIAS with the difference between
   addresses within the loaded module and those  to use with libdw.  */
extern Dwarf *dwfl_module_getdwarf (Dwfl_Module *, Dwarf_Addr *bias)
     __nonnull_attribute__ (2);

/* Get the libdw handle for each module.  */
extern ptrdiff_t dwfl_getdwarf (Dwfl *,
				int (*callback) (Dwfl_Module *, void **,
						 const char *, Dwarf_Addr,
						 Dwarf *, Dwarf_Addr, void *),
				void *arg, ptrdiff_t offset);

/* Look up the module containing ADDR and return its debugging information,
   loading it if necessary.  */
extern Dwarf *dwfl_addrdwarf (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Addr *bias)
     __nonnull_attribute__ (3);

/* Find the CU containing ADDR and return its DIE.  */
extern Dwarf_Die *dwfl_addrdie (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Addr *bias)
     __nonnull_attribute__ (3);
extern Dwarf_Die *dwfl_module_addrdie (Dwfl_Module *mod,
				       Dwarf_Addr addr, Dwarf_Addr *bias)
     __nonnull_attribute__ (3);

/* Iterate through the CUs, start with null for LASTCU.  */
extern Dwarf_Die *dwfl_nextcu (Dwfl *dwfl, Dwarf_Die *lastcu, Dwarf_Addr *bias)
     __nonnull_attribute__ (3);
extern Dwarf_Die *dwfl_module_nextcu (Dwfl_Module *mod,
				      Dwarf_Die *lastcu, Dwarf_Addr *bias)
     __nonnull_attribute__ (3);

/* Return the module containing the CU DIE.  */
extern Dwfl_Module *dwfl_cumodule (Dwarf_Die *cudie);

/* Cache the source line information fo the CU and return the
   number of Dwfl_Line entries it has.  */
extern int dwfl_getsrclines (Dwarf_Die *cudie, size_t *nlines);

/* Access one line number entry within the CU.  */
extern Dwfl_Line *dwfl_onesrcline (Dwarf_Die *cudie, size_t idx);

/* Get source for address.  */
extern Dwfl_Line *dwfl_module_getsrc (Dwfl_Module *mod, Dwarf_Addr addr);
extern Dwfl_Line *dwfl_getsrc (Dwfl *dwfl, Dwarf_Addr addr);

/* Get address for source.  */
extern int dwfl_module_getsrc_file (Dwfl_Module *mod,
				    const char *fname, int lineno, int column,
				    Dwfl_Line ***srcsp, size_t *nsrcs);

/* Return the module containing this line record.  */
extern Dwfl_Module *dwfl_linemodule (Dwfl_Line *line);

/* Return the CU containing this line record.  */
extern Dwarf_Die *dwfl_linecu (Dwfl_Line *line);

/* Return the source file name and fill in other information.
   Arguments may be null for unneeded fields.  */
extern const char *dwfl_lineinfo (Dwfl_Line *line, Dwarf_Addr *addr,
				  int *linep, int *colp,
				  Dwarf_Word *mtime, Dwarf_Word *length);

/* Return the compilation directory (AT_comp_dir) from this line's CU.  */
extern const char *dwfl_line_comp_dir (Dwfl_Line *line);

/*** Machine backend access functions ***/

/* Return location expression to find return value given a
   DW_TAG_subprogram, DW_TAG_subroutine_type, or similar DIE describing
   function itself (whose DW_AT_type attribute describes its return type).
   The given DIE must come from the given module.  Returns -1 for errors.
   Returns zero if the function has no return value (e.g. "void" in C).
   Otherwise, *LOCOPS gets a location expression to find the return value,
   and returns the number of operations in the expression.  The pointer is
   permanently allocated at least as long as the module is live.  */
extern int dwfl_module_return_value_location (Dwfl_Module *mod,
					      Dwarf_Die *functypedie,
					      const Dwarf_Op **locops);

/* Enumerate the DWARF register numbers and their names.
   For each register, CALLBACK gets its DWARF number, a string describing
   the register set (such as "integer" or "FPU"), a prefix used in
   assembler syntax (such as "%" or "$", may be ""), and the name for the
   register (contains identifier characters only, possibly all digits).
   The REGNAME string is valid only during the callback. */
extern int dwfl_module_register_names (Dwfl_Module *mod,
				       int (*callback) (void *arg,
							int regno,
							const char *setname,
							const char *prefix,
							const char *regname,
							int bits, int type),
				       void *arg);

#ifdef __cplusplus
}
#endif

#endif	/* libdwfl.h */


text:
package tfo.junit.matcher.file;

import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.nio.file.Path;
import java.util.Objects;

import static org.hamcrest.CoreMatchers.describedAs;
import static org.hamcrest.CoreMatchers.equalTo;

@SuppressWarnings("unused") // API methods
public final class DirectoryMatchers {

    private DirectoryMatchers() {
        // no instances.
    }

    /**
     * Checks whether a directory contains a file.
     *
     * @param name the name of the file.
     * @return the matcher.
     */
    @Factory
    @NotNull
	public static Matcher<File> containsFile(@NotNull String name) {
		return new ContainsFileMatcher<>(name);
	}

    /**
     * Checks whether a directory contains a file.
     *
     * @param name the name of the file.
     * @return the matcher.
     */
    @Factory
    @NotNull
	public static Matcher<Path> containsFileByPath(@NotNull String name) {
		return new ContainsFileMatcher<>(name);
	}

    /**
     * Checks whether a directory contains a number of files.
     *
     * @param number the number of files to expect. Must be >= 0.
     * @return the matcher.
     */
    @Factory
    @NotNull
    public static Matcher<File> containsNumberOfFiles(int number) {
        if (number < 0) {
            throw new IllegalArgumentException("There can't be less than zero files. But you expected " + number);
        }
        final ContainsNumberOfFilesMatcher<File> result = new ContainsNumberOfFilesMatcher<>(equalTo(number));
        if (number == 0) {
            return describedAs("a directory with no files", result);
        }
        return result;
    }

    /**
     * Checks whether a directory contains a number of files.
     *
     * @param number the number of files to expect. Must be >= 0.
     * @return the matcher.
     */
    @Factory
    @NotNull
    public static Matcher<Path> containsNumberOfFilesByPath(int number) {
        if (number < 0) {
            throw new IllegalArgumentException("There can't be less than zero files. But you expected " + number);
        }
        final ContainsNumberOfFilesMatcher<Path> result = new ContainsNumberOfFilesMatcher<>(equalTo(number));
        if (number == 0) {
            return describedAs("a directory with no files", result);
        }
        return result;
    }

    /**
     * Checks whether a directory contains a number of files.
     *
     * @param matcher the matcher that checks the number of files.
     * @return the matcher.
     */
    @Factory
    @NotNull
    public static Matcher<File> containsNumberOfFiles(@NotNull Matcher<? super Integer> matcher) {
        Objects.requireNonNull(matcher);
        // there's no further error checking here, because there's no way to know if got something useful passed into
        // this method.
        return new ContainsNumberOfFilesMatcher<>(matcher);
    }

    /**
     * Checks whether a directory contains a number of files.
     *
     * @param matcher the matcher that checks the number of files.
     * @return the matcher.
     */
    @Factory
    @NotNull
    public static Matcher<Path> containsNumberOfFilesByPath(@NotNull Matcher<? super Integer> matcher) {
        Objects.requireNonNull(matcher);
        // there's no further error checking here, because there's no way to know if got something useful passed into
        // this method.
        return new ContainsNumberOfFilesMatcher<>(matcher);
    }

    /**
     * Checks whether a directory contains a number of subdirectories.
     *
     * @param number the number of directories to expect. Must be >= 0.
     * @return the matcher.
     */
    @Factory
    @NotNull
    public static Matcher<File> containsNumberOfDirectories(int number) {
        if (number < 0) {
            throw new IllegalArgumentException("There can't be less than zero directories. But you expected " + number);
        }
        final ContainsNumberOfDirectoriesMatcher<File> result = new ContainsNumberOfDirectoriesMatcher<>(equalTo(number));
        if (number == 0) {
            return describedAs("a directory with no subdirectories", result);
        }
        return result;
    }

    /**
     * Checks whether a directory contains a number of subdirectories.
     *
     * @param number the number of files to expect. Must be >= 0.
     * @return the matcher.
     */
    @Factory
    @NotNull
    public static Matcher<Path> containsNumberOfDirectoriesByPath(int number) {
        if (number < 0) {
            throw new IllegalArgumentException("There can't be less than zero directories. But you expected " + number);
        }
        final ContainsNumberOfDirectoriesMatcher<Path> result = new ContainsNumberOfDirectoriesMatcher<>(equalTo(number));
        if (number == 0) {
            return describedAs("a directory with no subdirectories", result);
        }
        return result;
    }

    /**
     * Checks whether a directory contains a number of subdirectories.
     *
     * @param matcher the matcher that checks the number of directories.
     * @return the matcher.
     */
    @Factory
    @NotNull
    public static Matcher<File> containsNumberOfDirectories(@NotNull Matcher<? super Integer> matcher) {
        Objects.requireNonNull(matcher);
        // there's no further error checking here, because there's no way to know if got something useful passed into
        // this method.
        return new ContainsNumberOfDirectoriesMatcher<>(matcher);
    }

    /**
     * Checks whether a directory contains a number of subdirectories.
     *
     * @param matcher the matcher that checks the number of directories.
     * @return the matcher.
     */
    @Factory
    @NotNull
    public static Matcher<Path> containsNumberOfDirectoriesByPath(@NotNull Matcher<? super Integer> matcher) {
        Objects.requireNonNull(matcher);
        // there's no further error checking here, because there's no way to know if got something useful passed into
        // this method.
        return new ContainsNumberOfDirectoriesMatcher<>(matcher);
    }

    /**
     * Checks whether a directory contains a subdirectory.
     *
     * @param name the name of the subdirectory.
     * @return the matcher.
     * @see #missesDir(String)
     */
    @Factory
    @NotNull
	public static Matcher<File> containsDir(@NotNull String name) {
		return new ContainsDirectoryMatcher<>(name);
	}

    /**
     * Checks whether a directory contains a subdirectory.
     *
     * @param name the name of the subdirectory.
     * @return the matcher.
     * @see #missesDir(String)
     */
    @Factory
    @NotNull
	public static Matcher<Path> containsDirByPath(@NotNull String name) {
		return new ContainsDirectoryMatcher<>(name);
	}

    /**
     * Checks whether a directory does not contain a subdirectory.
     *
     * @param name the name of the subdirectory.
     * @return the matcher.
     */
    @Factory
    @NotNull
	public static Matcher<File> missesDir(@NotNull String name) {
		return new MissesDirectoryMatcher<>(name);
	}

    /**
     * Checks whether a directory does not contain a subdirectory.
     *
     * @param name the name of the subdirectory.
     * @return the matcher.
     */
    @Factory
    @NotNull
	public static Matcher<Path> missesDirByPath(@NotNull String name) {
		return new MissesDirectoryMatcher<>(name);
	}

    /**
     * Checks whether a directory does not contain a file.
     *
     * @param name the name of the file.
     * @return the matcher.
     */
    @Factory
    @NotNull
	public static Matcher<File> missesFile(@NotNull String name) {
		return new MissesFileMatcher<>(name);
	}

    /**
     * Checks whether a directory does not contain a file.
     *
     * @param name the name of the file.
     * @return the matcher.
     */
    @Factory
    @NotNull
	public static Matcher<Path> missesFileByPath(@NotNull String name) {
		return new MissesFileMatcher<>(name);
	}

    /**
     * Checks whether a directory is empty.
     *
     * @return the matcher.
     */
    @Factory
    @NotNull
	public static Matcher<File> isEmpty() {
		return new EmptyDirectoryMatcher<>();
	}

    /**
     * Checks whether a directory is empty.
     *
     * @return the matcher.
     */
    @Factory
    @NotNull
	public static Matcher<Path> isEmptyByPath() {
		return new EmptyDirectoryMatcher<>();
	}
}


text:
WindowsPhoneUtils
=================

Utilities for windows phone app development

___
## Included utilities

- ####Controls
    - **Sliding Menu** - Side sliding menu, can be controlled by touch or with a button, with animations.
    - **List Content Presenter** - Simple swipe content present, with animations.
    - **Remote Image** - Shows a progress bar while the image loads.
    - **Youtube Image** - Shows a progress bar until the youtube image finishes loading.

- ####XAML
    - Converters
    - Command

- ####Data
    - Model Data serialization helper
    - ViewModel with easy _INotifyPropertyChanged_ implementation

- ####Others
    - Parallel Task
    - VisualTreeHelper
    - Color Lerper Extensions
    - ManifestInfo
    - ScreenSize
    - Async HTTP Extensions

___
#### License

MIT License, see the [LICENSE file](/blob/master/LICENSE).

___
#### Problems and Questions

If you encounter any problems please report them here in github. If you have any questions contact me.


text:
from .. import auth, utils

class PluginApiMixin:
    @utils.minimum_version('1.25')
    @utils.check_resource('name')
    def configure_plugin(self, name, options):
        """
            Configure a plugin.

            Args:
                name (string): The name of the plugin. The ``:latest`` tag is
                    optional, and is the default if omitted.
                options (dict): A key-value mapping of options

            Returns:
                ``True`` if successful
        """
        url = self._url('/plugins/{0}/set', name)
        data = options
        if isinstance(data, dict):
            data = [f'{k}={v}' for k, v in data.items()]
        res = self._post_json(url, data=data)
        self._raise_for_status(res)
        return True

    @utils.minimum_version('1.25')
    def create_plugin(self, name, plugin_data_dir, gzip=False):
        """
            Create a new plugin.

            Args:
                name (string): The name of the plugin. The ``:latest`` tag is
                    optional, and is the default if omitted.
                plugin_data_dir (string): Path to the plugin data directory.
                    Plugin data directory must contain the ``config.json``
                    manifest file and the ``rootfs`` directory.
                gzip (bool): Compress the context using gzip. Default: False

            Returns:
                ``True`` if successful
        """
        url = self._url('/plugins/create')

        with utils.create_archive(
            root=plugin_data_dir, gzip=gzip,
            files=set(utils.build.walk(plugin_data_dir, []))
        ) as archv:
            res = self._post(url, params={'name': name}, data=archv)
        self._raise_for_status(res)
        return True

    @utils.minimum_version('1.25')
    def disable_plugin(self, name, force=False):
        """
            Disable an installed plugin.

            Args:
                name (string): The name of the plugin. The ``:latest`` tag is
                    optional, and is the default if omitted.
                force (bool): To enable the force query parameter.

            Returns:
                ``True`` if successful
        """
        url = self._url('/plugins/{0}/disable', name)
        res = self._post(url, params={'force': force})
        self._raise_for_status(res)
        return True

    @utils.minimum_version('1.25')
    def enable_plugin(self, name, timeout=0):
        """
            Enable an installed plugin.

            Args:
                name (string): The name of the plugin. The ``:latest`` tag is
                    optional, and is the default if omitted.
                timeout (int): Operation timeout (in seconds). Default: 0

            Returns:
                ``True`` if successful
        """
        url = self._url('/plugins/{0}/enable', name)
        params = {'timeout': timeout}
        res = self._post(url, params=params)
        self._raise_for_status(res)
        return True

    @utils.minimum_version('1.25')
    def inspect_plugin(self, name):
        """
            Retrieve plugin metadata.

            Args:
                name (string): The name of the plugin. The ``:latest`` tag is
                    optional, and is the default if omitted.

            Returns:
                A dict containing plugin info
        """
        url = self._url('/plugins/{0}/json', name)
        return self._result(self._get(url), True)

    @utils.minimum_version('1.25')
    def pull_plugin(self, remote, privileges, name=None):
        """
            Pull and install a plugin. After the plugin is installed, it can be
            enabled using :py:meth:`~enable_plugin`.

            Args:
                remote (string): Remote reference for the plugin to install.
                    The ``:latest`` tag is optional, and is the default if
                    omitted.
                privileges (:py:class:`list`): A list of privileges the user
                    consents to grant to the plugin. Can be retrieved using
                    :py:meth:`~plugin_privileges`.
                name (string): Local name for the pulled plugin. The
                    ``:latest`` tag is optional, and is the default if omitted.

            Returns:
                An iterable object streaming the decoded API logs
        """
        url = self._url('/plugins/pull')
        params = {
            'remote': remote,
        }
        if name:
            params['name'] = name

        headers = {}
        registry, repo_name = auth.resolve_repository_name(remote)
        header = auth.get_config_header(self, registry)
        if header:
            headers['X-Registry-Auth'] = header
        response = self._post_json(
            url, params=params, headers=headers, data=privileges,
            stream=True
        )
        self._raise_for_status(response)
        return self._stream_helper(response, decode=True)

    @utils.minimum_version('1.25')
    def plugins(self):
        """
            Retrieve a list of installed plugins.

            Returns:
                A list of dicts, one per plugin
        """
        url = self._url('/plugins')
        return self._result(self._get(url), True)

    @utils.minimum_version('1.25')
    def plugin_privileges(self, name):
        """
            Retrieve list of privileges to be granted to a plugin.

            Args:
                name (string): Name of the remote plugin to examine. The
                    ``:latest`` tag is optional, and is the default if omitted.

            Returns:
                A list of dictionaries representing the plugin's
                permissions

        """
        params = {
            'remote': name,
        }

        headers = {}
        registry, repo_name = auth.resolve_repository_name(name)
        header = auth.get_config_header(self, registry)
        if header:
            headers['X-Registry-Auth'] = header

        url = self._url('/plugins/privileges')
        return self._result(
            self._get(url, params=params, headers=headers), True
        )

    @utils.minimum_version('1.25')
    @utils.check_resource('name')
    def push_plugin(self, name):
        """
            Push a plugin to the registry.

            Args:
                name (string): Name of the plugin to upload. The ``:latest``
                    tag is optional, and is the default if omitted.

            Returns:
                ``True`` if successful
        """
        url = self._url('/plugins/{0}/pull', name)

        headers = {}
        registry, repo_name = auth.resolve_repository_name(name)
        header = auth.get_config_header(self, registry)
        if header:
            headers['X-Registry-Auth'] = header
        res = self._post(url, headers=headers)
        self._raise_for_status(res)
        return self._stream_helper(res, decode=True)

    @utils.minimum_version('1.25')
    @utils.check_resource('name')
    def remove_plugin(self, name, force=False):
        """
            Remove an installed plugin.

            Args:
                name (string): Name of the plugin to remove. The ``:latest``
                    tag is optional, and is the default if omitted.
                force (bool): Disable the plugin before removing. This may
                    result in issues if the plugin is in use by a container.

            Returns:
                ``True`` if successful
        """
        url = self._url('/plugins/{0}', name)
        res = self._delete(url, params={'force': force})
        self._raise_for_status(res)
        return True

    @utils.minimum_version('1.26')
    @utils.check_resource('name')
    def upgrade_plugin(self, name, remote, privileges):
        """
            Upgrade an installed plugin.

            Args:
                name (string): Name of the plugin to upgrade. The ``:latest``
                    tag is optional and is the default if omitted.
                remote (string): Remote reference to upgrade to. The
                    ``:latest`` tag is optional and is the default if omitted.
                privileges (:py:class:`list`): A list of privileges the user
                    consents to grant to the plugin. Can be retrieved using
                    :py:meth:`~plugin_privileges`.

            Returns:
                An iterable object streaming the decoded API logs
        """

        url = self._url('/plugins/{0}/upgrade', name)
        params = {
            'remote': remote,
        }

        headers = {}
        registry, repo_name = auth.resolve_repository_name(remote)
        header = auth.get_config_header(self, registry)
        if header:
            headers['X-Registry-Auth'] = header
        response = self._post_json(
            url, params=params, headers=headers, data=privileges,
            stream=True
        )
        self._raise_for_status(response)
        return self._stream_helper(response, decode=True)