text:
<?php

//
// Configuration уведомлений
//
//

defined( 'ABSPATH' ) || exit;

if ( mif_bpc_options( 'notifications' ) ) {

    global $mif_bpc_notifications;
    $mif_bpc_notifications = new mif_bpc_notifications();

}

class mif_bpc_notifications {

    //
    // Стандартный механизм уведомлений, но с улучшенной интерфейсной частью
    //

    //
    // Сколько уведомлений показывать на странице
    //

    public $per_page = 15;

    function __construct()
    {

        // Новая страница уведомлений
        add_action( 'bp_activity_setup_nav', array( $this, 'notifications_nav' ) );
        add_action( 'bp_init', array( $this, 'delete_notifications_nav' ) );

        // Обработка кнопок в списке уведомлений
        add_action( 'wp_print_scripts', array( $this, 'load_js_helper' ) );
        add_action( 'wp_ajax_mif-bpc-notifications-load-more', array( $this, 'ajax_helper_load_more' ) );
        add_action( 'wp_ajax_mif-bpc-notification-delete', array( $this, 'ajax_helper_delete' ) );
        add_action( 'wp_ajax_mif-bpc-notification-to-new', array( $this, 'ajax_helper_to_new' ) );
        add_action( 'wp_ajax_mif-bpc-notification-to-not-new', array( $this, 'ajax_helper_to_not_new' ) );
        add_action( 'wp_ajax_mif-bpc-notification-bulk-not-is-new', array( $this, 'ajax_helper_bulk_not_is_new' ) );
        add_action( 'wp_ajax_mif-bpc-notification-bulk-delete', array( $this, 'ajax_helper_bulk_delete' ) );
        add_action( 'wp_ajax_mif-bpc-float-notification-update', array( $this, 'ajax_helper_float_update' ) );

        // Корректировка запроса
        add_filter( 'bp_notifications_get_where_conditions', array( $this, 'where_conditions' ) );

        add_action( 'bp_notification_before_update', array( $this, 'remove_cache' ) );
        add_action( 'bp_notification_before_delete', array( $this, 'remove_cache' ) );

        add_action( 'wp_footer', array( $this, 'float_notifications' ) );
    }

    //
    // Всплывающие уведомления
    //

    function float_notifications()
    {
        if ( ! is_main_site() ) return;
        if ( ! is_user_logged_in() ) return;

        echo '
';
        echo implode( '', $this->get_float_notifications() );
        echo '
';

        $audio = apply_filters( 'mif_bpc_notifications_audio', plugins_url( '../media/notify5.ogg', __FILE__ ) );

        echo '<audio id="notification_notify" src="' . $audio . '" type="audio/ogg"></audio>';

    }

    function get_float_notifications()
    {
        $arr = array();
        $user_id = bp_loggedin_user_id();

        if ( bp_has_notifications( array( 'user_id' => $user_id, 'per_page' => 5, 'is_new' => 1 ) ) ) {

            while ( bp_the_notifications() ) : bp_the_notification();

                $arr[bp_get_the_notification_id()] = $this->get_notification_item();

            endwhile;
        }

        return $arr;
    }

    function get_notification_item()
    {
        $out = '';

        $icons = array(
                        'messages' => '',
                        'groups' => '',
                        'friends' => '',
                        'activity' => '',
                        'default' => '',
                        );

        $type = bp_get_the_notification_component_name();
        $icon = ( isset( $icons[$type] ) ) ? $icons[$type] : $icons['default'];

        global $bp;
        $id = bp_get_the_notification_id();
        $url = wp_nonce_url( $bp->displayed_user->domain . $bp->messages->slug . '/notifications/is_new/?id=' . $id, 'mif_bpc_notification_is_new_status' );

        $out .= '
';
        $out .= '' . bp_get_the_notification_description() . '';
        $out .= $this->notification_avatar( 40, false );
        $out .= '';
        $out .= $icon;
        $out .= '
';

        return $out;
    }

    //
    // Update блок всплывающих уведомлений
    //

    function ajax_helper_float_update()
    {
        $arr = $this->get_float_notifications();
        $arr[0] = mif_bpc_new_notifications_count();

        echo json_encode( $arr );

        wp_die();
    }

    //
    // Обработка действий кнопок в списке уведомлений
    //

    //
    // Delete отмеченные
    //

    function ajax_helper_bulk_delete()
    {
        check_ajax_referer( 'mif_bpc_notifications_bulk_delete' );

        $arr = array_map( 'sanitize_key', $_POST['arr'] );
        foreach ( $arr as $item ) bp_notifications_delete_notification( $item );
        echo mif_bpc_new_notifications_count();

        wp_die();
    }

    //
    // Отметить отмеченные как прочитанное
    //

    function ajax_helper_bulk_not_is_new()
    {
        check_ajax_referer( 'mif_bpc_notifications_bulk_not_is_new' );

        $arr = array_map( 'sanitize_key', $_POST['arr'] );
        foreach ( $arr as $item ) bp_notifications_mark_notification( $item, false );
        echo mif_bpc_new_notifications_count();

        wp_die();
    }

    //
    // Mark as read
    //

    function ajax_helper_to_not_new()
    {
        check_ajax_referer( 'mif_bpc_notification_is_new_status' );

        $id = (int) $_POST['id'];

        if ( isset( $id ) ) $ret = bp_notifications_mark_notification( $id, false );
        if ( $ret ) echo mif_bpc_new_notifications_count();

        wp_die();
    }

    //
    // Отметить как новое
    //

    function ajax_helper_to_new()
    {
        check_ajax_referer( 'mif_bpc_notification_is_new_status' );

        $id = (int) $_POST['id'];

        if ( isset( $id ) ) $ret = bp_notifications_mark_notification( $id, true );
        if ( $ret ) echo mif_bpc_new_notifications_count();

        wp_die();
    }

    //
    // Delete уведомление
    //

    function ajax_helper_delete()
    {
        check_ajax_referer( 'mif_bpc_notification_delete' );

        $id = (int) $_POST['id'];
        if ( isset( $id ) ) $ret = bp_notifications_delete_notification( $id );
        if ( $ret ) echo mif_bpc_new_notifications_count();

        wp_die();
    }

    //
    // Кнопка "читать далее"
    //

    function ajax_helper_load_more()
    {
        check_ajax_referer( 'mif_bpc_notifications_load_more' );

        $page = (int) $_POST['page'];
        $page = ( $page ) ? $page : 1;

        if ( bp_has_notifications( array( 'per_page' => $this->per_page, 'page' => $page, 'is_new' => 0 ) ) ) {

            $i == 0;
			while ( bp_the_notifications() ) : bp_the_notification();

                mif_bpc_the_notification_row();
                $i++;

            endwhile;

            if ( $i == $this->per_page ) {

                mif_bpc_the_notification_load_more( ++ $page );

            } else {

                echo '

';
            }

        }

        wp_die();
    }

    function load_js_helper()
    {
        wp_register_script( 'mif_bpc_notifications', plugins_url( '../js/notifications.js', __FILE__ ) );
        wp_enqueue_script( 'mif_bpc_notifications' );
    }

    //
    // Страница уведомлений
    //

    function notifications_nav()
    {
        global $bp;

        $parent_url = $bp->displayed_user->domain . $bp->messages->slug . '/';
        $parent_slug = $bp->messages->slug;

        $sub_nav = array(
                'name' => __( 'Notifications', 'mif-bpc' ),
                'slug' => 'notifications',
                'parent_url' => $parent_url,
                'parent_slug' => $parent_slug,
                'screen_function' => array( $this, 'screen' ),
                'position' => 50,
                'user_has_access'=>  bp_is_my_profile()
            );

        bp_core_new_subnav_item( $sub_nav );

    }

    //
    // Содержимое страниц
    //

    function screen()
    {
        global $bp;
        add_action( 'bp_template_content', array( $this, 'body' ) );
        bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }

    function body()
    {
        if ( $template = locate_template( 'notifications-loop.php' ) ) {

            load_template( $template, false );

        } else {

            load_template( dirname( __FILE__ ) . '/../templates/notifications-loop.php', false );

        }
    }

    //
    // Уточнить запрос уведомлений - показывать как новые, так и старые в одном списке
    //

    function where_conditions( $where_conditions )
    {
        if ( isset( $where_conditions['is_new'] ) && $where_conditions['is_new'] == 'is_new = 0' ) unset( $where_conditions['is_new'] );
        return $where_conditions;
    }

    //
    // Получить аватар уведомления
    //

    function notification_avatar( $width = 25, $is_title = true )
    {
        $type = bp_get_the_notification_component_name();

        switch ( $type ) {

            case 'activity' :
            case 'messages' :
                    $object = 'user';
                    $item_id = bp_get_the_notification_secondary_item_id();
                break;

            case 'friends' :
                    $object = 'user';
                    $item_id = bp_get_the_notification_item_id();
                break;

            case 'groups' :
                    $object = 'group';
                    $item_id = bp_get_the_notification_item_id();
                break;

            default :
                    $item_id = apply_filters( 'mif_bpc_get_notification_avatar_' . $type . '_item_id', bp_get_the_notification_item_id() );
                    $object = apply_filters( 'mif_bpc_get_notification_avatar_' . $type . '_object', 'user' );
                break;

        }

        switch ( $object ) {

            case 'user' :
                    $url = bp_core_get_user_domain( $item_id );
                    $title = bp_core_get_user_displayname( $item_id );
                break;

            case 'group' :
                    $url = bp_get_group_permalink( groups_get_group( array( 'group_id' => $item_id ) ) );
                    $title = bp_get_group_name( groups_get_group( array( 'group_id' => $item_id ) ) );
                break;

            default :
                    $url = apply_filters( 'mif_bpc_get_notification_avatar_' . $object . '_url', bp_core_get_user_domain( $item_id ) );
                break;

        }

        $title = ( $is_title ) ? $title : false;

        $out = '';
        $out .= '';
        $out .= bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'title' => $title, 'width' => $width ) );
        $out .= '';

        return $out;
    }

    //
    // Delete стандартную страницу уведомлений
    //

    function delete_notifications_nav()
    {
        bp_core_remove_nav_item( 'notifications' );
    }

    //
    // Delete кэш-данные о количестве новых уведомлений
    //

    function remove_cache()
    {
        $user_id = bp_loggedin_user_id();
        wp_cache_delete( 'mif_bpc_new_notifications_count', $user_id );
    }

}

//
// Функции шаблона
//

//
// Выводит аватар уведомления
//

function mif_bpc_the_notification_avatar()
{
    global $mif_bpc_notifications;
    echo $mif_bpc_notifications->notification_avatar();
}

//
// Проверить статус уведомления (прочитано or нет)
//

function mif_bpc_is_new_notification()
{
    $bp = buddypress();
    $res = ( $bp->notifications->query_loop->notification->is_new ) ? true : false;
    return $res;
}

//
// Кнопка "прочитано"
//

function mif_bpc_notification_is_new_button()
{
    $id = bp_get_the_notification_id();

    global $bp;
    $url = wp_nonce_url( $bp->displayed_user->domain . $bp->messages->slug . '/notifications/is_new/?id=' . $id, 'mif_bpc_notification_is_new_status' );

    $button1 = '

';

    echo $button1;

    $button2 = '

';

    echo $button2;
}

