text:
package oshi.util.platform.unix.solaris;

import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

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

import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.platform.unix.solaris.Kstat2;
import com.sun.jna.platform.unix.solaris.Kstat2.Kstat2Handle;
import com.sun.jna.platform.unix.solaris.Kstat2.Kstat2Map;
import com.sun.jna.platform.unix.solaris.Kstat2.Kstat2MatcherList;
import com.sun.jna.platform.unix.solaris.Kstat2StatusException;
import com.sun.jna.platform.unix.solaris.LibKstat;
import com.sun.jna.platform.unix.solaris.LibKstat.Kstat;
import com.sun.jna.platform.unix.solaris.LibKstat.KstatCtl;
import com.sun.jna.platform.unix.solaris.LibKstat.KstatNamed;

import oshi.annotation.concurrent.GuardedBy;
import oshi.annotation.concurrent.ThreadSafe;
import oshi.software.os.unix.solaris.SolarisOperatingSystem;
import oshi.util.FormatUtil;
import oshi.util.Util;

/**
 * Provides access to kstat information on Solaris
 */
@ThreadSafe
public final class KstatUtil {

    private static final Logger LOG = LoggerFactory.getLogger(KstatUtil.class);

    private static final Lock CHAIN = new ReentrantLock();
    // Only one thread may access the chain at any time, so we wrap this object in
    // the KstatChain class locked until the lock is released on auto-close.
    @GuardedBy("CHAIN")
    private static KstatCtl kstatCtl = null;

    private KstatUtil() {
    }

    /**
     * A copy of the Kstat chain, encapsulating a {@code kstat_ctl_t} object. Only one thread may actively use this
     * object at any time.
     *

     * The chain is created once calling {@link LibKstat#kstat_open} and then this object is instantiated using the
     * {@link KstatUtil#openChain} method. Instantiating this object updates the chain using
     * {@link LibKstat#kstat_chain_update}. The control object should be closed with {@link #close}, which releases the
     * lock and allows another instance to be instantiated.
     */
    public static final class KstatChain implements AutoCloseable {

        private final KstatCtl localCtlRef;

        private KstatChain(KstatCtl ctl) {
            this.localCtlRef = ctl;
            update();
        }

        /**
         * Convenience method for {@link LibKstat#kstat_read} which gets data from the kernel for the kstat pointed to
         * by {@code ksp}. {@code ksp.ks_data} is automatically allocated (or reallocated) to be large enough to hold
         * all of the data. {@code ksp.ks_ndata} is set to the number of data fields, {@code ksp.ks_data_size} is set to
         * the total size of the data, and ksp.ks_snaptime is set to the high-resolution time at which the data snapshot
         * was taken.
         *
         * @param ksp The kstat from which to retrieve data
         * @return {@code true} if successful; {@code false} otherwise
         */
        @GuardedBy("CHAIN")
        public boolean read(Kstat ksp) {
            int retry = 0;
            while (0 > LibKstat.INSTANCE.kstat_read(localCtlRef, ksp, null)) {
                if (LibKstat.EAGAIN != Native.getLastError() || 5 <= ++retry) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Failed to read kstat {}:{}:{}",
                                Native.toString(ksp.ks_module, StandardCharsets.US_ASCII), ksp.ks_instance,
                                Native.toString(ksp.ks_name, StandardCharsets.US_ASCII));
                    }
                    return false;
                }
                Util.sleep(8 << retry);
            }
            return true;
        }

        /**
         * Convenience method for {@link LibKstat#kstat_lookup}. Traverses the kstat chain, searching for a kstat with
         * the same {@code module}, {@code instance}, and {@code name} fields; this triplet uniquely identifies a kstat.
         * If {@code module} is {@code null}, {@code instance} is -1, or {@code name} is {@code null}, then those fields
         * will be ignored in the search.
         *
         * @param module   The module, or null to ignore
         * @param instance The instance, or -1 to ignore
         * @param name     The name, or null to ignore
         * @return The first match of the requested Kstat structure if found, or {@code null}
         */
        @GuardedBy("CHAIN")
        public Kstat lookup(String module, int instance, String name) {
            return LibKstat.INSTANCE.kstat_lookup(localCtlRef, module, instance, name);
        }

        /**
         * Convenience method for {@link LibKstat#kstat_lookup}. Traverses the kstat chain, searching for all kstats
         * with the same {@code module}, {@code instance}, and {@code name} fields; this triplet uniquely identifies a
         * kstat. If {@code module} is {@code null}, {@code instance} is -1, or {@code name} is {@code null}, then those
         * fields will be ignored in the search.
         *
         * @param module   The module, or null to ignore
         * @param instance The instance, or -1 to ignore
         * @param name     The name, or null to ignore
         * @return All matches of the requested Kstat structure if found, or an empty list otherwise
         */
        @GuardedBy("CHAIN")
        public List<Kstat> lookupAll(String module, int instance, String name) {
            List<Kstat> kstats = new ArrayList<>();
            for (Kstat ksp = LibKstat.INSTANCE.kstat_lookup(localCtlRef, module, instance, name); ksp != null; ksp = ksp
                    .next()) {
                if ((module == null || module.equals(Native.toString(ksp.ks_module, StandardCharsets.US_ASCII)))
                        && (instance < 0 || instance == ksp.ks_instance)
                        && (name == null || name.equals(Native.toString(ksp.ks_name, StandardCharsets.US_ASCII)))) {
                    kstats.add(ksp);
                }
            }
            return kstats;
        }

        /**
         * Convenience method for {@link LibKstat#kstat_chain_update}. Brings this kstat header chain in sync with that
         * of the kernel.
         *

         * This function compares the kernel's current kstat chain ID(KCID), which is incremented every time the kstat
         * chain changes, to this object's KCID.
         *
         * @return the new KCID if the kstat chain has changed, 0 if it hasn't, or -1 on failure.
         */
        @GuardedBy("CHAIN")
        public int update() {
            return LibKstat.INSTANCE.kstat_chain_update(localCtlRef);
        }

        /**
         * Release the lock on the chain.
         */
        @Override
        public void close() {
            CHAIN.unlock();
        }
    }

    /**
     * Lock the Kstat chain for use by this object until it's closed.
     *
     * @return A locked copy of the chain. It should be unlocked/released when you are done with it with
     *         {@link KstatChain#close()}.
     */
    public static synchronized KstatChain openChain() {
        CHAIN.lock();
        if (kstatCtl == null) {
            kstatCtl = LibKstat.INSTANCE.kstat_open();
        }
        return new KstatChain(kstatCtl);
    }

    /**
     * Convenience method for {@link LibKstat#kstat_data_lookup} with String return values. Searches the kstat's data
     * section for the record with the specified name. This operation is valid only for kstat types which have named
     * data records. Currently, only the KSTAT_TYPE_NAMED and KSTAT_TYPE_TIMER kstats have named data records.
     *
     * @param ksp  The kstat to search
     * @param name The key for the name-value pair, or name of the timer as applicable
     * @return The value as a String.
     */
    public static String dataLookupString(Kstat ksp, String name) {
        if (ksp.ks_type != LibKstat.KSTAT_TYPE_NAMED && ksp.ks_type != LibKstat.KSTAT_TYPE_TIMER) {
            throw new IllegalArgumentException("Not a kstat_named or kstat_timer kstat.");
        }
        Pointer p = LibKstat.INSTANCE.kstat_data_lookup(ksp, name);
        if (p == null) {
            LOG.debug("Failed to lookup kstat value for key {}", name);
            return "";
        }
        KstatNamed data = new KstatNamed(p);
        switch (data.data_type) {
        case LibKstat.KSTAT_DATA_CHAR:
            return Native.toString(data.value.charc, StandardCharsets.UTF_8);
        case LibKstat.KSTAT_DATA_INT32:
            return Integer.toString(data.value.i32);
        case LibKstat.KSTAT_DATA_UINT32:
            return FormatUtil.toUnsignedString(data.value.ui32);
        case LibKstat.KSTAT_DATA_INT64:
            return Long.toString(data.value.i64);
        case LibKstat.KSTAT_DATA_UINT64:
            return FormatUtil.toUnsignedString(data.value.ui64);
        case LibKstat.KSTAT_DATA_STRING:
            return data.value.str.addr.getString(0);
        default:
            LOG.error("Unimplemented kstat data type {}", data.data_type);
            return "";
        }
    }

    /**
     * Convenience method for {@link LibKstat#kstat_data_lookup} with numeric return values. Searches the kstat's data
     * section for the record with the specified name. This operation is valid only for kstat types which have named
     * data records. Currently, only the KSTAT_TYPE_NAMED and KSTAT_TYPE_TIMER kstats have named data records.
     *
     * @param ksp  The kstat to search
     * @param name The key for the name-value pair, or name of the timer as applicable
     * @return The value as a long. If the data type is a character or string type, returns 0 and logs an error.
     */
    public static long dataLookupLong(Kstat ksp, String name) {
        if (ksp.ks_type != LibKstat.KSTAT_TYPE_NAMED && ksp.ks_type != LibKstat.KSTAT_TYPE_TIMER) {
            throw new IllegalArgumentException("Not a kstat_named or kstat_timer kstat.");
        }
        Pointer p = LibKstat.INSTANCE.kstat_data_lookup(ksp, name);
        if (p == null) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Failed lo lookup kstat value on {}:{}:{} for key {}",
                        Native.toString(ksp.ks_module, StandardCharsets.US_ASCII), ksp.ks_instance,
                        Native.toString(ksp.ks_name, StandardCharsets.US_ASCII), name);
            }
            return 0L;
        }
        KstatNamed data = new KstatNamed(p);
        switch (data.data_type) {
        case LibKstat.KSTAT_DATA_INT32:
            return data.value.i32;
        case LibKstat.KSTAT_DATA_UINT32:
            return FormatUtil.getUnsignedInt(data.value.ui32);
        case LibKstat.KSTAT_DATA_INT64:
            return data.value.i64;
        case LibKstat.KSTAT_DATA_UINT64:
            return data.value.ui64;
        default:
            LOG.error("Unimplemented or non-numeric kstat data type {}", data.data_type);
            return 0L;
        }
    }

    /**
     * Query Kstat2 with a single map
     *
     * @param mapStr The map to query
     * @param names  Names of data to query
     * @return An object array with the data corresponding to the names
     */
    public static Object[] queryKstat2(String mapStr, String... names) {
        if (!SolarisOperatingSystem.HAS_KSTAT2) {
            throw new UnsupportedOperationException(
                    "Kstat2 requires Solaris 11.4+. Use SolarisOperatingSystem#HAS_KSTAT2 to test this.");
        }
        Object[] result = new Object[names.length];
        Kstat2MatcherList matchers = new Kstat2MatcherList();
        KstatUtil.CHAIN.lock();
        try {
            matchers.addMatcher(Kstat2.KSTAT2_M_STRING, mapStr);
            Kstat2Handle handle = new Kstat2Handle();
            try {
                Kstat2Map map = handle.lookupMap(mapStr);
                for (int i = 0; i < names.length; i++) {
                    result[i] = map.getValue(names[i]);
                }
            } finally {
                handle.close();
            }
        } catch (Kstat2StatusException e) {
            LOG.debug("Failed to get stats on {} for names {}: {}", mapStr, Arrays.toString(names), e.getMessage());
        } finally {
            KstatUtil.CHAIN.unlock();
            matchers.free();
        }
        return result;
    }

    /**
     * Query Kstat2 iterating over maps using a wildcard indicating a 0-indexed list, such as a cpu.
     *
     * @param beforeStr The part of the string before the wildcard
     * @param afterStr  The part of the string after the wildcard
     * @param names     Names of data to query
     * @return A list of object arrays with the data corresponding to the names
     */
    public static List<Object[]> queryKstat2List(String beforeStr, String afterStr, String... names) {
        if (!SolarisOperatingSystem.HAS_KSTAT2) {
            throw new UnsupportedOperationException(
                    "Kstat2 requires Solaris 11.4+. Use SolarisOperatingSystem#HAS_KSTAT2 to test this.");
        }
        List<Object[]> results = new ArrayList<>();
        int s = 0;
        Kstat2MatcherList matchers = new Kstat2MatcherList();
        KstatUtil.CHAIN.lock();
        try {
            matchers.addMatcher(Kstat2.KSTAT2_M_GLOB, beforeStr + "*" + afterStr);
            Kstat2Handle handle = new Kstat2Handle();
            try {
                for (s = 0; s < Integer.MAX_VALUE; s++) {
                    Object[] result = new Object[names.length];
                    Kstat2Map map = handle.lookupMap(beforeStr + s + afterStr);
                    for (int i = 0; i < names.length; i++) {
                        result[i] = map.getValue(names[i]);
                    }
                    results.add(result);
                }
            } finally {
                handle.close();
            }
        } catch (Kstat2StatusException e) {
            // Expected to end iteration
            LOG.debug("Failed to get stats on {}{}{} for names {}: {}", beforeStr, s, afterStr, Arrays.toString(names),
                    e.getMessage());
        } finally {
            KstatUtil.CHAIN.unlock();
            matchers.free();
        }
        return results;
    }
}


text:
<?php

class ExerciseDB extends Eloquent  {
	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'exercise';
	/**
	 * The attributes excluded from the model's JSON form.
	 *
	 * @var array
	 */
}

redpajama_set_name: RedPajamaGithub


text:
"use strict";

module.exports = function(imports) {

    let util = imports.util;
    let ObjectId = imports.modules.mongoose.Schema.Types.ObjectId;
    let Promise = imports.modules.Promise;

    let Group = imports.models.Group;
    let User = imports.models.User;
    let AllTeamGroup = imports.models.AllTeamGroup;
    let PositionGroup = imports.models.PositionGroup;

    let audience = {};

    audience.audienceQuery = function(query) {
        return {
            $or: [{
                "audience.users": query._id,
            }, {
                "audience.groups": {
                    $in: query.groups,
                },
            }],
        };
    };

    audience.schemaType = {
        type: new imports.modules.mongoose.Schema({
            users: [{
                type: ObjectId,
                ref: "User",
            }],
            groups: [{
                type: ObjectId,
                ref: "Group",
            }],
            isMultiTeam: {
                type: Boolean,
                default: false,
            },
        }),
        validate: {
            validator: (value) => !value.isMultiTeam || value.users.length === 0,
            message: "Users must be empty in a multiteam audience",
        },
    };

    audience.inAudienceQuery = function(audience) {
        return {
            $or: [
                {
                    _id: {
                        $in: audience.users,
                    },
                }, {
                    groups: {
                        $elemMatch: {
                            $in: audience.groups,
                        },
                    },
                },
            ]
        };
    };

    audience.getUsersIn = Promise.coroutine(function*(au, noCache) {
        if (noCache || !au.cachedUserList) {
            au.cachedUserList = yield User.find(audience.inAudienceQuery(au));
        }
        return au.cachedUserList;
    });

    audience.isUserInAudience = function(user, audience) {
        return audience.users.indexOf(user._id) !== -1
            || audience.groups.some(groupId =>
                user.groups.indexOf(groupId) !== -1
            );
    };

    audience.ensureIncludes = Promise.coroutine(function*(audience, user) {
        if (!audience.users.some(userId => userId.toString() === user._id.toString())
            && !user.groups.some(groupId =>
                audience.groups.some(gid =>
                    gid.toString() === groupId.toString()))
        ) {
            if (!audience.isMultiTeam) {
                audience.users.push(user._id);
            } else {
                let group = yield AllTeamGroup.findOne({
                    _id: { $in: audience.groups}
                });
                if (group) {
                    group = yield AllTeamGroup.findOne({
                        team: user.team,
                    })
                    audience.groups.push(group._id);
                } else {
                    let positionGroups = yield PositionGroup.find({
                        team: user.team,
                        position: util.positions.adminPositionsQuery,
                    });
                    positionGroups.forEach(g => audience.groups.push(g._id));
                }
            }
        }
        return audience;
    });

    return audience;

};


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#pragma once

#include <folly/io/async/AsyncSignalHandler.h>

namespace facebook::presto {

class PrestoServer;

class SignalHandler : private folly::AsyncSignalHandler {
 public:
  explicit SignalHandler(PrestoServer* prestoServer);

 private:
  void signalReceived(int signum) noexcept override;

 private:
  PrestoServer* prestoServer_{nullptr};
};

}; // namespace facebook::presto