//
// Кнопка "удалить"
//

function mif_bpc_notification_delete_button()
{
    $id = bp_get_the_notification_id();

    global $bp;
    $url = wp_nonce_url( $bp->displayed_user->domain . $bp->messages->slug . '/notifications/delete/?id=' . $id, 'mif_bpc_notification_delete' );

    $button = '

';

    echo $button;
}

//
// Строка уведомления
//

function mif_bpc_the_notification_row()
{
?>
    <tr<?php if ( mif_bpc_is_new_notification() ) echo ' class="new"'; ?> id="tr-notification-<?php bp_the_notification_id(); ?>">
        <input id="chk-<?php bp_the_notification_id(); ?>" type="checkbox" name="notifications_ids[]" value="<?php bp_the_notification_id(); ?>" class="cn-check">
        <?php mif_bpc_the_notification_avatar() ?>
        <?php mif_bpc_notification_is_new_button() ?>
        <?php bp_the_notification_description(); ?>
        <?php bp_the_notification_time_since(); ?>
        <?php mif_bpc_notification_delete_button(); ?>

<?php
}

//
// Кнопка "Read more"
//

function mif_bpc_the_notification_load_more( $page = 2, $none = false )
{
    global $bp;

    $url = wp_nonce_url( $bp->displayed_user->domain . $bp->messages->slug . '/notifications/load-more/?page=' . $page, 'mif_bpc_notifications_load_more' );

    $total_count = buddypress()->notifications->query_loop->total_notification_count;

    if ( $none || $total_count <= mif_bpc_get_notifications_per_page() ) {

        $out = '

';

    } else {

        $out = '

' . __( 'Read more', 'mif-bpc' ) . '

';
    }

    echo $out;
}

//
// Bлок о количестве уведомлений
//

function mif_bpc_the_notifications_info()
{
    echo mif_bpc_get_notifications_info();
}

function mif_bpc_get_notifications_info()
{
    if ( ! mif_bpc_options( 'notifications' ) ) return;

    global $bp;

    $count = mif_bpc_new_notifications_count();
    $url = $bp->displayed_user->domain . $bp->messages->slug . '/notifications/';
    $none = ( $count > 0 ) ? '' : ' style="display: none;"';

    $out = '
' . __( 'New notifications', 'mif-bpc' ) . ': ' . $count . '
';

    return apply_filters( 'mif_bpc_get_notifications_info', $out, $count );
}

//
// Количество новых уведомлений
//

function mif_bpc_new_notifications_count( $user_id = NULL )
{
    global $bp, $wpdb;

    if ( $user_id == NULL ) $user_id = bp_loggedin_user_id();
    if ( empty( $user_id ) ) return 0;

    if ( ! $count = wp_cache_get( 'mif_bpc_new_notifications_count', $user_id ) ) {

        $count = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(user_id) FROM {$bp->notifications->table_name} WHERE user_id = %s AND is_new = '1'", $user_id ) );
        $count = apply_filters( 'mif_bpc_mif_bpc_new_notifications_count', $count, $user_id );

        wp_cache_set( 'mif_bpc_new_notifications_count', $count, $user_id );

    }

    return $count;
}

//
// Сколько уведомлений на странице
//

function mif_bpc_get_notifications_per_page()
{
    global $mif_bpc_notifications;
    return $mif_bpc_notifications->per_page;
}

//
// Получить url для кнопок групповой обработки уведомлений
//

function mif_bpc_the_notification_bulk_url( $mode = 'delete' )
{
    global $bp;
    echo wp_nonce_url( $bp->displayed_user->domain . $bp->messages->slug . '/notifications/' . $mode, 'mif_bpc_notifications_bulk_' . $mode );
}

?>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Ginger: include/seqan/computeSensSpec.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

Ginger

Main Page

Namespaces

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

File Members

 All Classes Namespaces Files Functions Variables

Functions

computeSensSpec.h File Reference

#include <seqan/basic.h>

#include <seqan/getIdWithoutMaster.h>

#include <seqan/GStructs/GMatch.h>

Go to the source code of this file.

Functions

template<typename TScore , typename TSequence >

int 	computeSensSpec (double &sensitivity, double &specitivity, String< GMatch< TScore, TSequence > > &shouldBe, String< GMatch< TScore, TSequence > > &actuallyIs, int datalength)

 	computes sensitivity of the Gsearch algorithm on the clustered database against the nonclustered database.

Function Documentation

template<typename TScore , typename TSequence >

          int computeSensSpec
          (
          double &
          sensitivity,

          double &
          specitivity,

          String< GMatch< TScore, TSequence > > &
          shouldBe,

          String< GMatch< TScore, TSequence > > &
          actuallyIs,

          int
          datalength

          )

computes sensitivity of the Gsearch algorithm on the clustered database against the nonclustered database.

specifity is can be computed too, therefore the database length is needed, but is commented out of the code since it is not necessary for the GSearch algorithm (Specifity is always 1).

Parameters

[out]	sensitivity	sensitivity container

[out]	specitivity	specifity container

[in]	shouldBe	first result which is to compare

[in]	actuallyIs	second result which is to compare

include

seqan

computeSensSpec.h

Generated on Fri May 24 2013 18:43:08 for Ginger by

     1.8.1.2

redpajama_set_name: RedPajamaGithub


text:
Revision control

Central revision control is by SVN. Although we describe guidelines
here for SVN, any version control system that interacts with SVN can
be used instead.  We ourselves use and support the distributed version
control system Git for Topographica's development; see our Git development instructions for details. However,
note that the rules below for using SVN still apply at the point of
interaction with the central SVN repository (including the rules
about svn properties such as mime-type and end-of-line).

Please check in changes as soon as they are stable, e.g. at least
by the end of each significant workday.  Conversely, be sure to update
your checked out code before doing any new work.  The goal is to make
sure that all developers are always working with the latest code.

Every SVN commit must include an informative log message,
summarizing the items changed in easily understandable terms, and
avoiding pejorative language (i.e. comments like "Lord only knows what
idiot coded it that way!"). If possible (e.g. when adding a feature or
fixing a bug), try to link the commit log message to one of the sf.net
tracker IDs (and mention the revision number that fixed the bug when
closing it on sf.net).  When describing the changes, it is crucial to
examine every line produced by svn diff to verify that
only intentional changes (and not stray characters or temporary
changes) are checked in, and that the log message covers all the
important changes.  You should also do svn status to make
sure that you don't have any important files not yet checked into SVN,
as svn diff will not report these.

If so many items were changed that any single log message would
have to be very general (e.g. "Misc changes to many files"), then
please check in smaller groups of files, each with a meaningful log
message. Using smaller,
meaningful chunks also makes debugging much easier later, allowing the
source of a new bug to be tracked down to a small, understandable set
of related changes.  Conversely, if the same trivial changes were made to a
large group of files, please check in all of those at once, with the
same log message, so that it will be clear that they go together.

Ideally, each commit should reflect a single purpose (e.g. addition
of a new feature or a bug fix); each commit increments Topographica's
version number, and the log message applies to that whole version.
Therefore, when committing files, please do it in the appropriate
order and grouping so that the code works at every time in the SVN
repository history.  That is, if you change several files, adding a
function to one file and then calling it in another, consider if you should
check in the file with the new function first, or if you should
check in the two files together. In this situation you should certainly
not check in the file that calls the function before checking
in the file containing the function. In this opposite order, the
repository would temporarily be in a state where it could not supply
working code.  Even if you know no one else is working at that time,
such gaps make it much more difficult to debug using the SVN revision
history, because they make it impractical to roll back history one
change at a time to try to find the source of a bug.

When making and checking in particularly extensive changes, please
keep refactoring completely separate from new features whenever
possible.  That is, if you have to change or clean up a lot of old
code in order to add a new feature, follow something like this
procedure:

  svn commit .	  # Commit all outstanding edits
  make tests	  # Verify that things work when you start
  emacs		  # Refactor old code, not changing behavior at all
  make tests      # Verify that nothing has been broken
  svn diff        # Will have many widespread changes
  svn commit -m    "No visible changes" .
  emacs		  # Add new feature and new test for it
  make tests      # See if tests still work, fixing if necessary
  svn diff	  # Short list: only the new code
  svn commit -m    "Added feature Y" .

That way nearly all of the lines and files you changed can be tested
thoroughly using the existing test suite as-is, and any tests added
can be tested equally well on both the old and new code.  Then the few
lines implementing the new feature can be added and debugged on their
own, so that it will be very simple to see whether the new feature was
the source of a bug, or whether it was all those other changes that
shouldn't have changed anything.

Revision info

Every readable file (i.e. text, source code, html, etc.) should
include an $Id:$ tag so that the SVN revision
information will be visible immediately, even in files outside of the
SVN repository.

For text files, the Id: tag should be placed near the
top, surrounded by dollar signs, on a line by itself.  Near the bottom
is also acceptable, but not preferred.  See the top of the README.txt
file for an example; SVN fills in all but the letters "Id:" and the
dollar signs.

For Python files, the Id: tag should be placed at the
end of the Python doc string for that module, surrounded by dollar
signs, on a line by itself. Also for Python files, we include a
__version__ attribute that could potentially be accessed
from the code. To do this, use the "$Revision$"
tag for SVN. In general, then, Python files will usually begin like
this:

  """
  The module documentation...

  $Id$
  """
  __version__ = "$Revision$"

By default, SVN will not actually fill in tags on new files you add
to the repository. Therefore, please include the following in your
~/.subversion/config file:

# ... (other content you may already have)
[auto-props]
# ... (other content you may already have)
Makefile = svn:eol-style=native;svn:keywords="Author Date Id Revision"
*.ty = svn:eol-style=native;svn:keywords="Author Date Id Revision"
*.py = svn:eol-style=native;svn:keywords="Author Date Id Revision"
*.txt = svn:eol-style=native;svn:keywords="Author Date Id Revision"
*.diff = svn:eol-style=native
*.png = svn:mime-type=image/png
*.jpg = svn:mime-type=image/jpeg

(You will usually also need to set "enable-auto-props yes", as the
config file usually has auto-props disabled by default.)

 In addition to setting up the tags for completion, the code above
also ensures that files have the correct end-of-line style, and that
the mime-type is set correctly. Therefore, it is important to make
sure you have the above in your config file.

Finally, when making a change that will cause a new file to be
produced on other users' systems (e.g. adding an external package that
will be unpacked and built), it is important to tell SVN that it
should ignore such generated files. For instance, if you add the
external package my_package-1.0.tar.gz, when it is built
it will probably generate external/my_package-1.0/ and
external/my-package. When you (or another user) subsequently
types svn status, svn will output something like:

?  external/my_package
?  external/my_package-1.0

To prevent this, you need to edit the svn:ignore property
on the external/ directory by doing something like this:

svn propget svn:ignore external/ > tmp
emacs tmp   # edit tmp to include the entries above
svn propset svn:ignore external/ -F tmp
rm tmp

Similarly, when removing a file, please update any relevant
svn:ignore property so that unused files become apparent
to all users.

Other Notes

Mac users: when adding a directory, please be sure not to add
all the temporary files that OS X creates (i.e. ones beginning .DS_
and ._). To delete all those files recursively, you can use
commands like the following:

find . -name "._*" -exec rm -f {} ;
find . -name ".DS_*" -exec rm -f {} ;


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
	<string name="app_name">Simle SMS Forwarder</string>
	<string name="labelTargetNumber">Target number</string>
	<string name="ok">OK</string>
	<string name="cancel">Cancel</string>
	<string name="enabled">Enabled</string>
	<string name="labelForwarder">SMS Forwarder</string>
</resources>


text:
         Edit

          {{view.label}}

      <button class="btn btn-primary pull-right"
         title="Trigger this build"
         ng-disabled="!entity.$triggerUrl"
         ng-click="triggerBuild(entity)"> Trigger</button>


text:
package com.twitter.scalding.hellcats

import cats.{ Functor, FunctorFilter, MonoidK, Semigroupal, StackSafeMonad }
import cats.effect.{ Async, Effect, ExitCase, SyncIO, IO }
import com.twitter.scalding.{ Config, Mode, TypedPipe, Execution }
import com.twitter.scalding.typed.CoGroupable
import com.twitter.scalding.typed.functions.{ Identity, MapOptionToFlatMap }
import scala.concurrent.{ Future, ExecutionContext => ConcurrentExecutionContext, Promise }

/**
 * Instances for cats types when working with Scalding
 */
object HellCats {
  implicit val instancesTypedPipe: Functor[TypedPipe] with MonoidK[TypedPipe] =
    new Functor[TypedPipe] with MonoidK[TypedPipe] {
      def empty[A] = TypedPipe.empty
      def map[A, B](ta: TypedPipe[A])(fn: A => B) = ta.map(fn)
      def combineK[A](left: TypedPipe[A], right: TypedPipe[A]) = left ++ right
      // we could impliment Applicative[TypedPipe], but cross is very dangerous
      // on map-reduce, so I hesitate to add it at this point
    }

  implicit val functorFilterTypedPipe: FunctorFilter[TypedPipe] =
    new FunctorFilter[TypedPipe] {
      def functor = instancesTypedPipe
      def mapFilter[A, B](ta: TypedPipe[A])(fn: A => Option[B]): TypedPipe[B] =
        ta.flatMap(MapOptionToFlatMap(fn))

      override def flattenOption[A](ta: TypedPipe[Option[A]]): TypedPipe[A] =
        mapFilter(ta)(Identity())

      override def collect[A, B](ta: TypedPipe[A])(fn: PartialFunction[A, B]): TypedPipe[B] =
        ta.collect(fn)

      override def filter[A](ta: TypedPipe[A])(fn: A => Boolean) = ta.filter(fn)
    }

  implicit def semigroupalCoGroupable[K]: Semigroupal[({ type F[V] = CoGroupable[K, V] })#F] =
    new Semigroupal[({ type F[V] = CoGroupable[K, V] })#F] {
      def product[A, B](ca: CoGroupable[K, A], cb: CoGroupable[K, B]) = ca.join(cb)
    }

  /**
   * Async[Execution] includes MonadError[Throwable, Execution] and Defer[Execution]
   * which together are the most commonly used typeclasses
   */
  implicit val asyncExecution: Async[Execution] with StackSafeMonad[Execution] =
    new AsyncExecution

  /**
   * To use Execution as an Effect, which is to say, we can run it, we need the Config, Mode
   * and ExecutionContext to use
   */
  def executionEffect(c: Config, m: Mode)(implicit cec: ConcurrentExecutionContext): Effect[Execution] =
    new ExecutionEffect(c, m)

  class AsyncExecution extends Async[Execution] with StackSafeMonad[Execution] {
    private[this] val neverNothing: Execution[Nothing] =
      Execution.fromFuture { _ =>
        val p = Promise[Nothing]()
        p.future
      }

    override def ap[A, B](ef: Execution[A => B])(ea: Execution[A]): Execution[B] =
      ef.zip(ea).map { case (f, a) => f(a) }

    def async[A](k: (Either[Throwable, A] => Unit) => Unit): Execution[A] =
      Execution.withNewCache(Execution.fromFuture { implicit cec: ConcurrentExecutionContext =>
        val p = Promise[A]()
        Future {
          k {
            case Right(a) =>
              p.success(a)
              ()
            case Left(err) =>
              p.failure(err)
              ()
          }
        }
        p.future
      })

    def asyncF[A](k: (Either[Throwable, A] => Unit) => Execution[Unit]): Execution[A] =
      delay(Promise[A]()).flatMap { p =>
        val asyncEx = Execution.withNewCache(Execution.fromFuture { implicit cec: ConcurrentExecutionContext =>
          Future {
            k {
              case Right(a) =>
                p.success(a)
                ()
              case Left(err) =>
                p.failure(err)
                ()
            }
          }
        }).flatten

        val result = Execution.fromFuture(_ => p.future)

        // this is not quite what is meant by async. We should actually
        // allow the result to complete before the Execution that k returns
        // completes. This is a bit weird for a distributed compute Effect like
        // Execution. We can still pass the laws by blocking on Execution,
        // so we do that here.
        //
        // Note, we liftToTry here because the contract of asyncF is that
        // it should be running independent of the result A. Failures
        // are signaled by calling k with Left(err), not by failing the
        // Execution.
        asyncEx.liftToTry
          .zip(result)
          .map(_._2)
      }

    // Members declared in cats.effect.Bracket
    def bracketCase[A, B](acquire: Execution[A])(use: A => Execution[B])(release: (A, ExitCase[Throwable]) => Execution[Unit]): Execution[B] =
      acquire.flatMap { a =>
        attempt(use(a)).flatMap {
          case Right(b) =>
            release(a, ExitCase.Completed)
              .map(_ => b)
          case Left(t) =>
            release(a, ExitCase.Error(t))
              .flatMap(_ => Execution.failed(t))
        }
      }

    override def delay[A](a: => A): Execution[A] =
      // we can't lawfully cache this
      Execution.withNewCache(Execution.from(a))

    def handleErrorWith[A](ea: Execution[A])(fn: Throwable => Execution[A]): Execution[A] =
      ea.recoverWith { case t => fn(t) }

    def pure[A](a: A): Execution[A] = Execution.from(a)

    def flatMap[A, B](ea: Execution[A])(fn: A => Execution[B]): Execution[B] =
      ea.flatMap(fn)

    override def map[A, B](ea: Execution[A])(fn: A => B): Execution[B] =
      ea.map(fn)

    override def never[A]: Execution[A] = neverNothing

    override def product[A, B](ea: Execution[A], eb: Execution[B]): Execution[(A, B)] =
      ea.zip(eb)

    def raiseError[A](t: Throwable): Execution[A] = Execution.failed(t)

    override def recoverWith[A](ea: Execution[A])(fn: PartialFunction[Throwable, Execution[A]]): Execution[A] =
      ea.recoverWith(fn)

    def suspend[A](ea: => Execution[A]): Execution[A] =
      delay(ea).flatten
  }

  class ExecutionEffect(c: Config, m: Mode)(implicit cec: ConcurrentExecutionContext) extends AsyncExecution with Effect[Execution] {
    def runAsync[A](ea: Execution[A])(cb: Either[Throwable, A] => IO[Unit]): SyncIO[Unit] = {
      SyncIO {
        val funit = ea.run(c, m)
          .map { a => Right(a) }
          .recover { case t => Left(t) }
          .map { e => cb(e).unsafeRunSync }
        // we can discard this future, since we have started the work
        ()
      }
    }
  }
}


text:
""" Main ReBASE module

:Author: peter1000
:Github: https://github.com/peter1000
:Copyright: (c) 2014 All Rights Reserved

**All `ReBASE classes - subclasses`**:

   .. warning:: for all `ReBASE classes` disabled methods

      - any class.copy()

         - e.g.: xy = myrlist.copy()

      - any class.clear()

         - e.g.: myrlist.clear()

      - any __setattr__()
      - any __delattr__()
      - any __add__()

   - can be dumped with json: but will lose any extra data like: `key_order (list)` or/and any `extra_data dict`
   - can be pickled

   - additional methods:

      - set_extra_data(), update_extra_data(), replace_extra_data(): Sets/updates key/value to the additional dictionary: `extra_data`

      - copy_recursively(): recursively copy: Supports recursively intermediate ReDICT, ReLIST, ReTUPLE, dicts, lists and tuples (and their subclasses: depending on there implementation though)

         - this will also copy any ReDICT / ReLIST / ReTUPLE / ReMATRIX `extra_data dict` and any `key_order (list)` and any `extra_key_order (list)`

      - copy_recursively_to_python_native_types(): recursively copy: changing all `ReOBJ` to native python types.

         - `RdictIO, RdictFO, RdictFO2: to python `OrderedDict obj` keeping their order (see also argument: use_extra_key_order)

         - all other ReDICT: objects will be replaced by normal python `dict objs`
         - all `ReLIST obj` will be replaced by normal python `list objs`
         - all `ReTUPLE obj` will be replaced by normal python `tuple objs`
         - all `ReMATRIX obj` will be replaced by normal python `list of tuple objs`

            .. warning::  ReMATRIX tuple items (rows) are not recursively copied so there should be no dict, list ect.. just basic types

         Supports recursively intermediate ReDICT, ReLIST, ReTUPLE, dicts, lists and tuples (and their subclasses: depending on there implementation though)

         .. note:: any ReOBJ set: `extra_data` will be lost

      - topickle(): returns a new pickled dumps byte string from the obj

      - tojson(): returns a new json dumps string from the obj

      - tojson_keeporder(): returns a new json dumps string from the obj keeping the order of any `RdictIO, RdictFO, RdictFO2`

         - this uses first the: copy_recursively_to_python_native_types()

.. warning:: comparisons do not take into consideration any `key_order (list)` or `extra_data dict`
"""
from collections import OrderedDict
from copy import deepcopy
from json import dumps as jdumps
from pickle import (
   dumps as pdumps,
   loads as ploads
)

from ReOBJ.ProjectErr import (
   MethodDeactivatedErr,
   Err
)

class ReBase(object):
   """ Common Base of ReOBJ

   Raises
      MethodDeactivatedErr, KeyError, AttributeError, ReOBJ.ProjectErr.Err
   """

   def set_extra_data(self, key, value):
      """ Sets/updates key/value to the additional dictionary: `extra_data`

      In subclasses which use and init which sets always `extra_data` this method should be overwritten removing the: if
      """
      if 'extra_data' not in self.__dict__:
         self.__dict__['extra_data'] = {}
      self.__dict__['extra_data'][key] = value

   def update_extra_data(self, new_extra_data_dict):
      """ Updates/Extends the additional dictionary: `extra_data`

      In subclasses which use and init which sets always `extra_data` this method should be overwritten removing the: if
      """
      if 'extra_data' not in self.__dict__:
         self.__dict__['extra_data'] = {}
      self.__dict__['extra_data'].update(new_extra_data_dict)

   def replace_extra_data(self, new_extra_data_dict):
      """ Replaces the `extra_data (dict)` with the dict

      if extra_data did not exist it will be created

      Args:
         new_extra_data_dict (dict):
      """
      self.__dict__['extra_data'] = new_extra_data_dict