text:
	<title>Gloria Hunniford's panel show appearances</title>

	<link rel="stylesheet" media="all" href="../style.css" type="text/css"/>

Gloria Hunniford's panel show appearances

Gloria Hunniford (born 1940-04-10[ref]) has appeared in 71 episodes between 2000-2017.  Gloria Hunniford on IMDB. Gloria Hunniford on Wikipedia.

2000

2001

2002

2003

2004

2005

2006

2007

2008

2009

2010

2011

2012

2013

2014

2015

2016

2017

2017-03-30 / Harry Hill's Alien Fun Capsule

2016-03-24 / Loose Women

2016-03-10 / Loose Women

2016-02-11 / Loose Women

2016-02-01 / Loose Women

2016-01-28 / Loose Women

2016-01-19 / Loose Women

2016-01-12 / Loose Women

2015-12-17 / Loose Women

2015-12-10 / Loose Women

2015-12-03 / Loose Women

2015-11-26 / Loose Women

2015-11-19 / Loose Women

2015-11-05 / Loose Women

2015-10-29 / Loose Women

2015-10-09 / Loose Women

2015-10-08 / Loose Women

2015-10-01 / Loose Women

2015-09-24 / Loose Women

2015-09-21 / Loose Women

2015-09-17 / Loose Women

2015-09-10 / Loose Women

2015-07-20 / Loose Women

2015-07-13 / Loose Women

2015-06-30 / Loose Women

2015-06-29 / Loose Women

2015-06-09 / Loose Women

2015-06-08 / Loose Women

2015-05-18 / Loose Women

2015-04-27 / Loose Women

2015-04-20 / Loose Women

2015-03-26 / Loose Women

2015-03-16 / Loose Women

2015-03-13 / Loose Women

2015-03-02 / Loose Women

2015-02-23 / Loose Women

2015-02-16 / Loose Women

2015-02-09 / Loose Women

2015-02-06 / Loose Women

2015-01-26 / Loose Women

2015-01-19 / Loose Women

2015-01-12 / Loose Women

2015-01-05 / Loose Women

2014-12-05 / Loose Women

2014-12-04 / Loose Women

2014-11-26 / Loose Women

2014-11-17 / Loose Women

2014-11-13 / Loose Women

2014-10-27 / Loose Women

2014-10-17 / Loose Women

2014-10-16 / Loose Women

2014-10-09 / Loose Women

2014-10-03 / Loose Women

2014-09-08 / Loose Women

2011-08-01 / Loose Women

2011-05-31 / Loose Women

2010-07-14 / Loose Women

2010-03-11 / Loose Women

2009-10-12 / Loose Women

2009-07-15 / Loose Women

2008-11-10 / Loose Women

2008-06-10 / Loose Women

2007-01-30 / Loose Women

2003-12-28 / Never Mind The Buzzcocks

2003-08-12 / Loose Women

2003-07-21 / Loose Women

2003-06-10 / Loose Women

2003-05-20 / Loose Women

2002-02-15 / Call My Bluff

2001-01-16 / Call My Bluff

2000-03-16 / It's Only TV But I Like It


text:
"""
template
"""

import argparse
from functools import wraps
import logging
import os
import re
import sys
import traceback

DEFAULTLOGLEVEL = logging.WARNING

def arglogger(func):
    """
    decorator to log argument calls to functions
    """
    @wraps(func)
    def inner(*args, **kwargs):
        logger = logging.getLogger(func.__name__)
        logger.debug("called with arguments: %s, %s" % (args, kwargs))
        return func(*args, **kwargs)
    return inner

@arglogger
def main (args):
    """
    main functions
    """
    logger = logging.getLogger(sys._getframe().f_code.co_name)

if __name__ == "__main__":
    log_level = DEFAULTLOGLEVEL
    log_level_name = logging.getLevelName(log_level)
    logging.basicConfig(level=log_level)

    try:
        parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
        parser.add_argument ("-l", "--loglevel", type=str, help="desired logging level (case-insensitive string: DEBUG, INFO, WARNING, ERROR" )
        parser.add_argument ("-v", "--verbose", action="store_true", default=False, help="verbose output (logging level == INFO")
        parser.add_argument ("-vv", "--veryverbose", action="store_true", default=False, help="very verbose output (logging level == DEBUG")
        # example positional argument:
        # parser.add_argument('integers', metavar='N', type=int, nargs='+', help='an integer for the accumulator')
        args = parser.parse_args()
        if args.loglevel is not None:
            args_log_level = re.sub('\s+', '', args.loglevel.strip().upper())
            try:
                log_level = getattr(logging, args_log_level)
            except AttributeError:
                logging.error("command line option to set log_level failed because '%s' is not a valid level name; using %s" % (args_log_level, log_level_name))
        if args.veryverbose:
            log_level = logging.DEBUG
        elif args.verbose:
            log_level = logging.INFO
        log_level_name = logging.getLevelName(log_level)
        logging.getLogger().setLevel(log_level)
        if log_level != DEFAULTLOGLEVEL:
            logging.warning("logging level changed to %s via command line option" % log_level_name)
        else:
            logging.info("using default logging level: %s" % log_level_name)
        logging.debug("command line: '%s'" % ' '.join(sys.argv))
        main(args)
        sys.exit(0)
    except KeyboardInterrupt, e: # Ctrl-C
        raise e
    except SystemExit, e: # sys.exit()
        raise e
    except Exception, e:
        print "ERROR, UNEXPECTED EXCEPTION"
        print str(e)
        traceback.print_exc()
        os._exit(1)


text:
module.exports = function(Song) {

};


text:
FROM debian:jessie

RUN echo "deb http://debian.mirror.neology.co.za/debian jessie main\n"\
         "deb http://security.debian.org/ jessie/updates main contrib non-free\n"\
         "deb http://debian.mirror.neology.co.za/debian jessie-updates main \n"> /etc/apt/sources.list

RUN apt-get -y update && apt-get -y install \
  python3 \
  python3-pip \
  git \
  build-essential \
  libsnappy-dev \
  zlib1g-dev \
  libbz2-dev \
  libgflags-dev \
  python3-dev

RUN git clone https://github.com/facebook/rocksdb.git
WORKDIR /rocksdb
RUN make -j `nproc` shared_lib
RUN make install-shared INSTALL_PATH=/usr

WORKDIR /

RUN pip3 install pyrocksdb ipython

COPY ./backup.py /backup.py


text:
namespace tracy
{

namespace detail
{
TRACY_API uint64_t GetThreadHandleImpl();
}

#ifdef TRACY_ENABLE
TRACY_API uint64_t GetThreadHandle();
#else
static inline uint64_t GetThreadHandle()
{
    return detail::GetThreadHandleImpl();
}
#endif

TRACY_API void SetThreadName( const char* name );
TRACY_API const char* GetThreadName( uint64_t id );

TRACY_API const char* GetEnvVar(const char* name);

}

#endif


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<resources>
  <resource name="Realm1" type="GROUP"/>
  <resource name="Realm2" type="GROUP"/>
  <resource name="Realm3" type="GROUP"/>
  <resource name="Realm4" type="GROUP"/>
  <resource name="Realm5" type="GROUP"/>
  <resource name="Realm6" type="GROUP"/>
</resources>


text:
<?php

/*
 * GENERATED CODE WARNING
 * This file was automatically generated - do not edit!
 */

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START example_generated_LibraryService_AddTag_sync]
use Google\ApiCore\ApiException;
use Testing\BasicDiregapic\AddTagResponse;
use Testing\BasicDiregapic\LibraryServiceClient;

/**
 * Adds a tag to the book. This RPC is a mixin.
 *
 * @param string $resource REQUIRED: The resource which the tag is being added to.
 *                         In the form "shelves/{shelf_id}/books/{book_id}".
 * @param string $tag      REQUIRED: The tag to add.
 */
function add_tag_sample(string $resource, string $tag): void
{
    // Create a client.
    $libraryServiceClient = new LibraryServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var AddTagResponse $response */
        $response = $libraryServiceClient->addTag($resource, $tag);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $resource = '[RESOURCE]';
    $tag = '[TAG]';

    add_tag_sample($resource, $tag);
}
// [END example_generated_LibraryService_AddTag_sync]


text:
package com.datatorrent.lib.dedup;

import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

import javax.validation.constraints.NotNull;

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

import org.apache.commons.lang.mutable.MutableLong;

import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;

import com.datatorrent.api.AutoMetric;
import com.datatorrent.api.Context;
import com.datatorrent.api.Context.OperatorContext;
import com.datatorrent.api.Context.PortContext;
import com.datatorrent.api.DefaultInputPort;
import com.datatorrent.api.DefaultOutputPort;
import com.datatorrent.api.Operator;
import com.datatorrent.api.Operator.ActivationListener;
import com.datatorrent.api.Stats;
import com.datatorrent.api.StatsListener;
import com.datatorrent.api.StreamCodec;
import com.datatorrent.api.annotation.InputPortFieldAnnotation;
import com.datatorrent.api.annotation.OperatorAnnotation;
import com.datatorrent.lib.bucket.AbstractBucket;
import com.datatorrent.lib.bucket.AbstractBucketManager;
import com.datatorrent.lib.bucket.BucketManager;
import com.datatorrent.lib.counters.BasicCounters;
import com.datatorrent.netlet.util.DTThrowable;

/**
 * This is the base implementation of an de-duplication operator.

 * Subclasses must implement the {@link #getEventKey(Object)} method which extracts the key from an event. This key
 * is used for deciding whether an event is a duplicate or not.
 *

 * Processing of an event involves:
 *

 *
Finding the bucket key of an event by calling {@link BucketManager#getBucketKeyFor(Object)}.

 *
Getting the bucket from {@link BucketManager} by calling {@link BucketManager#getBucket(long)}.

 *

 * If the bucket is not loaded:
 *

 *
it requests the {@link BucketManager} to load the bucket which is a non-blocking call.

 *
Adds the event to {@link #waitingEvents} which is a collection of events that are waiting for buckets to be
 * loaded.

 *
{@link BucketManager} loads the bucket and informs deduper by calling {@link #bucketLoaded(AbstractBucket)}

 *
The deduper then processes the waiting events in {@link #handleIdleTime()}

 *

 *

 * If the bucket is loaded, the operator drops the event if it is already present in the bucket; emits it otherwise.
 *

 *

 *

 *
 *

 * Based on the assumption that duplicate events fall in the same bucket.
 *

 *
 * Additionally it also has the following
 * features:
 * {@link #orderedOutput}: Whether or not the order of input tuples is preserved
 *
 * @displayName Deduper
 * @category Deduplication
 * @tags dedupe
 *
 * @param <INPUT>  type of input tuple
 * @param <OUTPUT> type of output tuple
 * @since 0.9.4
 */