   def copy_recursively(self):
      """ Create a recursively copy of the ReOBJ obj

      - copy_recursively(): recursively copy: Supports recursively intermediate ReDICT, ReLIST, ReTUPLE, dicts, lists and tuples (and their subclasses: depending on there implementation though)

         - this will also copy any ReDICT / ReLIST / ReTUPLE / ReMATRIX `extra_data dict` and any `key_order (list)` and any `extra_key_order (list)`

      Returns:
         obj: copy of the ReOBJ

            - all ReOBJ are copied inclusive any set: `extra_data`
      """

      def inner_copy(input_):
         if isinstance(input_, RdictIO):
            temp_new = type(input_)([(key, inner_copy(input_[key])) for key in input_.key_order], input_.use_tuple_values)
            temp_new.__dict__['extra_key_order'] = input_.extra_key_order.copy()
            temp_new.__dict__['extra_data'] = input_.extra_data.copy()
            # key_order / extra_data: no need to copy that separately it is done at __init__
            return temp_new
         elif isinstance(input_, (Rdict, Edict)):
            temp_new = type(input_)((key, inner_copy(value)) for key, value in input_.items())
            if 'extra_data' in input_.__dict__:
               temp_new.__dict__['extra_data'] = input_.extra_data.copy()
            return temp_new
         elif isinstance(input_, (Rlist, Elist, Etuple)):
            temp_new = type(input_)([inner_copy(value) for value in input_])
            if 'extra_data' in input_.__dict__:
               temp_new.__dict__['extra_data'] = input_.extra_data.copy()
            return temp_new
         elif isinstance(input_, Lmatrix):
            temp_new = type(input_)(input_.column_names, [tuple_row for tuple_row in input_], input_.unique_column_names)
            temp_new.__dict__['extra_data'] = input_.extra_data.copy()
            # column_names, column_names_idx_lookup, column_names_counted: no need to copy that separately it is done at __init__
            return temp_new
         elif isinstance(input_, dict):
            return type(input_)((key, inner_copy(value)) for key, value in input_.items())
         elif isinstance(input_, (list, tuple)):
            return type(input_)([inner_copy(value) for value in input_])
         else:
            return deepcopy(input_)

      return inner_copy(self)

   def copy_recursively_to_python_native_types(self, use_extra_key_order=False):
      """ Return a recursively copy: changing all `ReOBJ` to native python types.

      - `RdictIO, RdictFO, RdictFO2: to python `OrderedDict obj` keeping their order (see also argument: use_extra_key_order)

      - all other ReDICT: objects will be replaced by normal python `dict objs`
      - all `ReLIST obj` will be replaced by normal python `list objs`
      - all `ReTUPLE obj` will be replaced by normal python `tuple objs`
      - all `ReMATRIX obj` will be replaced by normal python `list of tuple objs`

      Supports recursively intermediate ReDICT, ReLIST, ReTUPLE, dicts, lists and tuples (and their subclasses: depending on there implementation though)

      .. note:: any ReOBJ set: `extra_data` will be lost

      Args:
         use_extra_key_order (bool):

            - if True: the OrderedDict will be based on the `extra_key_order (list)`
            - if False: it will be base on the default `key_order (list)`

      Returns:
         obj: recursive copy of the obj with ReOBJs replaced by python native objs
      """

      def inner_copy(input_):
         if isinstance(input_, RdictIO):
            if use_extra_key_order:
               return OrderedDict([(key, inner_copy(input_[key])) for key in input_.extra_key_order])
            else:
               return OrderedDict([(key, inner_copy(input_[key])) for key in input_.key_order])
         elif isinstance(input_, (Rdict, Edict)):
            return dict((key, inner_copy(value)) for key, value in input_.items())
         elif isinstance(input_, (Rlist, Elist)):
            return list(inner_copy(value) for value in input_)
         elif isinstance(input_, Lmatrix):
            return [tuple(tuple_row) for tuple_row in input_]
         elif isinstance(input_, Etuple):
            return tuple([inner_copy(value) for value in input_])
         elif isinstance(input_, dict):
            return type(input_)((key, inner_copy(value)) for key, value in input_.items())
         elif isinstance(input_, (list, tuple)):
            return type(input_)([inner_copy(value) for value in input_])
         else:
            return deepcopy(input_)

      return inner_copy(self)

   def topickle(self):
      """ Returns a new pickled dumps byte string from the obj

      Returns:
         bytes: a pickled `ReOBJ` dumps
      """
      return pdumps(self, protocol=4)

   def tojson(self, ensure_ascii=False, indent='   '):
      """ Returns a new json dumps string from the obj

      Args:
         ensure_ascii (bool):

            - If ensure_ascii is True, the output is guaranteed to have all incoming non-ASCII characters escaped.
            - If ensure_ascii is False, these characters will be output as-is.

         indent():
            If indent is a non-negative integer or string, then JSON array elements and object members will be pretty-printed with that indent level.
            An indent level of 0, negative, or "" will only insert newlines.
            None (the default) selects the most compact representation.
            Using a positive integer indent indents that many spaces per level.
            If indent is a string (such as "\t"), that string is used to indent each level.

      Returns:
         bytes: a pickled `ReOBJ` dumps
      """
      return jdumps(self, ensure_ascii=ensure_ascii, indent=indent)

   def tojson_keeporder(self, use_extra_key_order=False, ensure_ascii=False, indent='   '):
      """ Returns a new json dumps string from the obj keeping the order using first: copy_recursively_to_python_native_types()

      - `RdictIO, RdictFO, RdictFO2`: will keep their order (see also argument: use_extra_key_order)

      Args:
         use_extra_key_order (bool):

            - if True: the OrderedDict will be based on the `extra_key_order (list)`
            - if False: it will be base on the default `key_order (list)`

         ensure_ascii (bool):

            - If ensure_ascii is True, the output is guaranteed to have all incoming non-ASCII characters escaped.
            - If ensure_ascii is False, these characters will be output as-is.

         indent():
            If indent is a non-negative integer or string, then JSON array elements and object members will be pretty-printed with that indent level.
            An indent level of 0, negative, or "" will only insert newlines.
            None (the default) selects the most compact representation.
            Using a positive integer indent indents that many spaces per level.
            If indent is a string (such as "\t"), that string is used to indent each level.

      Returns:
         bytes: a pickled `ReOBJ` dumps
      """
      temp_native_with_order = self.copy_recursively_to_python_native_types(use_extra_key_order=use_extra_key_order)
      return jdumps(temp_native_with_order, ensure_ascii=ensure_ascii, indent=indent)

   # DEACTIVATED
   @staticmethod
   def deactivated_(*args, **kwargs):
      """ Helper method used to raise MethodDeactivatedErr
      """
      raise MethodDeactivatedErr()

   clear = deactivated_
   copy = deactivated_
   __setattr__ = deactivated_
   __delattr__ = deactivated_
   __add__ = deactivated_

# ================================== R/E DICTS ================================== #
class Edict(ReBase, dict):
   """ An extended dictionary: E(xtended) like a normal python dict but with the additional methods of the `ReBase class`

   Raises
      ReOBJ.ProjectErr.Err
   """

   @staticmethod
   def frompickle(in_pickle_dumps):
      """ Create a new `Edict` from a pickled dumps.

      Arg:
         in_pickle_dumps (bytes): a pickled `Edict` dumps

      Returns:
         obj: a new Rdict object
      """
      new_obj = ploads(in_pickle_dumps)
      if not isinstance(new_obj, Edict):
         raise Err('Edict.frompickle()', 'Error: `in_pickle_dumps` does not seem to be a base `Edict` object: Got type: <{}>'.format(type(new_obj)))
      return new_obj

class Rdict(ReBase, dict):
   """ A restricted dictionary:

   - new keys **can** be added
   - item values **can** be changed
   - item **can not** be deleted

   Raises
      MethodDeactivatedErr, KeyError, AttributeError, ReOBJ.ProjectErr.Err
   """

   @staticmethod
   def frompickle(in_pickle_dumps):
      """ Create a new `Rdict` from a pickled dumps.

      Arg:
         in_pickle_dumps (bytes): a pickled `Rdict` dumps

      Returns:
         obj: a new Rdict object
      """
      new_obj = ploads(in_pickle_dumps)
      if not isinstance(new_obj, Rdict):
         raise Err('Rdict.frompickle()', 'Error: `in_pickle_dumps` does not seem to be a base `Rdict` object: Got type: <{}>'.format(type(new_obj)))
      return new_obj

   @classmethod
   def fromkeys(cls, key_name_list, value=None):
      """ Create a new `Rdict` with keys from *key_name_list* and values set to *value*.

      Arg:
         key_name_list (list): a list with key names
         value (any): each item will be set to the same initial value

      Returns:
         obj: a new Rdict object
      """
      return cls([(key, value) for key in key_name_list])

   def __reduce__(self):
      """ Return state information for pickling
      """
      items = [(key, self[key]) for key in self]
      inst_dict = self.__dict__.copy()
      if inst_dict:
         return (self.__class__, (items,), inst_dict)
      return self.__class__, (items,)

   # DEACTIVATED
   __delitem__ = ReBase.deactivated_  # NOTE: Speedtest: defining __delitem__ is the main slowdown for adding new items: additional 100% more time
   setdefault = ReBase.deactivated_
   pop = ReBase.deactivated_
   popitem = ReBase.deactivated_
   update = ReBase.deactivated_

class RdictF(Rdict):
   """ A restricted dictionary: F(ix)

   Similar to `Rdict` but after creation/initialization no new keys can be added
   There are some other differences too.

   - can **only** be initialized but is `fix` afterwards
   - new keys **can not** be added
   - item values **can** be changed
   - item **can not** be deleted

   Raises
      MethodDeactivatedErr, KeyError, AttributeError, ReOBJ.ProjectErr.Err
   """

   def __setitem__(self, key, value):
      """ Called to implement assignment to self[key].

      Restriction: after RdictF creation no new keys can be set.

      Raises:
         KeyError: if `key` is not found
      """
      if key in self:
         dict.__setitem__(self, key, value)
      else:
         raise KeyError('RdictF.__setitem__(): <{}> object has no attribute: <{}>'.format(type(self).__name__, key))

   @staticmethod
   def frompickle(in_pickle_dumps):
      """ Create a new `RdictF` from a pickled dumps.

      Arg:
         in_pickle_dumps (bytes): a pickled `RdictF` dumps

      Returns:
         obj: a new RdictF object
      """
      new_obj = ploads(in_pickle_dumps)
      if not isinstance(new_obj, RdictF):
         raise Err('RdictF.frompickle()', 'Error: `in_pickle_dumps` does not seem to be a base `RdictF` object: Got type: <{}>'.format(type(new_obj)))
      return new_obj