@OperatorAnnotation(checkpointableWithinAppWindow = false)
public abstract class AbstractDeduper<INPUT, OUTPUT>
    implements Operator, BucketManager.Listener<INPUT>, Operator.IdleTimeHandler,
    ActivationListener<Context>
{
  /**
   * The input port on which events are received.
   */
  @InputPortFieldAnnotation(optional = true)
  public final transient DefaultInputPort<INPUT> input = new DefaultInputPort<INPUT>()
  {
    public void setup(Context.PortContext context)
    {
      pojoClass = context.getAttributes().get(PortContext.TUPLE_CLASS);
    }

    @Override
    public final void process(INPUT tuple)
    {
      processTuple(tuple);
    }

    @Override
    public com.datatorrent.api.StreamCodec<INPUT> getStreamCodec()
    {
      return getDeduperStreamCodec();
    }
  };
  /**
   * The output port on which deduped events are emitted.
   */
  public final transient DefaultOutputPort<OUTPUT> output = new DefaultOutputPort<OUTPUT>();
  /**
   * The output port on which duplicate events are emitted.
   */
  public final transient DefaultOutputPort<INPUT> duplicates = new DefaultOutputPort<INPUT>();
  /**
   * The output port on which expired events are emitted.
   */
  public final transient DefaultOutputPort<OUTPUT> expired = new DefaultOutputPort<OUTPUT>();
  /**
   * The output port on which error events are emitted.
   */
  public final transient DefaultOutputPort<OUTPUT> error = new DefaultOutputPort<OUTPUT>();

  //Check-pointed state
  @NotNull
  protected BucketManager<INPUT> bucketManager;
  //bucketKey -> list of bucketData which belong to that bucket and are waiting for the bucket to be loaded.
  @NotNull
  protected final Map<Long, List<INPUT>> waitingEvents;
  protected Set<Integer> partitionKeys;
  protected int partitionMask;
  protected boolean orderedOutput = false;
  /**
   * Map to hold the result of a tuple processing (unique, duplicate, expired or error) until previous
   * tuples get processed. This is used only when {@link #orderedOutput} is true.
   */
  protected transient Map<INPUT, Decision> decisions;
  //Non check-pointed state
  protected final transient BlockingQueue<AbstractBucket<INPUT>> fetchedBuckets;
  private transient long sleepTimeMillis;
  private transient OperatorContext context;
  protected BasicCounters<MutableLong> counters;
  private transient long currentWindow;
  private Class<?> pojoClass;

  // Deduper Auto Metrics
  @AutoMetric
  protected long uniqueEvents;
  @AutoMetric
  protected long duplicateEvents;
  @AutoMetric
  protected long expiredEvents;
  @AutoMetric
  protected long errorEvents;

  public AbstractDeduper()
  {
    waitingEvents = Maps.newHashMap();
    partitionKeys = Sets.newHashSet(0);
    partitionMask = 0;

    fetchedBuckets = new LinkedBlockingQueue<AbstractBucket<INPUT>>();
    counters = new BasicCounters<MutableLong>(MutableLong.class);
  }

  @Override
  public void setup(OperatorContext context)
  {
    this.context = context;
    this.currentWindow = context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID);
    sleepTimeMillis = context.getValue(OperatorContext.SPIN_MILLIS);

    bucketManager.setBucketCounters(counters);
    counters.setCounter(CounterKeys.DUPLICATE_EVENTS, new MutableLong());

    bucketManager.startService(this);
    logger.debug("bucket keys at startup {}", waitingEvents.keySet());
    for (long bucketKey : waitingEvents.keySet()) {
      bucketManager.loadBucketData(bucketKey);
    }
    if (orderedOutput) {
      decisions = Maps.newLinkedHashMap();
    }
  }

  @Override
  public void activate(Context context)
  {
    ((AbstractBucketManager<INPUT>)bucketManager).setPojoClass(pojoClass);
    bucketManager.activate(context);
  }

  @Override
  public void deactivate()
  {
  }

  @Override
  public void teardown()
  {
    bucketManager.shutdownService();
  }

  @Override
  public void beginWindow(long l)
  {
    currentWindow = l;

    // Reset Dedup Metrics
    uniqueEvents = 0;
    duplicateEvents = 0;
    expiredEvents = 0;
    errorEvents = 0;

    // Reset Bucket Metrics
    ((AbstractBucketManager<INPUT>)bucketManager).setBucketsInMemory(0);
    ((AbstractBucketManager<INPUT>)bucketManager).setDeletedBuckets(0);
    ((AbstractBucketManager<INPUT>)bucketManager).setEventsInMemory(0);
    ((AbstractBucketManager<INPUT>)bucketManager).setEvictedBuckets(0);
    ((AbstractBucketManager<INPUT>)bucketManager).setEventsCommittedLastWindow(0);
  }

  /**
   * Processes an incoming tuple
   *
   * @param tuple
   */
  protected void processTuple(INPUT tuple)
  {
    long bucketKey = bucketManager.getBucketKeyFor(tuple);
    if (bucketKey < 0) {
      processInvalid(tuple, bucketKey);
      return;
    } //ignore event

    AbstractBucket<INPUT> bucket = bucketManager.getBucket(bucketKey);
    processValid(tuple, bucket, bucketKey);
  }

  /**
   * Processes invalid tuples.
   *
   * @param tuple
   * @param bucketKey
   */
  protected void processInvalid(INPUT tuple, long bucketKey)
  {
    if (bucketKey == -1) {
      if (orderedOutput && !decisions.isEmpty()) {
        recordDecision(tuple, Decision.EXPIRED);
      } else {
        processExpired(tuple);
      }
    } else if (bucketKey == -2) {
      if (orderedOutput && !decisions.isEmpty()) {
        recordDecision(tuple, Decision.ERROR);
      } else {
        processError(tuple);
      }
    }
  }

  /**
   * Processes an expired tuple
   *
   * @param tuple
   */
  protected void processExpired(INPUT tuple)
  {
    expiredEvents++;
    emitExpired(convert(tuple));
  }

  /**
   * Processes an error tuple
   *
   * @param tuple
   */
  protected void processError(INPUT tuple)
  {
    errorEvents++;
    emitError(convert(tuple));
  }

  /**
   * Processes a valid (non-expired) tuple. This tuple may be a unique or a duplicate. In case a decision cannot be made
   * due to unavailability of buckets in memory, the tuple waits until the bucket is loaded.
   *
   * @param tuple
   *          The tuple to be processed
   * @param bucket
   *          The in-memory bucket in which the tuple belongs
   * @param bucketKey
   *          The bucket key of the bucket
   */
  protected void processValid(INPUT tuple, AbstractBucket<INPUT> bucket, long bucketKey)
  {
    if (bucket != null && !waitingEvents.containsKey(bucketKey) && bucket.containsEvent(tuple)
        && bucket.isDataOnDiskLoaded()) {
      processDuplicate(tuple, bucket);
    } else if (bucket != null && !waitingEvents.containsKey(bucketKey) && bucket.isDataOnDiskLoaded()) {
      bucketManager.newEvent(bucketKey, tuple);
      processUnique(tuple, bucket);
    } else {
      processWaitingEvent(tuple, bucket, bucketKey);
    }
  }

  /**
   * Processes the duplicate tuple.
   *
   * @param tuple
   *          The tuple which is a duplicate
   * @param bucket
   *          The bucket to which the tuple belongs
   */
  protected void processDuplicate(INPUT tuple, AbstractBucket<INPUT> bucket)
  {
    counters.getCounter(CounterKeys.DUPLICATE_EVENTS).increment();
    if (orderedOutput && !decisions.isEmpty()) {
      recordDecision(tuple, Decision.DUPLICATE);
    } else {
      duplicateEvents++;
      emitDuplicate(tuple);
    }
  }

  /**
   * Processes the unique tuple.
   *
   * @param tuple
   *          The tuple which is a unique
   * @param bucket
   *          The bucket to which the tuple belongs
   */
  protected void processUnique(INPUT tuple, AbstractBucket<INPUT> bucket)
  {
    if (orderedOutput && !decisions.isEmpty()) {
      recordDecision(tuple, Decision.UNIQUE);
    } else {
      uniqueEvents++;
      emitOutput(convert(tuple));
    }
  }

  /**
   * Processes a tuple which needs to wait for its bucket to be loaded. Triggers load of the corresponding bucket and
   * adds the tuple in a waiting queue {@link #waitingEvents} The bucket is loaded from the disk. Before that we check
   * if there is a pending request to load the bucket and in that case we put the event in a waiting list.
   *
   * @param tuple
   *          The tuple which needs to wait
   * @param bucket
   *          The bucket to which the tuple belongs
   * @param bucketKey
   *          The key of the bucket
   */
  protected void processWaitingEvent(INPUT tuple, AbstractBucket<INPUT> bucket, long bucketKey)
  {
    boolean doLoadFromDisk = false;
    List<INPUT> waitingList = waitingEvents.get(bucketKey);
    if (waitingList == null) {
      waitingList = Lists.newArrayList();
      waitingEvents.put(bucketKey, waitingList);
      doLoadFromDisk = true;
    }
    waitingList.add(tuple);

    if (doLoadFromDisk) {
      //Trigger the storage manager to load bucketData for this bucket key. This is a non-blocking call.
      bucketManager.loadBucketData(bucketKey);
    }
    if (orderedOutput) {
      recordDecision(tuple, Decision.UNKNOWN);
    }
  }

  @Override
  public void endWindow()
  {
    try {
      bucketManager.blockUntilAllRequestsServiced();
      handleIdleTime();
      Preconditions.checkArgument(waitingEvents.isEmpty(), waitingEvents.keySet());
      if (orderedOutput) {
        emitProcessedTuples();
        Preconditions.checkArgument(decisions.isEmpty(), "events pending " + decisions.size());
      }
      bucketManager.endWindow(currentWindow);
    } catch (Throwable cause) {
      DTThrowable.rethrow(cause);
    }
    context.setCounters(counters);
  }

  @Override
  public void handleIdleTime()
  {
    if (orderedOutput) {
      emitProcessedTuples();
    }
    if (!fetchedBuckets.isEmpty()) {
      processAuxiliary();
    } else {
      /* nothing to do here, so sleep for a while to avoid busy loop */
      try {
        Thread.sleep(sleepTimeMillis);
      } catch (InterruptedException ie) {
        throw new RuntimeException(ie);
      }
    }
  }

  /**
   * Does any auxiliary processing in the idle time of the operator. This processes waiting tuples which have their
   * buckets loaded in memory and can be processed.
   */
  protected void processAuxiliary()
  {
    if (!fetchedBuckets.isEmpty()) {
      /**
       * Remove all the events from waiting list whose buckets are loaded.
       * Process these events again.
       */
      AbstractBucket<INPUT> bucket;
      while ((bucket = fetchedBuckets.poll()) != null) {
        List<INPUT> waitingList = waitingEvents.remove(bucket.bucketKey);
        if (waitingList != null) {
          for (INPUT event : waitingList) {
            if (!bucket.containsEvent(event)) {
              if (bucketManager.getBucketKeyFor(event) < 0) {
                // This event will be expired after all tuples in this window are finished processing.
                // Temporarily add the event to this bucket, so as to deduplicate within this window.
                bucketManager.addEventToBucket(bucket, event);
              } else {
                bucketManager.newEvent(bucket.bucketKey, event);
              }
              processUnique(event, bucket);
            } else {
              processDuplicate(event, bucket);
            }
          }
        }
      }
    }
  }

  /**
   * Records a decision for use later. This is needed to ensure that the order of incoming tuples is maintained.
   *
   * @param tuple
   * @param d
   */
  protected void recordDecision(INPUT tuple, Decision d)
  {
    decisions.put(tuple, d);
  }

  /**
   * Processes tuples for which the decision (unique / duplicate / expired / error) has been made.
   */
  protected void emitProcessedTuples()
  {
    Iterator<Entry<INPUT, Decision>> entries = decisions.entrySet().iterator();
    while (entries.hasNext()) {
      Entry<INPUT, Decision> td = entries.next();
      switch (td.getValue()) {
        case UNIQUE:
          uniqueEvents++;
          emitOutput(convert(td.getKey()));
          entries.remove();
          break;
        case DUPLICATE:
          duplicateEvents++;
          emitDuplicate(td.getKey());
          entries.remove();
          break;
        case EXPIRED:
          expiredEvents++;
          emitExpired(convert(td.getKey()));
          entries.remove();
          break;
        case ERROR:
          errorEvents++;
          emitError(convert(td.getKey()));
          entries.remove();
          break;
        default:
          /*
           * Decision for this is still UNKNOWN. Tuple is still waiting for bucket to be loaded. Break and come back
           * later in endWindow.
           */
          break;
      }
    }
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public void bucketLoaded(AbstractBucket<INPUT> loadedBucket)
  {
    fetchedBuckets.add(loadedBucket);
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public void bucketOffLoaded(long bucketKey)
  {
  }

  /**
   * {@inheritDoc}}
   */
  @Override
  public void bucketDeleted(long bucketKey)
  {
  }

  /**
   * Sets the bucket manager.
   *
   * @param bucketManager {@link BucketManager} to be used by deduper.
   */
  public void setBucketManager(@NotNull BucketManager<INPUT> bucketManager)
  {
    this.bucketManager = Preconditions.checkNotNull(bucketManager, "storage manager");
  }

  public BucketManager<INPUT> getBucketManager()
  {
    return this.bucketManager;
  }

  /**
   * Converts the input tuple to output tuple.
   *
   * @param input input event.
   * @return output tuple derived from input.
   */
  protected abstract OUTPUT convert(INPUT input);

  protected abstract Object getEventKey(INPUT event);

  protected void emitOutput(OUTPUT event)
  {
    output.emit(event);
  }

  protected void emitDuplicate(INPUT event)
  {
    duplicates.emit(event);
  }

  protected void emitExpired(OUTPUT event)
  {
    expired.emit(event);
  }

  protected void emitError(OUTPUT event)
  {
    error.emit(event);
  }

  protected StreamCodec<INPUT> getDeduperStreamCodec()
  {
    return null;
  }

  @Override
  public boolean equals(Object o)
  {
    if (this == o) {
      return true;
    }
    if (!(o instanceof AbstractDeduper)) {
      return false;
    }

    AbstractDeduper<?, ?> deduper = (AbstractDeduper<?, ?>)o;

    if (partitionMask != deduper.partitionMask) {
      return false;
    }
    if (!bucketManager.equals(deduper.bucketManager)) {
      return false;
    }
    if (partitionKeys != null ? !partitionKeys.equals(deduper.partitionKeys) : deduper.partitionKeys != null) {
      return false;
    }
    return waitingEvents.equals(deduper.waitingEvents);
  }

  @Override
  public int hashCode()
  {
    int result = bucketManager.hashCode();
    result = 31 * result + (waitingEvents.hashCode());
    result = 31 * result + (partitionKeys != null ? partitionKeys.hashCode() : 0);
    result = 31 * result + partitionMask;
    return result;
  }

  @Override
  public String toString()
  {
    return "Deduper{" + "partitionKeys=" + partitionKeys + ", partitionMask=" + partitionMask + '}';
  }

  public enum CounterKeys
  {
    DUPLICATE_EVENTS
  }

  public static class CountersListener implements StatsListener, Serializable
  {
    @Override
    public Response processStats(BatchedOperatorStats batchedOperatorStats)
    {
      List<Stats.OperatorStats> lastWindowedStats = batchedOperatorStats.getLastWindowedStats();
      if (lastWindowedStats != null) {
        for (Stats.OperatorStats os : lastWindowedStats) {
          if (os.counters != null) {
            if (os.counters instanceof BasicCounters) {
              @SuppressWarnings("unchecked")
              BasicCounters<MutableLong> cs = (BasicCounters<MutableLong>)os.counters;
              logger.debug("operatorId:{} buckets:[in-memory:{} deleted:{} evicted:{}] events:[in-memory:{} "
                  + "committed-last-window:{} duplicates:{}] low:{} high:{}",
                  batchedOperatorStats.getOperatorId(),
                  cs.getCounter(BucketManager.CounterKeys.BUCKETS_IN_MEMORY),
                  cs.getCounter(BucketManager.CounterKeys.DELETED_BUCKETS),
                  cs.getCounter(BucketManager.CounterKeys.EVICTED_BUCKETS),
                  cs.getCounter(BucketManager.CounterKeys.EVENTS_IN_MEMORY),
                  cs.getCounter(BucketManager.CounterKeys.EVENTS_COMMITTED_LAST_WINDOW),
                  cs.getCounter(CounterKeys.DUPLICATE_EVENTS));
            }
          }
        }
      }
      return null;
    }

    private static final long serialVersionUID = 201404082336L;
    protected static final transient Logger logger = LoggerFactory.getLogger(CountersListener.class);
  }

  /**
   * Checks whether output of deduper should preserve the input order
   */
  public boolean isOrderedOutput()
  {
    return orderedOutput;
  }

  /**
   * If set to true, the deduper will emit tuples in the order in which they were received. Tuples which arrived later
   * will wait for previous tuples to get processed and be emitted. If not set, the order of tuples may change as tuples
   * may be emitted out of order as and when they get processed.
   *
   * @param orderedOutput
   */
  public void setOrderedOutput(boolean orderedOutput)
  {
    this.orderedOutput = orderedOutput;
  }

  // Bucket Manager Metrics
  @AutoMetric
  public long getDeletedBuckets()
  {
    return ((AbstractBucketManager<INPUT>)bucketManager).getDeletedBuckets();
  }

  @AutoMetric
  public long getEvictedBuckets()
  {
    return ((AbstractBucketManager<INPUT>)bucketManager).getEvictedBuckets();
  }

  @AutoMetric
  public long getEventsInMemory()
  {
    return ((AbstractBucketManager<INPUT>)bucketManager).getEventsInMemory();
  }

  @AutoMetric
  public long getEventsCommittedLastWindow()
  {
    return ((AbstractBucketManager<INPUT>)bucketManager).getEventsCommittedLastWindow();
  }

  @AutoMetric
  public long getEndOfBuckets()
  {
    return ((AbstractBucketManager<INPUT>)bucketManager).getEndOfBuckets();
  }

  @AutoMetric
  public long getStartOfBuckets()
  {
    return ((AbstractBucketManager<INPUT>)bucketManager).getStartOfBuckets();
  }

  public Class<?> getPojoClass()
  {
    return pojoClass;
  }

  /**
   * Enum for holding all possible values for a decision for a tuple
   */
  protected enum Decision
  {
    UNIQUE, DUPLICATE, EXPIRED, ERROR, UNKNOWN
  }

  private static final Logger logger = LoggerFactory.getLogger(AbstractDeduper.class);
}


text:
import unittest
import os
import comm
from xml.etree import ElementTree
import json
import shutil

class TestCrosswalkApptoolsFunctions(unittest.TestCase):

    def test_build_debug_webp(self):
        comm.setUp()
        comm.create(self)
        os.chdir('org.xwalk.test')
        jsonfile = open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "r")
        jsons = jsonfile.read()
        jsonfile.close()
        jsonDict = json.loads(jsons)
        jsonDict["xwalk_android_webp"] = "80 80 100"
        json.dump(jsonDict, open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "w"))
        buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
        comm.build(self, buildcmd)
        comm.run(self)
        comm.clear("org.xwalk.test")

    def test_build_release_webp(self):
        comm.setUp()
        comm.create(self)
        os.chdir('org.xwalk.test')
        jsonfile = open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "r")
        jsons = jsonfile.read()
        jsonfile.close()
        jsonDict = json.loads(jsons)
        jsonDict["xwalk_android_webp"] = "80 80 100"
        json.dump(jsonDict, open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "w"))
        buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build release"
        comm.build(self, buildcmd)
        comm.run(self)
        comm.clear("org.xwalk.test")

    def test_build_debug_path_webp(self):
        comm.setUp()
        comm.create(self)
        jsonfile = open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "r")
        jsons = jsonfile.read()
        jsonfile.close()
        jsonDict = json.loads(jsons)
        jsonDict["xwalk_android_webp"] = "80 80 100"
        json.dump(jsonDict, open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "w"))
        if os.path.exists("pkg"):
            shutil.rmtree("pkg")
        os.mkdir("pkg")
        os.chdir('pkg')
        buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build " + comm.XwalkPath + "org.xwalk.test"
        comm.build(self, buildcmd)
        comm.run(self)
        os.chdir('../')
        shutil.rmtree("pkg")
        comm.clear("org.xwalk.test")

    def test_build_release_path_webp(self):
        comm.setUp()
        comm.create(self)
        jsonfile = open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "r")
        jsons = jsonfile.read()
        jsonfile.close()
        jsonDict = json.loads(jsons)
        jsonDict["xwalk_android_webp"] = "80 80 100"
        json.dump(jsonDict, open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "w"))
        if os.path.exists("pkg"):
            shutil.rmtree("pkg")
        os.mkdir("pkg")
        os.chdir('pkg')
        buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build release " + comm.XwalkPath + "org.xwalk.test"
        comm.build(self, buildcmd)
        comm.run(self)
        os.chdir('../')
        shutil.rmtree("pkg")
        comm.clear("org.xwalk.test")

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


text:
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields

class Migration(migrations.Migration):

    dependencies = [("club", "0004_auto_20190401_1919")]

    operations = [
        migrations.CreateModel(
            name="AdvertOrderable",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("sort_order", models.IntegerField(blank=True, editable=False, null=True)),
                ("advert", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="club.Advert")),
                (
                    "page",
                    modelcluster.fields.ParentalKey(
                        on_delete=django.db.models.deletion.CASCADE, related_name="adverts", to="club.ArticlePage"
                    ),
                ),
            ],
            options={"ordering": ["sort_order"], "abstract": False},
        )
    ]


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<!-- The parent of this project is the deployable POM. This project isn't deployable, but this keeps it before the root pom in the reactor order when building the site. I don't know why this works...
		Need to investigate this. -->
	<parent>
		<groupId>ca.uhn.hapi.fhir</groupId>
		<artifactId>hapi-deployable-pom</artifactId>
		<version>2.3-SNAPSHOT</version>
		<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
	</parent>

	<artifactId>hapi-fhir-jacoco</artifactId>
	<packaging>jar</packaging>

	<name>HAPI FHIR - JaCoCo Test Coverage</name>

	<dependencies>
		<dependency>
			<groupId>ca.uhn.hapi.fhir</groupId>
			<artifactId>hapi-fhir-base</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>ca.uhn.hapi.fhir</groupId>
			<artifactId>hapi-fhir-structures-dstu</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>ca.uhn.hapi.fhir</groupId>
			<artifactId>hapi-fhir-structures-dstu2</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>ca.uhn.hapi.fhir</groupId>
			<artifactId>hapi-fhir-structures-dstu3</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>ca.uhn.hapi.fhir</groupId>
			<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>ca.uhn.hapi.fhir</groupId>
			<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>ca.uhn.hapi.fhir</groupId>
			<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>ca.uhn.hapi.fhir</groupId>
			<artifactId>hapi-fhir-jpaserver-base</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>ca.uhn.hapi.fhir</groupId>
			<artifactId>hapi-fhir-client-okhttp</artifactId>
			<version>${project.version}</version>
		</dependency>

		<dependency>
			<groupId>com.phloc</groupId>
			<artifactId>phloc-schematron</artifactId>
			<exclusions>
				<exclusion>
					<artifactId>Saxon-HE</artifactId>
					<groupId>net.sf.saxon</groupId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>com.phloc</groupId>
			<artifactId>phloc-commons</artifactId>
		</dependency>
		<dependency>
			<groupId>org.thymeleaf</groupId>
			<artifactId>thymeleaf</artifactId>
		</dependency>

		<!-- Use an older version of SLF4j just to make sure we compile correctly against old SLF4j - Some people can't upgrade and we have no real need for recent features. -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
		</dependency>

		<!-- Test Database -->
		<dependency>
			<groupId>org.apache.derby</groupId>
			<artifactId>derby</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-dbcp2</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.eclipse.jetty</groupId>
			<artifactId>jetty-servlets</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.eclipse.jetty</groupId>
			<artifactId>jetty-servlet</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.eclipse.jetty</groupId>
			<artifactId>jetty-server</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.eclipse.jetty</groupId>
			<artifactId>jetty-util</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>xmlunit</groupId>
			<artifactId>xmlunit</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>net.sf.json-lib</groupId>
			<artifactId>json-lib</artifactId>
			<classifier>jdk15</classifier>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<artifactId>commons-logging</artifactId>
					<groupId>commons-logging</groupId>
				</exclusion>
				<exclusion>
					<artifactId>commons-lang</artifactId>
					<groupId>commons-lang</groupId>
				</exclusion>
				<exclusion>
					<artifactId>ezmorph</artifactId>
					<groupId>net.sf.ezmorph</groupId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>net.sf.json-lib</groupId>
			<artifactId>json-lib</artifactId>
			<classifier>jdk15-sources</classifier>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<artifactId>commons-logging</artifactId>
					<groupId>commons-logging</groupId>
				</exclusion>
				<exclusion>
					<artifactId>commons-lang</artifactId>
					<groupId>commons-lang</groupId>
				</exclusion>
				<exclusion>
					<artifactId>ezmorph</artifactId>
					<groupId>net.sf.ezmorph</groupId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>directory-naming</groupId>
			<artifactId>naming-java</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<artifactId>commons-logging</artifactId>
					<groupId>commons-logging</groupId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
		</dependency>
		<dependency>
			<groupId>xmlunit</groupId>
			<artifactId>xmlunit</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.eclipse.jetty.websocket</groupId>
			<artifactId>websocket-api</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.eclipse.jetty.websocket</groupId>
			<artifactId>websocket-client</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.eclipse.jetty.websocket</groupId>
			<artifactId>websocket-server</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
		</dependency>
	</dependencies>

	<properties>
	</properties>

	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-site-plugin</artifactId>
					<configuration>
						<skipDeploy>true</skipDeploy>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>jacoco-merge</id>
						<goals>
							<goal>merge</goal>
						</goals>
						<phase>install</phase>
						<configuration>
							<fileSets>
								<fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">
									<directory>${basedir}/..</directory>
									<includes>
										<include>hapi-fhir-base/target/jacoco.exec</include>
										<include>hapi-fhir-structures-dstu/target/jacoco.exec</include>
										<include>hapi-fhir-structures-dstu2/target/jacoco.exec</include>
										<include>hapi-fhir-structures-hl7org-dstu2/target/jacoco.exec</include>
										<include>hapi-fhir-structures-dstu3/target/jacoco.exec</include>
										<include>hapi-fhir-jpaserver-base/target/jacoco.exec</include>
										<include>hapi-fhir-client-okhttp/target/jacoco.exec</include>
										<include>hapi-fhir-android/target/jacoco.exec</include>
									</includes>
								</fileSet>
							</fileSets>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.eluder.coveralls</groupId>
				<artifactId>coveralls-maven-plugin</artifactId>
				<configuration>
					<sourceEncoding>UTF-8</sourceEncoding>
					<serviceName>travis-ci</serviceName>
					<serviceJobId>${env.TRAVIS_JOB_ID}</serviceJobId>
					<sourceDirectories>
						<sourceDirectory>../hapi-fhir-base/src/main/java</sourceDirectory>
						<sourceDirectory>../hapi-fhir-structures-dstu/src/test/java</sourceDirectory>
						<sourceDirectory>../hapi-fhir-structures-dstu2/src/test/java</sourceDirectory>
						<sourceDirectory>../hapi-fhir-structures-hl7org-dstu2/src/test/java</sourceDirectory>
						<sourceDirectory>../hapi-fhir-structures-dstu3/src/test/java</sourceDirectory>
						<sourceDirectory>../hapi-fhir-jpaserver-base/src/main/java</sourceDirectory>
						<sourceDirectory>../hapi-fhir-client-okhttp/src/main/java</sourceDirectory>
					</sourceDirectories>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>add-source</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>add-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>../hapi-fhir-base/src/main/java</source>
								<source>../hapi-fhir-jpaserver-base/src/main/java</source>
							</sources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-install-plugin</artifactId>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-deploy-plugin</artifactId>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>
		</plugins>
		<resources>
		</resources>
		<testResources>
			<testResource>
				<directory>../hapi-fhir-base/src/test/resources</directory>
			</testResource>
			<testResource>
				<directory>../hapi-fhir-jpaserver-base/src/test/resources</directory>
			</testResource>
			<testResource>
				<directory>../hapi-fhir-structures-dstu/src/test/resources</directory>
			</testResource>
			<testResource>
				<directory>../hapi-fhir-structures-dstu2/src/test/resources</directory>
			</testResource>
			<testResource>
				<directory>../hapi-fhir-structures-hl7org-dstu2/src/test/resources</directory>
			</testResource>
			<testResource>
				<directory>../hapi-fhir-structures-dstu3/src/test/resources</directory>
			</testResource>
			<testResource>
				<directory>../hapi-fhir-client-okhttp/src/test/resources</directory>
			</testResource>
		</testResources>
	</build>
	<reporting>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>cobertura-maven-plugin</artifactId>
				<reportSets>
					<reportSet>
						<reports>
							<report>cobertura</report>
						</reports>
						<configuration>
							<check>
								<haltOnFailure>true</haltOnFailure>
							</check>
						</configuration>
					</reportSet>
				</reportSets>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-project-info-reports-plugin</artifactId>
				<version>${maven_project_info_plugin_version}</version>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>
		</plugins>
	</reporting>