   # DEACTIVATED
   get = ReBase.deactivated_

class RdictIO(Rdict):
   """ A restricted dictionary: I(nsertion) O(rder)

   Similar to `Rdict` but the order of the keys insertion are tracked in a list: `key_order`
   There are some other differences too.

   - new keys **can** be added
   - item values **can** be changed

      .. note:: keep in mind that values might be tuples: depending ont `tuple_values`

   - item **can not** be deleted

   Args:
      list_of_key_value_tuples (list): of tuples

         - first tuple item is: dict key
         - other tuple item

            - depends on `tuple_values` setting

      use_tuple_values: bool

         - if True: output will be a tuple with all values except the first (dict key)

            - Example with single values

               .. code-block:: python

                  rdictio_obj = RdictIO2([
                     ('jack', 4098),
                     ('hair', 'brown'),
                     ('eyes', 'blue'),
                  ], True)

                  # output tuples
                  rdictio_obj:  {'eyes': ('blue',), 'jack': (4098,), 'hair': ('brown',)}

            - this is usually used with multiple values tuples like

               .. code-block:: python

                  rdictio_obj = RdictIO2([
                     ('jack', 4098, 'dummy_func'),
                     ('hair', 'brown', 'dummy_func'),
                     ('eyes', 'blue', 'dummy_func'),
                  ], True)

                  # output tuples
                  rdictio_obj:  {'eyes': ('blue', 'dummy_func'), 'hair': ('brown', 'dummy_func'), 'jack': (4098, 'dummy_func')}

         - if False: the first (dict key), the second will be the value

            - only used with key-value-pair tuples like in a `normal python dict`

               .. code-block:: python

                  rdictio_obj = RdictIO2([
                     ('jack', 4098),
                     ('hair', 'brown'),
                     ('eyes', 'blue'),
                  ], False)

                  # output
                  rdictio_obj:  {'hair': 'brown', 'eyes': 'blue', 'jack': 4098}

      init_extra_key_order (bool):

         - if True: the `extra_key_order (list)` will be initialize with a copy of the `key_order (list)`
         - if False: the `extra_key_order (list)` will be an empty list

   Raises
      MethodDeactivatedErr, KeyError, AttributeError, ReOBJ.ProjectErr.Err
   """

   def __init__(self, key_value_list, use_tuple_values, init_extra_key_order=True):
      """ Initializes RdictIO
      """
      if isinstance(key_value_list, list):
         if use_tuple_values:
            dict.__init__(self, {key_value_tuple[0]: key_value_tuple[1:] for key_value_tuple in key_value_list})
         else:
            dict.__init__(self, {key: value for key, value in key_value_list})

         self.__dict__['key_order'] = [item[0] for item in key_value_list]
         if init_extra_key_order:
            self.__dict__['extra_key_order'] = self.key_order.copy()
         else:
            self.__dict__['extra_key_order'] = []
         self.__dict__['extra_data'] = {}
         self.__dict__['use_tuple_values'] = use_tuple_values
      else:
         raise Err('RdictIO.__init__()', 'key_value_list must be a list of key/value pairs: We got type: <{}>\n   <{}>'.format(type(key_value_list), key_value_list))

   def __setitem__(self, key, value):
      """ Called to implement assignment to self[key].

      NOTE: Speedtest: defining __setitem__ is the main slowdown
      """
      if key not in self:
         self.__dict__['key_order'].append(key)
      dict.__setitem__(self, key, value)

   def set_extra_data(self, key, value):
      """ Sets/updates key/value to the additional dictionary: `extra_data`
      """
      self.__dict__['extra_data'][key] = value

   def update_extra_data(self, new_extra_data_dict):
      """ Updates/Extends the additional dictionary: `extra_data`
      """
      self.__dict__['extra_data'].update(new_extra_data_dict)

   def yield_key_value_order(self):
      """ Returns a generator: (keys, values) over the `key_order (list)`

      Yields:
         (keys, value) in the order of the `key_order (list)`
      """
      for key in self.key_order:
         yield key, self[key]

   def yield_extra_key_value_order(self):
      """ Returns a generator: (keys, values) over the `extra_key_order (list)`

      Yields:
         (keys, value) in the order of the `extra_key_order (list)`
      """
      for key in self.extra_key_order:
         yield key, self[key]

   def replace_extra_key_order(self, new_extra_key_order_list):
      """ Replaces the `extra_key_order (list)` with the new_extra_key_order

      - Checks that each key is also in the default: `key_order (list)`

      Args:
         new_extra_key_order_list (list): user defined keys order (may be also just a subset of the RdictIO keys)

      Raises:
         ReOBJ.Err: if any key from new_extra_key_order is not found in the default `key_order (list)`
      """
      for key in new_extra_key_order_list:
         if key not in self.key_order:
            raise Err('RdictIO.replace_extra_key_order()', 'Error: `new_extra_key_order_list` key: <{}>\n  was not found in the default `key_order (list)`:\n    <{}>'.format(key, self.key_order))
      self.__dict__['extra_key_order'] = new_extra_key_order_list

   def appendto_extra_key_value_order(self, new_key):
      """ Appends the `new_key` with the the user defined `extra_key_order (list)`

      - Checks that each key is also in the default: `key_order (list)`

      Args:
         new_key (obj): append a new key to the user defined keys order (may be also just a subset of the RdictIO keys)

      Raises:
         ReOBJ.Err: if the `new_key` is not found in the default `key_order (list)`
      """
      if new_key not in self.key_order:
         raise Err('RdictIO.replace_extra_key_order()', 'Error: new_key: <{}>\n  was not found in the default `key_order (list)`:\n    <{}>'.format(new_key, self.key_order))
      self.__dict__['extra_key_order'].append(new_key)

   def __reduce__(self):
      """ Return state information for pickling
      """
      items = [(key, self[key]) for key in self]
      inst_dict = self.__dict__.copy()
      inst_use_tuple_values = self.use_tuple_values
      return (self.__class__, (items, inst_use_tuple_values,), inst_dict)

   @staticmethod
   def frompickle(in_pickle_dumps):
      """ Create a new `RdictIO` from a pickled dumps.

      Arg:
         in_pickle_dumps (bytes): a pickled `RdictIO` dumps

      Returns:
         obj: a new RdictIO object
      """
      new_obj = ploads(in_pickle_dumps)
      if not isinstance(new_obj, RdictIO):
         raise Err('RdictIO.frompickle()', 'Error: `in_pickle_dumps` does not seem to be a base `RdictIO` object: Got type: <{}>'.format(type(new_obj)))
      return new_obj

   # DEACTIVATED
   fromkeys = ReBase.deactivated_

class RdictFO(RdictIO):
   """ A restricted dictionary: F(ix) O(rder)

   Similar to `RdictIO` but after creation/initialization no new keys can be added
   There are some other differences too.

   - can **only** be initialized but is `fix` afterwards: `key_order list` has the key order as in the `key_value_list argument`
   - new keys **can not** be added
   - item values **can** be changed

      .. note:: keep in mind that values might be tuples: depending ont `tuple_values`

   - item **can not** be deleted

   for arguments see: RdictIO()

   Raises
      MethodDeactivatedErr, KeyError, AttributeError, ReOBJ.ProjectErr.Err
   """

   def __setitem__(self, key, value):
      """ Called to implement assignment to self[key].

      Restriction: after RdictFO creation no new keys can be set.

      Raises:
         KeyError: if `key` is not found
      """
      if key in self:
         dict.__setitem__(self, key, value)
      else:
         raise KeyError('RdictFO.__setitem__(): <{}> object has no attribute: <{}>'.format(type(self).__name__, key))

   @staticmethod
   def frompickle(in_pickle_dumps):
      """ Create a new `RdictFO` from a pickled dumps.

      Arg:
         in_pickle_dumps (bytes): a pickled `RdictFO` dumps

      Returns:
         obj: a new RdictFO object
      """
      new_obj = ploads(in_pickle_dumps)
      if not isinstance(new_obj, RdictFO):
         raise Err('RdictFO.frompickle()', 'Error: `in_pickle_dumps` does not seem to be a base `RdictFO` object: Got type: <{}>'.format(type(new_obj)))
      return new_obj

   # DEACTIVATED
   get = ReBase.deactivated_

class RdictFO2(RdictFO):
   """ A restricted dictionary: F(ix) O(rder)

   Similar to `RdictFO` but after creation/initialization values can not be changed

   - can **only** be initialized but is `fix` afterwards: `key_order list` has the key order as in the `key_value_list argument`
   - new keys **can not** be added
   - item values **can not** be changed
   - item **can not** be deleted

   for arguments see: RdictIO()

   Raises
      MethodDeactivatedErr, KeyError, AttributeError, ReOBJ.ProjectErr.Err
   """

   @staticmethod
   def frompickle(in_pickle_dumps):
      """ Create a new `RdictFO2` from a pickled dumps.

      Arg:
         in_pickle_dumps (bytes): a pickled `RdictFO2` dumps

      Returns:
         obj: a new RdictFO2 object
      """
      new_obj = ploads(in_pickle_dumps)
      if not isinstance(new_obj, RdictFO2):
         raise Err('RdictFO2.frompickle()', 'Error: `in_pickle_dumps` does not seem to be a base `RdictFO2` object: Got type: <{}>'.format(type(new_obj)))
      return new_obj

   # DEACTIVATED
   __setitem__ = ReBase.deactivated_

# ================================== R/E LISTS ================================== #
class Elist(ReBase, list):
   """ An extended list: E(xtended) like a normal python list but with the additional methods of the `ReBase class`

   Raises
      ReOBJ.ProjectErr.Err
   """

   @staticmethod
   def frompickle(in_pickle_dumps):
      """ Create a new `Elist` from a pickled dumps.

      Arg:
         in_pickle_dumps (bytes): a pickled `Elist` dumps

      Returns:
         obj: a new Elist object
      """
      new_obj = ploads(in_pickle_dumps)
      if not isinstance(new_obj, Elist):
         raise Err('Elist.frompickle()', 'Error: `in_pickle_dumps` does not seem to be a base `Elist` object: Got type: <{}>'.format(type(new_obj)))
      return new_obj

class Rlist(ReBase, list):
   """ A restricted list:

   - new items **can** be added
   - item values **can** be changed
   - item **can not** be deleted

   Raises
      MethodDeactivatedErr, ReOBJ.ProjectErr.Err
   """

   @staticmethod
   def frompickle(in_pickle_dumps):
      """ Create a new `Rlist` from a pickled dumps.

      Arg:
         in_pickle_dumps (bytes): a pickled `Rlist` dumps

      Returns:
         obj: a new Rlist object
      """
      new_obj = ploads(in_pickle_dumps)
      if not isinstance(new_obj, Rlist):
         raise Err('Rlist.frompickle()', 'Error: `in_pickle_dumps` does not seem to be a base `Rlist` object: Got type: <{}>'.format(type(new_obj)))
      return new_obj

   # DEACTIVATED
   __delitem__ = ReBase.deactivated_
   pop = ReBase.deactivated_
   remove = ReBase.deactivated_

class RlistF(Rlist):
   """ A restricted list: F(ix)

   Similar to `Rlist` but after creation/initialization no new items can be added
   There are some other differences too.

   - can **only** be initialized but is `fix` afterwards
   - new items **can not** be added
   - item values **can** be changed
   - item **can not** be deleted

   Raises
      MethodDeactivatedErr, ReOBJ.ProjectErr.Err
   """

   @staticmethod
   def frompickle(in_pickle_dumps):
      """ Create a new `RlistF` from a pickled dumps.

      Arg:
         in_pickle_dumps (bytes): a pickled `RlistF` dumps

      Returns:
         obj: a new RlistF object
      """
      new_obj = ploads(in_pickle_dumps)
      if not isinstance(new_obj, RlistF):
         raise Err('RlistF.frompickle()', 'Error: `in_pickle_dumps` does not seem to be a base `RlistF` object: Got type: <{}>'.format(type(new_obj)))
      return new_obj