</project>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Monogr. Discom. Bohem. (Prague) 74 (1934)

#### Original name
Patinella laricina Velen.

### Remarks
null


text:
(()=>{
  const w = () => {
    return content.wrappedJSObject;
  }

  const getCurrentEntry = () => {
    const entry = w().document.querySelector('.article_current .article_title_link');
    if (!entry) {
      w().move_article('next');
      return w().document.querySelector('.article_current .article_title_link');
    }
    return entry;
  }

  const subCommands = [
    new Command('open', 'open entry', (args) => {
      const entry = getCurrentEntry();
      TreeStyleTabService.readyToOpenChildTabNow(gBrowser.mTabContainer.childNodes[gBrowser.mTabContainer.selectedIndex], false);
      liberator.open(entry.href, liberator.NEW_BACKGROUND_TAB);
      return w().move_article('next');
    }),
    new Command('readitlater', 'add to Pocket', (args) => {
      const entry = getCurrentEntry();
      liberator.plugins.readitlater.API.add(entry.href, entry.textContent, () => {
        return liberator.echo("[readitlater] Added: " + entry.textContent + " - " + entry.href);
      });
      return w().move_article('next');
    })
  ];

  commands.addUserCommand(['inoreader'], 'inoreader.com', (args) => {}, {
    subCommands: subCommands
  }, true);
})();


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.trino.operator.join;

import com.google.common.util.concurrent.ListenableFuture;

/**
 * A bridge that connects build, probe, and outer operators of a join.
 * It often carries data that lets probe find out what is available on
 * the build side, and lets outer find the orphaned rows.
 */
public interface JoinBridge
{
    /**
     * Can be called only after build and probe are finished.
     */
    OuterPositionIterator getOuterPositionIterator();

    void destroy();

    ListenableFuture<Void> whenBuildFinishes();
}


text:
from selenium import webdriver    #.firefox.webdriver import WebDriver
from fixture.session import SessionHelper
from fixture.project import ProjectHelper
from fixture.james import JamesHelper
from fixture.signup import SignupHelper
from fixture.mail import MailHelper
from fixture.soap import SoapHelper

class Application:

    def __init__(self, browser, config):

        if browser == "firefox":
            self.wd = webdriver.Firefox()#firefox_binary="C:\\Program Files\\Mozilla Firefox\\firefox.exe"
        elif browser == "chrome":
            self.wd = webdriver.Chrome()
        elif browser == "ie":
            self.wd = webdriver.Ie()
        else:
            raise ValueError("Unrecognized browser %s " % browser)

        self.session = SessionHelper(self)

        self.project = ProjectHelper(self)

        self.james = JamesHelper(self)

        self.config = config

        self.base_url = config["web"]["baseUrl"]
                                                    #driver wird ein einziges Mal inizilisiert bei der Erschaffung einer Fixture.
                                                    #ein Helper übernimmt einen Link auf ein Objekt der Klasse Application
                                                    #was uns die Möglichkeit gibt über einen Helper uns zu anderem wenden
        self.signup= SignupHelper(self)

        self.mail = MailHelper(self)

        self.soap = SoapHelper(self)

    def is_valid(self):
        try:
            self.wd.current_url                     #URL of the current loaded page
            return True
        except:
            return False

    def open_home_page(self):
        wd = self.wd
        wd.get(self.base_url)

    def destroy(self):
        self.wd.quit()


text:
require "active_support/core_ext/module/attribute_accessors"
require "action_controller"

require "vignette/version"
require "vignette/object_extensions"
require "vignette/filter"

module Vignette

  module Errors
    class VignetteStandardError < StandardError; end
    class ConfigError < VignetteStandardError; end
    class TemplateRequiresNameError < VignetteStandardError; end
  end

  # Module Attributes, please set via `init()`
  mattr_accessor :logging
  mattr_accessor :store
  mattr_accessor :force_choice_param

  # Initialization Code

  # Defaults
  Vignette.store = :session
  Vignette.logging = false
  Vignette.force_choice_param = nil

  # We're going to include ArrayExtensions
  ActionController::Base.send(:include, ObjectExtensions::ActionControllerExtensions)
  Array.send(:include, ObjectExtensions::ArrayExtensions)

  # Member Functions

  # Set any initializers
  def self.init(opts={})
    opts.each do |k,v|
      Vignette.send("#{k}=", v)
    end
  end

  # Sets the current repo to be used to get and store tests for this thread
  def self.set_repo(repo, force_choice=nil)
    Thread.current[:vignette_repo] = repo
    Thread.current[:vignette_force_choice] = force_choice
  end

  # Clears the current repo on this thread
  def self.clear_repo
    set_repo(nil, nil)
  end

  # Performs block with repo set to `repo` for this thread
  # Force choice will be automatically selected if given
  def self.with_repo(repo, force_choice=nil)
    begin
      Vignette.set_repo(repo, force_choice)

      yield
    ensure
      Vignette.clear_repo
    end
  end

  # Is Vignette active for this thread (i.e. do we have a repo?)
  def self.active?
    !Thread.current[:vignette_repo].nil?
  end

  # Get the repo for this thread
  def self.repo
    raise Errors::ConfigError.new("Repo not active, please call Vignette.set_repo before using Vignette (or use around_filter in Rails)") if !active?

    Thread.current[:vignette_repo]
  end

  # Get the force_choice for this thread
  def self.force_choice
    raise Errors::ConfigError.new("Repo not active, please call Vignette.set_repo before using Vignette (or use around_filter in Rails)") if !active?

    Thread.current[:vignette_force_choice]
  end

  # From the repo (default whatever is set for the thread), grab Vignettes' repo and unpack
  def self.vig(repo=nil)
    repo ||= Vignette.repo # allow using existing

    repo && repo[:v].present? ? JSON(repo[:v]) : {}
  end

  # For this repo, store an update Vig
  def self.set_vig(vig)
    repo[:v] = vig.to_json
  end

  # Pull all the tests for this current repo
  def self.tests(vig=nil)
    vig ||= Vignette.vig

    name_values = vig.values.map { |v| [ v['n'], [ v['t'], v['v'] ] ] }.group_by { |el| el[0] }

    arr = name_values.map { |k,v| [ k.to_s.to_sym, v.sort { |a,b| b[1][0] <=> a[1][0] }.first[1][1] ] }

    Hash[arr]
  end

  private

  def self.strip_path(filename)
    if defined?(Rails) && Rails && Rails.respond_to?(:root)
      filename.gsub(Regexp.new("#{Rails.root}[/]?"), '')
    else
      filename.split('/')[-1]
    end
  end

  def self.rand(length)
    Kernel.rand(length)
  end
end


text:
Contributions are welcome, and they are greatly appreciated! Every
little bit helps, and credit will always be given.

You can contribute in many ways:

## Types of Contributions

#### Report Bugs

Report bugs [here](https://github.com/oldani/HtmlTestRunner/issues).

If you are reporting a bug, please include:

* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.

#### Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with "bug"
and "help wanted" is open to whoever wants to implement it.

#### Implement Features

Look through the GitHub issues for features. Anything tagged with "enhancement"
and "help wanted" is open to whoever wants to implement it.

#### Write Documentation

HtmlTestRunner could always use more documentation, whether as part of the
official HtmlTestRunner docs, in docstrings, or even on the web in blog posts,
articles, and such.

#### Submit Feedback

The best way to send feedback is to file an [issue](https://github.com/oldani/HtmlTestRunner/issues).

If you are proposing a feature:

* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that contributions
  are welcome :)

## Get Started!

Ready to contribute? Here's how to set up `HtmlTestRunner` for local development.

1. Fork the `HtmlTestRunner` repo on GitHub.
2. Clone your fork locally:

        $ git clone git@github.com:your_name_here/HtmlTestRunner.git

3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:

        $ mkvirtualenv HtmlTestRunner
        $ cd HtmlTestRunner/
        $ pip install -r requirements_dev.txt
        $ python setup.py develop

4. Create a branch for local development:

        $ git checkout -b name-of-your-bugfix-or-feature

    Now you can make your changes locally.

5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::

        $ flake8 HtmlTestRunner tests
        $ python setup.py test or py.test
        $ tox

6. Commit your changes and push your branch to GitHub::

        $ git add .
        $ git commit -m "Your detailed description of your changes."
        $ git push origin name-of-your-bugfix-or-feature

7. Submit a pull request through the GitHub website.

## Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. All
   functions should have docstrings.
3. The pull request should work for Python 2.7 and 3.5. Check
   [Travis test](https://travis-ci.org/oldani/HtmlTestRunner/pull_requests)
   and make sure that the tests pass for all supported Python versions.

## Tips

To run a subset of tests::
```bash
    $ python -m unittest tests.test_HtmlTestRunner
```