   # DEACTIVATED
   append = ReBase.deactivated_
   extend = ReBase.deactivated_
   insert = ReBase.deactivated_

# ================================== R/E TUPLES ================================== #
class Etuple(ReBase, tuple):
   """ An extended tuple: E(xtended) like a normal python tuple but with the additional methods of the `ReBase class`

   Raises
      ReOBJ.ProjectErr.Err
   """

   @staticmethod
   def frompickle(in_pickle_dumps):
      """ Create a new `Etuple` from a pickled dumps.

      Arg:
         in_pickle_dumps (bytes): a pickled `Etuple` dumps

      Returns:
         obj: a new Etuple object
      """
      new_obj = ploads(in_pickle_dumps)
      if not isinstance(new_obj, Etuple):
         raise Err('Etuple.frompickle()', 'Error: `in_pickle_dumps` does not seem to be a base `Etuple` object: Got type: <{}>'.format(type(new_obj)))
      return new_obj

# ================================== R/E MATRIX ================================== #
def _helper_find_duplicates(seq):
   """ Helper Returns a list of duplicates
   """
   seen = {}
   seen_twice = {}
   for item in seq:
      if item in seen:
         seen_twice[item] = None
      else:
         seen[item] = None
   return seen_twice.keys()

class Lmatrix(ReBase, list):
   """ An extended MATRIX (List-Of-Tuples): E(xtended) with the additional methods of the `ReBase class`

   Tuple items (rows) should only be simple objects: no nested list, dictionary: this is not enforces but not all other methods support such:

      e.g.: copy_recursively_to_python_native_types()

   Arg:
      column_names (tuple): strings of column names
      list_tuple__of_tuples (list or tuple): items (tuples - rows) must have the same number of values as there are column_names
      unique_column_names (bool): if True all column names must be unique: some methods require this

   Raises
      ReOBJ.ProjectErr.Err
   """

   def __init__(self, column_names, list_tuple__of_tuples, unique_column_names=True):
      """ Initializes Lmatrix
      """
      if isinstance(list_tuple__of_tuples, (list, tuple)):
         if isinstance(column_names, tuple):
            if unique_column_names:
               if len(column_names) != len(set(column_names)):
                  raise Err('Lmatrix.__init__()', 'Seems that not all column names are unique: Problems: <{}>\n   column_names: <{}>'.format(_helper_find_duplicates(column_names), column_names))

            list.__init__(self, list_tuple__of_tuples)

            self.__dict__['column_names'] = column_names
            self.__dict__['column_names_idx_lookup'] = {key: idx for idx, key in enumerate(column_names)}
            self.__dict__['column_names_counted'] = len(column_names)
            self.__dict__['extra_data'] = {}
            self.__dict__['unique_column_names'] = unique_column_names
         else:
            raise Err('Lmatrix.__init__()', 'column_names must be a tuple: We got type: <{}>\n   <{}>'.format(type(column_names), column_names))

      else:
         raise Err('Lmatrix.__init__()', 'list_tuple__of_tuples must be a `list or tuple of tuples`: We got type: <{}>\n   <{}>'.format(type(list_tuple__of_tuples), list_tuple__of_tuples))

   def set_extra_data(self, key, value):
      """ Sets/updates key/value to the additional dictionary: `extra_data`
      """
      self.__dict__['extra_data'][key] = value

   def update_extra_data(self, new_extra_data_dict):
      """ Updates/Extends the additional dictionary: `extra_data`
      """
      self.__dict__['extra_data'].update(new_extra_data_dict)

   def replace_column_names(self, new_column_names_tuple):
      """ Replaces the `column_names (tuple)` with the new_column_names_tuple

      Args:
         new_column_names_tuple (tuple): must have the same number of names as the current `column_names`

      Raises:
         ReOBJ.Err
      """
      if isinstance(new_column_names_tuple, tuple):
         if len(new_column_names_tuple) == self.column_names_counted:
            self.__dict__['column_names'] = new_column_names_tuple
            self.__dict__['column_names_idx_lookup'] = {key: idx for idx, key in enumerate(new_column_names_tuple)}
            return
      raise Err('Lmatrix.replace_column_names()', 'new_column_names_tuple must be a <tuple> with: <{}> column_names: We got type: <{}>\n   <{}>'.format(self.__dict__['column_names_counted'], type(new_column_names_tuple), new_column_names_tuple))

   def this_column_values(self, column_name):
      """ Returns the items of all rows for the column

      Arg:
         column_name (string):

      Returns:
         list: all items of the column for all rows
      """
      if column_name in self.column_names:
         idx = self.column_names_idx_lookup[column_name]
         return [row[idx] for row in self]
      else:
         raise Err('Lmatrix.this_column_values()', 'column_name: <{}> is not a valid one.\n   Registered names: <{}>'.format(column_name, self.column_names))

   def __setitem__(self, idx, row_tuple):
      """ Called to implement assignment to self[idx].

      Arg:
         row_tuple (tuple): tuple must have the same number of items as: the original `tuple_column_names`

      Raises:
         IndexError:: if out of `idx`
      """
      if isinstance(row_tuple, tuple):
         if len(row_tuple) == self.column_names_counted:
            list.__setitem__(self, idx, row_tuple)
            return
      raise Err('Lmatrix.__setitem__()', 'item to append must be a <tuple> with: <{}> items: We got type: <{}>\n   <{}>'.format(self.__dict__['column_names_counted'], type(row_tuple), row_tuple))

   def append(self, row_tuple):
      """ Append row_tuple

      Arg:
         row_tuple (tuple): tuple must have the same number of items as: the original `tuple_column_names`
      """
      if isinstance(row_tuple, tuple):
         if len(row_tuple) == self.column_names_counted:
            list.append(self, row_tuple)
            return
      raise Err('Lmatrix.append()', 'item to append must be a <tuple> with: <{}> items: We got type: <{}>\n   <{}>'.format(self.__dict__['column_names_counted'], type(row_tuple), row_tuple))

   def insert(self, idx, row_tuple):
      """ Insert row_tuple

      Arg:
         idx (int): where to insert
         row_tuple (tuple): tuple must have the same number of items as: the original `tuple_column_names`
      """
      if isinstance(row_tuple, tuple):
         if len(row_tuple) == self.column_names_counted:
            list.insert(self, idx, row_tuple)
            return
      raise Err('Lmatrix.insert()', 'item to insert must be a <tuple> with: <{}> items: We got type: <{}>\n   <{}>'.format(self.__dict__['column_names_counted'], type(row_tuple), row_tuple))

   def extend(self, other_matrix):
      """ Extend row_tuple

      Arg:
         other_matrix: must have same number of column names
      """
      if isinstance(other_matrix, Lmatrix):
         if other_matrix.__dict__['column_names_counted'] == self.column_names_counted:
            list.extend(self, other_matrix)
            return
      raise Err('Lmatrix.extend()', 'item to extend must be a <Lmatrix or Subclass> with: <{}> column names: We got type: <{}>\n   column_names_counted: <{}>\n    rows: <{}>'.format(self.__dict__['column_names_counted'], type(other_matrix), other_matrix.__dict__['column_names_counted'], other_matrix))

   @staticmethod
   def frompickle(in_pickle_dumps):
      """ Create a new `Lmatrix` from a pickled dumps.

      Arg:
         in_pickle_dumps (bytes): a pickled `Lmatrix` dumps

      Returns:
         obj: a new Lmatrix object
      """
      new_obj = ploads(in_pickle_dumps)
      if not isinstance(new_obj, Lmatrix):
         raise Err('Lmatrix.frompickle()', 'Error: `in_pickle_dumps` does not seem to be a base `Lmatrix` object: Got type: <{}>'.format(type(new_obj)))
      return new_obj

class LmatrixF(Lmatrix):
   """ A restricted MATRIX (List-Of-Tuples): F(ix)

   Similar to `Lmatrix` but after creation/initialization no new items can be added
   There are some other differences too.

   This is quite similar to using a Tuple-of-Tuples: but we keep it a subclass of Lmatrix

   - can **only** be initialized but is `fix` afterwards
   - new items (tuple-rows) **can not** be added
   - item (tuple-rows) **can not** be changed / replaced
   - item (tuple-rows) **can not** be deleted

   Tuple items should only be simple objects: no nested list, dictionary: this is not enforces but not all other methods support such:

      e.g.: copy_recursively_to_python_native_types()

   Arg:
      column_names (tuple): strings of column names
      list_tuple__of_tuples (list or tuple): items (tuples - rows) must have the same number of values as there are column_names
      unique_column_names (bool): if True all column names must be unique: some methods require this

   Raises
      ReOBJ.ProjectErr.Err
   """

   @staticmethod
   def frompickle(in_pickle_dumps):
      """ Create a new `LmatrixF` from a pickled dumps.

      Arg:
         in_pickle_dumps (bytes): a pickled `LmatrixF` dumps

      Returns:
         obj: a new LmatrixF object
      """
      new_obj = ploads(in_pickle_dumps)
      if not isinstance(new_obj, LmatrixF):
         raise Err('LmatrixF.frompickle()', 'Error: `in_pickle_dumps` does not seem to be a base `LmatrixF` object: Got type: <{}>'.format(type(new_obj)))
      return new_obj

   # DEACTIVATED
   __delitem__ = ReBase.deactivated_
   __setitem__ = ReBase.deactivated_
   pop = ReBase.deactivated_
   remove = ReBase.deactivated_

   append = ReBase.deactivated_
   extend = ReBase.deactivated_
   insert = ReBase.deactivated_


text:
package org.kuali.kra.iacuc.protocol;

import org.kuali.kra.protocol.protocol.ProtocolTypeBase;

public class IacucProtocolType extends ProtocolTypeBase{

    /**
     * Comment for serialVersionUID
     */
    private static final long serialVersionUID = 2622328718522740839L;
}


text:
enabled_site_setting :nntp_bridge_enabled

# install dependencies
gem 'active_attr', '0.10.3'
gem 'thoughtafter-nntp', '1.0.0.3', require: false
gem 'rfc2047', '0.3', github: 'ConradIrwin/rfc2047-ruby'

gem 'codeclimate-test-reporter', '0.5.0', require: nil if ENV['RUN_COVERAGE']

require 'nntp'
require_relative 'lib/discourse_nntp_bridge'

after_initialize do
  class DiscourseNntpBridge::NntpPost < ActiveRecord::Base
    belongs_to :post

    validates :post_id, :message_id, presence: true
    validates :message_id, uniqueness: true
  end

  Post.class_eval do
    has_many :nntp_posts, class_name: 'DiscourseNntpBridge::NntpPost', dependent: :destroy
  end

  on(:post_created) do |post|
    require_dependency File.expand_path('app/jobs/regular/nntp_bridge_exporter.rb', __dir__)

    Jobs.enqueue(:nntp_bridge_exporter, post_id: post.id)
  end
end


text:
package org.lwjgl.opengl;

import org.lwjgl.system.*;

/**
 * Native bindings to the NV_conditional_render extension.
 *
 *
This extension provides support for conditional rendering based on the results of an occlusion query. This mechanism allows an application to
 * potentially reduce the latency between the completion of an occlusion query and the rendering commands depending on its result. It additionally allows
 * the decision of whether to render to be made without application intervention.

 *
 *
This extension defines two new functions, {@link #glBeginConditionalRenderNV BeginConditionalRenderNV} and {@link #glEndConditionalRenderNV EndConditionalRenderNV}, between which rendering commands may be discarded
 * based on the results of an occlusion query. If the specified occlusion query returns a non-zero value, rendering commands between these calls are
 * executed. If the occlusion query returns a value of zero, all rendering commands between the calls are discarded.

 *
 *
If the occlusion query results are not available when {@link #glBeginConditionalRenderNV BeginConditionalRenderNV} is executed, the {@code mode} parameter specifies whether the GL
 * should wait for the query to complete or should simply render the subsequent geometry unconditionally.

 *
 *
Additionally, the extension provides a set of "by region" modes, allowing for implementations that divide rendering work by screen regions to perform
 * the conditional query test on a region-by-region basis without checking the query results from other regions. Such a mode is useful for cases like
 * split-frame SLI, where a frame is divided between multiple GPUs, each of which has its own occlusion query hardware.

 */
public class NVConditionalRender {

    static { GL.initialize(); }

    /** Accepted by the {@code mode} parameter of BeginConditionalRenderNV. */
    public static final int
        GL_QUERY_WAIT_NV              = 0x8E13,
        GL_QUERY_NO_WAIT_NV           = 0x8E14,
        GL_QUERY_BY_REGION_WAIT_NV    = 0x8E15,
        GL_QUERY_BY_REGION_NO_WAIT_NV = 0x8E16;

    protected NVConditionalRender() {
        throw new UnsupportedOperationException();
    }

    // --- [ glBeginConditionalRenderNV ] ---

    public static native void glBeginConditionalRenderNV(@NativeType("GLuint") int id, @NativeType("GLenum") int mode);

    // --- [ glEndConditionalRenderNV ] ---

    public static native void glEndConditionalRenderNV();

}


text:
#ifndef _LINUX_MIB_H_
#define _LINUX_MIB_H_

void	linux_get_osname(struct proc *p, char *dst);
int	linux_set_osname(struct proc *p, char *osname);

void	linux_get_osrelease(struct proc *p, char *dst);
int	linux_set_osrelease(struct proc *p, char *osrelease);

int	linux_get_oss_version(struct proc *p);
int	linux_set_oss_version(struct proc *p, int oss_version);

#endif /* _LINUX_MIB_H_ */


text:
#include <libcryptosec/AsymmetricKey.h>

AsymmetricKey::AsymmetricKey(EVP_PKEY *key)
		throw (AsymmetricKeyException)
{
}

AsymmetricKey::~AsymmetricKey()
{
	EVP_PKEY_free(key);
}

AsymmetricKey::Algorithm AsymmetricKey::getAlgorithm()
		throw (AsymmetricKeyException)
{
	int nid25519 = OBJ_sn2nid("ED25519");
	int nid448 = OBJ_sn2nid("ED448");
	int nid521 = OBJ_sn2nid("ED521");
	int pkeyType = 0;

	AsymmetricKey::Algorithm type;
	pkeyType = EVP_PKEY_type(this->key->type);
	switch (pkeyType)
	{
		case EVP_PKEY_RSA: /* TODO: confirmar porque tem estes dois tipos */
		case EVP_PKEY_RSA2:
			type = AsymmetricKey::RSA;
			break;
		case EVP_PKEY_DSA: /* TODO: confirmar porque tem estes quatro tipos. São mesmo diferentes ??? */
		case EVP_PKEY_DSA1:
		case EVP_PKEY_DSA2:
		case EVP_PKEY_DSA3:
		case EVP_PKEY_DSA4:
			type = AsymmetricKey::DSA;
			break;
		case EVP_PKEY_EC:
			type = AsymmetricKey::ECDSA;
			break;
//		case EVP_PKEY_DH:
//			type = AsymmetricKey::DH;
//			break;
//		case EVP_PKEY_EC:
//			type = AsymmetricKey::EC;
//			break;
		default:
			if (pkeyType != 0 && (pkeyType == nid25519 || pkeyType == nid448 || pkeyType == nid521)) {
				type = AsymmetricKey::EdDSA;
				break;
			}
			throw AsymmetricKeyException(AsymmetricKeyException::INVALID_TYPE, "There is no support for this type: " + std::string(OBJ_nid2sn(this->key->type)), "AsymmetricKey::getAlgorithm");
	}
	return type;
}

int AsymmetricKey::getSize() throw (AsymmetricKeyException)
{
	int ret;
	if (this->key == NULL)
	{
		throw AsymmetricKeyException(AsymmetricKeyException::SET_NO_VALUE, "AsymmetricKey::getSize");
	}
	/* TODO: this function will br right only for RSA, DSA and EC. The others algorithms (DH) must be used
	 * individual functions */
	ret = EVP_PKEY_size(this->key);
	if (ret == 0)
	{
		throw AsymmetricKeyException(AsymmetricKeyException::INTERNAL_ERROR, "AsymmetricKey::getSize");
	}
	return ret;
}

int AsymmetricKey::getSizeBits() throw (AsymmetricKeyException)
{
	int ret;
	if (this->key == NULL)
	{
		throw AsymmetricKeyException(AsymmetricKeyException::SET_NO_VALUE, "AsymmetricKey::getSizeBits");
	}
	/* TODO: this function will br right only for RSA, DSA and EC. The others algorithms (DH) must be used
	 * individual functions */
	ret = EVP_PKEY_bits(this->key);
	if (ret == 0)
	{
		throw AsymmetricKeyException(AsymmetricKeyException::INVALID_TYPE, "There is no support for this type: " + std::string(OBJ_nid2sn(this->key->type)), "AsymmetricKey::getSizeBits");
	}
	return ret;
}

EVP_PKEY* AsymmetricKey::getEvpPkey()
{
	return this->key;
}

//void AsymmetricKey::setEvpPkey(EVP_PKEY *key)
//{
//	if (this->key)
//	{
//		EVP_PKEY_free(key);
//	}
//	this->key = key;
//}


text:
#ifndef WorkerEventQueue_h
#define WorkerEventQueue_h

#include "core/events/EventQueue.h"
#include "wtf/HashMap.h"
#include "wtf/HashSet.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/RefCounted.h"

namespace blink {

class Event;
class ExecutionContext;

class WorkerEventQueue final : public EventQueue {
    WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WorkerEventQueue);
public:

    static PassOwnPtrWillBeRawPtr<WorkerEventQueue> create(ExecutionContext*);
    virtual ~WorkerEventQueue();
    DECLARE_TRACE();

    // EventQueue
    virtual bool enqueueEvent(PassRefPtrWillBeRawPtr<Event>) override;
    virtual bool cancelEvent(Event*) override;
    virtual void close() override;

private:
    explicit WorkerEventQueue(ExecutionContext*);
    void removeEvent(Event*);

    RawPtrWillBeMember<ExecutionContext> m_executionContext;
    bool m_isClosed;

    class EventDispatcherTask;
    using EventTaskMap = WillBeHeapHashMap<RefPtrWillBeMember<Event>, EventDispatcherTask*>;
    EventTaskMap m_eventTaskMap;
};

}

#endif // WorkerEventQueue_h


text: export { default as FlexGrid } from './FlexGrid';


text:
namespace AVRDisassembler.InstructionSet.OpCodes.DataTransfer
{
    public class LDD : OpCode
    {
        public override string Comment => "Load Indirect from Data Space to Register";
    }
}


text:
package net.i2p.router;
/*
 * free (adj.): unencumbered; not under the control of others
 * Written by jrandom in 2003 and released into the public domain
 * with no warranty of any kind, either expressed or implied.
 * It probably won't make your computer catch on fire, or eat
 * your children, but it might.  Use at your own risk.
 *
 */

import java.io.IOException;
import java.io.Writer;
import java.util.Collections;
import java.util.List;
import net.i2p.data.Hash;
import net.i2p.data.RouterAddress;

/**
 * Manages the communication subsystem between peers, including connections,
 * listeners, transports, connection keys, etc.
 *
 */
public abstract class CommSystemFacade implements Service {
    public abstract void processMessage(OutNetMessage msg);

    public void renderStatusHTML(Writer out, String urlBase, int sortFlags) throws IOException { }
    public void renderStatusHTML(Writer out) throws IOException { renderStatusHTML(out, null, 0); }

    /** Create the list of RouterAddress structures based on the router's config */
    public List<RouterAddress> createAddresses() { return Collections.emptyList(); }

    public int countActivePeers() { return 0; }
    public int countActiveSendPeers() { return 0; }
    public boolean haveInboundCapacity(int pct) { return true; }
    public boolean haveOutboundCapacity(int pct) { return true; }
    public boolean haveHighOutboundCapacity() { return true; }
    public List getMostRecentErrorMessages() { return Collections.emptyList(); }

    /**
     * Median clock skew of connected peers in seconds, or null if we cannot answer.
     * CommSystemFacadeImpl overrides this.
     */
    public Long getMedianPeerClockSkew() { return null; }

    /**
     * Return framed average clock skew of connected peers in seconds, or null if we cannot answer.
     * CommSystemFacadeImpl overrides this.
     */
    public long getFramedAveragePeerClockSkew(int percentToInclude) { return 0; }

    /**
     * Determine under what conditions we are remotely reachable.
     *
     */
    public short getReachabilityStatus() { return STATUS_OK; }
    public void recheckReachability() {}
    public boolean isBacklogged(Hash dest) { return false; }
    public boolean wasUnreachable(Hash dest) { return false; }
    public boolean isEstablished(Hash dest) { return false; }
    public byte[] getIP(Hash dest) { return null; }
    public void queueLookup(byte[] ip) {}

    /** @since 0.8.11 */
    public String getOurCountry() { return null; }

    /** @since 0.8.13 */
    public boolean isInBadCountry() { return false; }

    public String getCountry(Hash peer) { return null; }
    public String getCountryName(String code) { return code; }
    public String renderPeerHTML(Hash peer) {
        return peer.toBase64().substring(0, 4);
    }

    /** @since 0.8.13 */
    public boolean isDummy() { return true; }

    /**
     * Tell other transports our address changed
     */
    public void notifyReplaceAddress(RouterAddress UDPAddr) {}

    /**
     * These must be increasing in "badness" (see TransportManager.java),
     * but UNKNOWN must be last.
     *
     * We are able to receive unsolicited connections
     */
    public static final short STATUS_OK = 0;
    /**
     * We are behind a symmetric NAT which will make our 'from' address look
     * differently when we talk to multiple people
     *
     */
    public static final short STATUS_DIFFERENT = 1;
    /**
     * We are able to talk to peers that we initiate communication with, but
     * cannot receive unsolicited connections
     */
    public static final short STATUS_REJECT_UNSOLICITED = 2;
    /**
     *  We have no network interface at all
     *  @since 0.9.4
     */
    public static final short STATUS_DISCONNECTED = 3;
    /**
     * Our detection system is broken (SSU bind port failed)
     */
    public static final short STATUS_HOSED = 4;
    /**
     * Our reachability is unknown
     */
    public static final short STATUS_UNKNOWN = 5;

}

/** unused
class DummyCommSystemFacade extends CommSystemFacade {
    public void shutdown() {}
    public void startup() {}
    public void restart() {}
    public void processMessage(OutNetMessage msg) { }
}
**/


text:
(function ($){
    "use strict";

    var TTOTooltip = function ($el,options){
        //vars
        var _tto = this;
        _tto.$el = $el;
        _tto.options = options;

        //initialize
        _tto.init();
    };

    TTOTooltip.prototype.$body = null;
    TTOTooltip.prototype.$el = null;
    TTOTooltip.prototype.$tooltip = null;
    TTOTooltip.prototype.$win = null;
    TTOTooltip.prototype.options = null;
    TTOTooltip.prototype.state = null;
    TTOTooltip.prototype.timer = null;
    TTOTooltip.prototype.trigger = null;

    TTOTooltip.prototype.init = function (){
        var _tto = this;

        //init globals
        _tto.$win = $(window);
        _tto.$body = $('body');
        _tto.state = 'hidden';

        //create tooltip with css class
        _tto.$tooltip = $(document.createElement('div')).css({
            zIndex: '9999',
            position: 'absolute',
        });
        _tto.$tooltip.addClass(_tto.options.css);

        //set the right trigger
        if ('click' == _tto.options.trigger) {
            _tto.trigger = {
                bind: 'click',
            };
        }
        else if ('focus' == _tto.options.trigger) {
            _tto.trigger = {
                open: 'focus',
                close: 'blur',
            };
        }
        else {
            _tto.trigger = {
                open: 'mouseenter',
                close: 'mouseleave',
            };
        }

        //bind the custom trigger event
        if ('click' == _tto.options.trigger) {
            _tto.$el.on(_tto.trigger.bind, $.proxy(_tto.trigger_toggle, _tto));
        }
        else {
            _tto.$el.on(_tto.trigger.open, $.proxy(_tto.trigger_open, _tto));
            _tto.$el.on(_tto.trigger.close, $.proxy(_tto.trigger_close, _tto));
        }

        //bind event on resize window
        _tto.$win.on('resize', $.proxy(_tto.set_position, _tto));
    };

    TTOTooltip.prototype.change_state = function (state){
        var _tto = this,
            _coords = {};

        //update tooltip' state
        if ('visible' === state) {
            _tto.state = 'visible';

            //append it to body
            _tto.$body.append(_tto.$tooltip);

            //set tooltips contents
            _tto.set_content();

            //get and set element position
            _tto.set_position();

            //callback when show tooltip
            //_tto.options.onShown.call(_tto);
        }
        else {
            _tto.state = 'hidden';

            //detach element from dom
            _tto.$tooltip.detach();

            //callback when hide tooltip
            //_tto.options.onHidden.call(_tto);
        }
    };

    TTOTooltip.prototype.get_position = function (){
        var _tto = this,
            _off = _tto.$el.offset(),
            coords = {};

        //cancel all arrow classes
        _tto.$tooltip.removeClass('arrow-top arrow-bottom arrow-left arrow-right');

        //usefull vars
        var _height = _tto.$el.outerHeight(),
            _width = _tto.$el.outerWidth(),
            _tt_height = _tto.$tooltip.outerHeight(),
            _tt_width = _tto.$tooltip.outerWidth();

        //return positions
        if ('top' == _tto.options.position) {
            _tto.$tooltip.addClass('arrow-bottom');

            //top
            return {
                left: _off.left + (_width / 2) - (_tt_width / 2),
                top: _off.top - _tt_height - _tto.options.offset,
            };
        }
        else if ('bottom' == _tto.options.position) {
            _tto.$tooltip.addClass('arrow-top');

            //bottom
            return {
                left: _off.left + (_width / 2) - (_tt_width / 2),
                top: _off.top + _height + _tto.options.offset,
            };
        }
        else if ('left' == _tto.options.position) {
            _tto.$tooltip.addClass('arrow-right');

            //left
            return {
                left: _off.left - _tt_width - _tto.options.offset,
                top: _off.top + (_height / 2) - (_tt_height / 2),
            };
        }
        else {
            _tto.$tooltip.addClass('arrow-left');

            //right
            return {
                left: _off.left + _width + _tto.options.offset,
                top: _off.top + (_height / 2) - (_tt_height / 2),
            };
        }
    };

    TTOTooltip.prototype.set_content = function (){
        var _tto = this;
        _tto.$tooltip.html(_tto.$el.attr('title'));
        _tto.$el.removeAttr('title');
    };

    TTOTooltip.prototype.set_position = function (){
        var _tto = this;

        //set coordinates
        var _coords = _tto.get_position();
        _tto.$tooltip.css(_coords);
    };

    TTOTooltip.prototype.trigger_close = function (e){
        e.preventDefault();
        var _tto = this,
            _delay = _tto.options.delayOut;

        //clear timer in all cases
        clearTimeout(_tto.timer);

        //close with timer if needed
        if (0 === _delay) {
            _tto.change_state('hidden');
        }
        else {
            _tto.timer = setTimeout(function (){
                _tto.change_state('hidden');
            }, _delay);
        }
    };

    TTOTooltip.prototype.trigger_open = function (e){
        e.preventDefault();
        var _tto = this,
            _delay = _tto.options.delayIn;

        //clear timer in all cases
        clearTimeout(_tto.timer);

        //open with timer if needed
        if (0 === _delay) {
            _tto.change_state('visible');
        }
        else {
            _tto.timer = setTimeout(function (){
                _tto.change_state('visible');
            }, _delay);
        }
    };

    TTOTooltip.prototype.trigger_toggle = function (e){
        e.preventDefault();
        var _tto = this;

        //make the good action works
        _tto.state === 'visible' ? _tto.trigger_close(e) : _tto.trigger_open(e);
    };

    var methods = {
        init: function (options){
            if (!this.length) {
                return false;
            }

            var settings = {
                css: 'tto-tooltip',
                delayIn: 0,
                delayOut: 0,
                fade: false,
                position: 'top',
                offset: 0,
                onHidden: null,
                onShown: null,
                trigger: 'hover'
            };

            return this.each(function (){
                if (options) {
                    $.extend(settings, options);
                }

                new TTOTooltip($(this), settings);
            });
        },
        update: function (){},
        destroy: function (){}
    };

    $.fn.tto_tooltip = function (method){
        if (methods[method]) {
            return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
        }
        else if (typeof method === 'object' || !method) {
            return methods.init.apply(this, arguments);
        }
        else {
            $.error('Method '+method+' does not exist on tto_tooltip');
            return false;
        }
    };
})(window.jQuery);


text:
"""Test functionality of MetPy's utility code."""

from metpy.cbook import Registry

def test_registry():
    """Test that the registry properly registers things."""
    reg = Registry()

    a = 'foo'
    reg.register('mine')(a)

    assert reg['mine'] is a


text:
/* This Source Code Form is subject to the terms of the MIT License.
 * If a copy of the MIT was not distributed with this
 * file, You can obtain one at http://opensource.org/licenses/MIT .
 */

/**
 * @author Benjamin Kleiner
 * @copyright 2014
 * Font size related functions for query.richtext.
 */

(function($) {

	/**
	 * Heading button class.
	 * It's need as the heading requires a parameter.
	 * @param type_ The type of headding.
	 * @return A button description.
	 */
	function HeadingButton(type_) {
		var impl = $.fn.richtext.buttons.classes.toggleButton(type_, '' + type_ + '');
		impl.execute = function(editor, button) {
				document.execCommand('heading', false, impl.cmd);
				editor.trigger('update');
			};
		impl.update = function(editor, button) {
				if (document.queryCommandValue('heading') == impl.cmd)
					button.addClass('pressed');
				else
					button.removeClass('pressed');
			}
		return impl;
	}

	/**
	 * Simple headings buttons.
	 */
	$.fn.richtext.buttons.list.heading1 = HeadingButton('h1');
	$.fn.richtext.buttons.list.heading2 = HeadingButton('h2');
	$.fn.richtext.buttons.list.heading3 = HeadingButton('h3');
	$.fn.richtext.buttons.list.heading4 = HeadingButton('h4');
	$.fn.richtext.buttons.list.heading5 = HeadingButton('h5');
	$.fn.richtext.buttons.list.heading6 = HeadingButton('h6');
})(jQuery);


text:
package com.mapswithme.country;

import android.graphics.Typeface;

import com.mapswithme.maps.MapStorage;

public class CountryItem
{
  public static final CountryItem EMPTY = new CountryItem("", MapStorage.NOT_DOWNLOADED, StorageOptions.MAP_OPTION_MAP_ONLY, false);

  private String mName;
  private int mOptions;
  private int mStatus;
  private boolean mHasChildren;

  private static final Typeface LIGHT = Typeface.create("sans-serif-light", Typeface.NORMAL);
  private static final Typeface REGULAR = Typeface.create("sans-serif", Typeface.NORMAL);

  public CountryItem(String name, int status, int options, boolean hasChildren)
  {
    mName = name;
    mStatus = status;
    mOptions = options;
    mHasChildren = hasChildren;
  }

  public int getStatus()
  {
    return mStatus;
  }

  public String getName()
  {
    return mName;
  }

  public int getOptions()
  {
    return mOptions;
  }

  public boolean hasChildren()
  {
    return mHasChildren;
  }

  public void setStatus(int mStatus)
  {
    this.mStatus = mStatus;
  }

  public void setName(String name)
  {
    mName = name;
  }

  public void setOptions(int options)
  {
    mOptions = options;
  }

  public Typeface getTypeface()
  {
    switch (mStatus)
    {
    case MapStorage.NOT_DOWNLOADED:
    case MapStorage.DOWNLOADING:
    case MapStorage.IN_QUEUE:
    case MapStorage.DOWNLOAD_FAILED:
      return LIGHT;
    default:
      return REGULAR;
    }
  }

  public int getType()
  {
    if (mHasChildren)
      return DownloadAdapter.TYPE_GROUP;

    switch (mStatus)
    {
    case MapStorage.GROUP:
      return DownloadAdapter.TYPE_GROUP;
    case MapStorage.COUNTRY:
      return DownloadAdapter.TYPE_COUNTRY_GROUP;
    case MapStorage.NOT_DOWNLOADED:
      return DownloadAdapter.TYPE_COUNTRY_NOT_DOWNLOADED;
    case MapStorage.ON_DISK:
    case MapStorage.ON_DISK_OUT_OF_DATE:
      return DownloadAdapter.TYPE_COUNTRY_READY;
    default:
      return DownloadAdapter.TYPE_COUNTRY_IN_PROCESS;
    }
  }

  @Override
  public String toString()
  {
    return "Name : " + mName + "; options : " + mOptions + "; status : " + mStatus + "; has children : " + mHasChildren;
  }
}


text:
var React = require('React');
var Router = require('react-router');
var RouteHandler = Router.RouteHandler;

var App = React.createClass({
  render: function(){
    return (

 HEADER

          <RouteHandler />

 FOOTER

    )
  }
});

module.exports = App;


text:
class TestIndexlessModel
  include MongoMapper::Document
  plugin GeoSpatial
  key     :name,  String
  geo_key :coords, Array
end