text:
package org.apache.commons.collections4.iterators;

import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;

/**
 * Adapter to make {@link Enumeration Enumeration} instances appear
 * to be {@link Iterator Iterator} instances.
 *
 * @param <E> the type of elements returned by this iterator.
 * @since 1.0
 */
public class EnumerationIterator<E> implements Iterator<E> {

    /** The collection to remove elements from */
    private final Collection<? super E> collection;
    /** The enumeration being converted */
    private Enumeration<? extends E> enumeration;
    /** The last object retrieved */
    private E last;

    // Constructors
    /**
     * Constructs a new {@code EnumerationIterator} that will not
     * function until {@link #setEnumeration(Enumeration)} is called.
     */
    public EnumerationIterator() {
        this(null, null);
    }

    /**
     * Constructs a new {@code EnumerationIterator} that provides
     * an iterator view of the given enumeration.
     *
     * @param enumeration  the enumeration to use
     */
    public EnumerationIterator(final Enumeration<? extends E> enumeration) {
        this(enumeration, null);
    }

    /**
     * Constructs a new {@code EnumerationIterator} that will remove
     * elements from the specified collection.
     *
     * @param enumeration  the enumeration to use
     * @param collection  the collection to remove elements from
     */
    public EnumerationIterator(final Enumeration<? extends E> enumeration, final Collection<? super E> collection) {
        this.enumeration = enumeration;
        this.collection = collection;
        this.last = null;
    }

    // Iterator interface
    /**
     * Returns true if the underlying enumeration has more elements.
     *
     * @return true if the underlying enumeration has more elements
     * @throws NullPointerException  if the underlying enumeration is null
     */
    @Override
    public boolean hasNext() {
        return enumeration.hasMoreElements();
    }

    /**
     * Returns the next object from the enumeration.
     *
     * @return the next object from the enumeration
     * @throws NullPointerException if the enumeration is null
     */
    @Override
    public E next() {
        last = enumeration.nextElement();
        return last;
    }

    /**
     * Removes the last retrieved element if a collection is attached.
     * <p>
     * Functions if an associated {@code Collection} is known.
     * If so, the first occurrence of the last returned object from this
     * iterator will be removed from the collection.
     *
     * @throws IllegalStateException {@code next()} not called.
     * @throws UnsupportedOperationException if no associated collection
     */
    @Override
    public void remove() {
        if (collection == null) {
            throw new UnsupportedOperationException("No Collection associated with this Iterator");
        }
        if (last == null) {
            throw new IllegalStateException("next() must have been called for remove() to function");
        }
        collection.remove(last);
    }

    // Properties
    /**
     * Returns the underlying enumeration.
     *
     * @return the underlying enumeration
     */
    public Enumeration<? extends E> getEnumeration() {
        return enumeration;
    }

    /**
     * Sets the underlying enumeration.
     *
     * @param enumeration  the new underlying enumeration
     */
    public void setEnumeration(final Enumeration<? extends E> enumeration) {
        this.enumeration = enumeration;
    }

}


text:
import tarfile
from urllib import quote, unquote
from xml.sax import saxutils
from swift.common.swob import Request, HTTPBadGateway, \
    HTTPCreated, HTTPBadRequest, HTTPNotFound, HTTPUnauthorized, HTTPOk, \
    HTTPPreconditionFailed, HTTPRequestEntityTooLarge, HTTPNotAcceptable, \
    wsgify
from swift.common.utils import json, TRUE_VALUES
from swift.common.constraints import check_utf8, MAX_FILE_SIZE
from swift.common.http import HTTP_BAD_REQUEST, HTTP_UNAUTHORIZED, \
    HTTP_NOT_FOUND
from swift.common.constraints import MAX_OBJECT_NAME_LENGTH, \
    MAX_CONTAINER_NAME_LENGTH

MAX_PATH_LENGTH = MAX_OBJECT_NAME_LENGTH + MAX_CONTAINER_NAME_LENGTH + 2

class CreateContainerError(Exception):
    def __init__(self, msg, status_int, status):
        self.status_int = status_int
        self.status = status
        Exception.__init__(self, msg)

ACCEPTABLE_FORMATS = ['text/plain', 'application/json', 'application/xml',
                      'text/xml']

class Bulk(object):
    """
    Middleware that will do many operations on a single request.

    Extract Archive:

    Expand tar files into a swift account. Request must be a PUT with the
    header X-Extract-Archive specifying the format of archive file. Accepted
    formats are tar, tar.gz, and tar.bz2.

    For a PUT to the following url:

    /v1/AUTH_Account/$UPLOAD_PATH

    UPLOAD_PATH is where the files will be expanded to. UPLOAD_PATH can be a
    container, a pseudo-directory within a container, or an empty string. The
    destination of a file in the archive will be built as follows:

    /v1/AUTH_Account/$UPLOAD_PATH/$FILE_PATH

    Where FILE_PATH is the file name from the listing in the tar file.

    If the UPLOAD_PATH is an empty string, containers will be auto created
    accordingly and files in the tar that would not map to any container (files
    in the base directory) will be ignored.

    Only regular files will be uploaded. Empty directories, symlinks, etc will
    not be uploaded.

    If all valid files were uploaded successfully will return an HTTPCreated
    response. If any files failed to be created will return an HTTPBadGateway
    response. In both cases the response body will specify the number of files
    successfully uploaded and a list of the files that failed. The return body
    will be formatted in the way specified in the request's Accept header.
    Acceptable formats are text/plain, application/json, application/xml, and
    text/xml.

    Bulk Delete:

    Will delete multiple objects from their account with a single request.
    Responds to DELETE requests with a header 'X-Bulk-Delete: true'.
    The Content-Type should be set to text/plain. The body of the DELETE
    request will be a newline separated list of url encoded objects to delete.
    You can only delete 1000 (configurable) objects per request. The objects
    specified in the DELETE request body must be URL encoded and in the form:

    /container_name/obj_name

    If all objects were successfully deleted (or did not exist), will return an
    HTTPOk. If any objects failed to delete, will return an HTTPBadGateway. In
    both cases the response body will specify the number of objects
    successfully deleted, not found, and a list of the objects that failed.
    The return body will be formatted in the way specified in the request's
    Accept header. Acceptable formats are text/plain, application/json,
    apllication/xml, and text/xml.
    """

    def __init__(self, app, conf):
        self.app = app
        self.max_containers = int(
            conf.get('max_containers_per_extraction', 10000))
        self.max_failed_extractions = int(
            conf.get('max_failed_extractions', 1000))
        self.max_deletes_per_request = int(
            conf.get('max_deletes_per_request', 1000))

    def create_container(self, req, container_path):
        """
        Makes a subrequest to create a new container.
        :params container_path: an unquoted path to a container to be created
        :returns: None on success
        :raises: CreateContainerError on creation error
        """
        new_env = req.environ.copy()
        new_env['PATH_INFO'] = container_path
        create_cont_req = Request.blank(container_path, environ=new_env)
        resp = create_cont_req.get_response(self.app)
        if resp.status_int // 100 != 2:
            raise CreateContainerError(
                "Create Container Failed: " + container_path,
                resp.status_int, resp.status)

    def get_objs_to_delete(self, req):
        """
        Will populate objs_to_delete with data from request input.
        :params req: a Swob request
        :returns: a list of the contents of req.body when separated by newline.
        :raises: HTTPException on failures
        """
        line = ''
        data_remaining = True
        objs_to_delete = []
        if req.content_length is None and \
                req.headers.get('transfer-encoding', '').lower() != 'chunked':
            raise HTTPBadRequest('Invalid request: no content sent.')

        while data_remaining:
            if len(objs_to_delete) > self.max_deletes_per_request:
                raise HTTPRequestEntityTooLarge(
                    'Maximum Bulk Deletes: %d per request' %
                    self.max_deletes_per_request)
            if '\n' in line:
                obj_to_delete, line = line.split('\n', 1)
                objs_to_delete.append(obj_to_delete)
            else:
                data = req.body_file.read(MAX_PATH_LENGTH)
                if data:
                    line += data
                else:
                    data_remaining = False
                    if line.strip():
                        objs_to_delete.append(line)
            if len(line) > MAX_PATH_LENGTH * 2:
                raise HTTPBadRequest('Invalid File Name')
        return objs_to_delete

    def get_response_body(self, data_format, data_dict, error_list):
        """
        Returns a properly formatted response body according to format.
        :params data_format: resulting format
        :params data_dict: generated data about results.
        :params error_list: list of quoted filenames that failed
        """
        if data_format == 'text/plain':
            output = ''
            for key in sorted(data_dict.keys()):
                output += '%s: %s\n' % (key, data_dict[key])
            output += 'Errors:\n'
            output += '\n'.join(
                ['%s, %s' % (name, status)
                 for name, status in error_list])
            return output
        if data_format == 'application/json':
            data_dict['Errors'] = error_list
            return json.dumps(data_dict)
        if data_format.endswith('/xml'):
            output = '<?xml version="1.0" encoding="UTF-8"?>\n<delete>\n'
            for key in sorted(data_dict.keys()):
                xml_key = key.replace(' ', '_').lower()
                output += '<%s>%s</%s>\n' % (xml_key, data_dict[key], xml_key)
            output += '<errors>\n'
            output += '\n'.join(
                ['<object>'
                 '<name>%s</name><status>%s</status>'
                 '</object>' % (saxutils.escape(name), status) for
                 name, status in error_list])
            output += '</errors>\n</delete>\n'
            return output
        raise HTTPNotAcceptable('Invalid output type')

    def handle_delete(self, req):
        """
        :params req: a swob Request
        :raises HTTPException: on unhandled errors
        :returns: a swob Response
        """
        try:
            vrs, account, _junk = req.split_path(2, 3, True)
        except ValueError:
            return HTTPNotFound(request=req)

        incoming_format = req.headers.get('Content-Type')
        if incoming_format and not incoming_format.startswith('text/plain'):
            # For now only accept newline separated object names
            return HTTPNotAcceptable(request=req)
        out_content_type = req.accept.best_match(ACCEPTABLE_FORMATS)
        if not out_content_type:
            return HTTPNotAcceptable(request=req)

        objs_to_delete = self.get_objs_to_delete(req)
        failed_files = []
        success_count = not_found_count = 0
        failed_file_response_type = HTTPBadRequest
        for obj_to_delete in objs_to_delete:
            obj_to_delete = obj_to_delete.strip().lstrip('/')
            if not obj_to_delete:
                continue
            obj_to_delete = unquote(obj_to_delete)
            delete_path = '/'.join(['', vrs, account, obj_to_delete])
            if not check_utf8(delete_path):
                failed_files.append([quote(delete_path),
                                     HTTPPreconditionFailed().status])
                continue
            new_env = req.environ.copy()
            new_env['PATH_INFO'] = delete_path
            del(new_env['wsgi.input'])
            new_env['CONTENT_LENGTH'] = 0
            new_env['HTTP_USER_AGENT'] = \
                '%s BulkDelete' % req.environ.get('HTTP_USER_AGENT')
            delete_obj_req = Request.blank(delete_path, new_env)
            resp = delete_obj_req.get_response(self.app)
            if resp.status_int // 100 == 2:
                success_count += 1
            elif resp.status_int == HTTP_NOT_FOUND:
                not_found_count += 1
            elif resp.status_int == HTTP_UNAUTHORIZED:
                return HTTPUnauthorized(request=req)
            else:
                if resp.status_int // 100 == 5:
                    failed_file_response_type = HTTPBadGateway
                failed_files.append([quote(delete_path), resp.status])

        resp_body = self.get_response_body(
            out_content_type,
            {'Number Deleted': success_count,
             'Number Not Found': not_found_count},
            failed_files)
        if (success_count or not_found_count) and not failed_files:
            return HTTPOk(resp_body, content_type=out_content_type)
        if failed_files:
            return failed_file_response_type(
                resp_body, content_type=out_content_type)
        return HTTPBadRequest('Invalid bulk delete.')

    def handle_extract(self, req, compress_type):
        """
        :params req: a swob Request
        :params compress_type: specifying the compression type of the tar.
                               Accepts '', 'gz, or 'bz2'
        :raises HTTPException: on unhandled errors
        :returns: a swob response to request
        """
        success_count = 0
        failed_files = []
        existing_containers = set()
        out_content_type = req.accept.best_match(ACCEPTABLE_FORMATS)
        if not out_content_type:
            return HTTPNotAcceptable(request=req)
        if req.content_length is None and \
                req.headers.get('transfer-encoding', '').lower() != 'chunked':
            return HTTPBadRequest('Invalid request: no content sent.')
        try:
            vrs, account, extract_base = req.split_path(2, 3, True)
        except ValueError:
            return HTTPNotFound(request=req)
        extract_base = extract_base or ''
        extract_base = extract_base.rstrip('/')
        try:
            tar = tarfile.open(mode='r|' + compress_type,
                               fileobj=req.body_file)
            while True:
                tar_info = tar.next()
                if tar_info is None or \
                        len(failed_files) >= self.max_failed_extractions:
                    break
                if tar_info.isfile():
                    obj_path = tar_info.name
                    if obj_path.startswith('./'):
                        obj_path = obj_path[2:]
                    obj_path = obj_path.lstrip('/')
                    if extract_base:
                        obj_path = extract_base + '/' + obj_path
                    if '/' not in obj_path:
                        continue  # ignore base level file

                    destination = '/'.join(
                        ['', vrs, account, obj_path])
                    container = obj_path.split('/', 1)[0]
                    if not check_utf8(destination):
                        failed_files.append(
                            [quote(destination[:MAX_PATH_LENGTH]),
                             HTTPPreconditionFailed().status])
                        continue
                    if tar_info.size > MAX_FILE_SIZE:
                        failed_files.append([
                            quote(destination[:MAX_PATH_LENGTH]),
                            HTTPRequestEntityTooLarge().status])
                        continue
                    if container not in existing_containers:
                        try:
                            self.create_container(
                                req, '/'.join(['', vrs, account, container]))
                            existing_containers.add(container)
                        except CreateContainerError, err:
                            if err.status_int == HTTP_UNAUTHORIZED:
                                return HTTPUnauthorized(request=req)
                            failed_files.append([
                                quote(destination[:MAX_PATH_LENGTH]),
                                err.status])
                            continue
                        except ValueError:
                            failed_files.append([
                                quote(destination[:MAX_PATH_LENGTH]),
                                HTTP_BAD_REQUEST])
                            continue
                        if len(existing_containers) > self.max_containers:
                            return HTTPBadRequest(
                                'More than %d base level containers in tar.' %
                                self.max_containers)

                    tar_file = tar.extractfile(tar_info)
                    new_env = req.environ.copy()
                    new_env['wsgi.input'] = tar_file
                    new_env['PATH_INFO'] = destination
                    new_env['CONTENT_LENGTH'] = tar_info.size
                    new_env['HTTP_USER_AGENT'] = \
                        '%s BulkExpand' % req.environ.get('HTTP_USER_AGENT')
                    create_obj_req = Request.blank(destination, new_env)
                    resp = create_obj_req.get_response(self.app)
                    if resp.status_int // 100 == 2:
                        success_count += 1
                    else:
                        if resp.status_int == HTTP_UNAUTHORIZED:
                            return HTTPUnauthorized(request=req)
                        failed_files.append([
                            quote(destination[:MAX_PATH_LENGTH]), resp.status])

            resp_body = self.get_response_body(
                out_content_type,
                {'Number Files Created': success_count},
                failed_files)
            if success_count and not failed_files:
                return HTTPCreated(resp_body, content_type=out_content_type)
            if failed_files:
                return HTTPBadGateway(resp_body, content_type=out_content_type)
            return HTTPBadRequest('Invalid Tar File: No Valid Files')

        except tarfile.TarError, tar_error:
            return HTTPBadRequest('Invalid Tar File: %s' % tar_error)

    @wsgify
    def __call__(self, req):
        extract_type = \
            req.headers.get('X-Extract-Archive', '').lower().strip('.')
        if extract_type and req.method == 'PUT':
            archive_type = {'tar': '', 'tar.gz': 'gz',
                            'tar.bz2': 'bz2'}.get(extract_type)
            if archive_type is not None:
                return self.handle_extract(req, archive_type)
            else:
                return HTTPBadRequest("Unsupported archive format")
        if (req.headers.get('X-Bulk-Delete', '').lower() in TRUE_VALUES and
                req.method == 'DELETE'):
            return self.handle_delete(req)

        return self.app

def filter_factory(global_conf, **local_conf):
    conf = global_conf.copy()
    conf.update(local_conf)

    def bulk_filter(app):
        return Bulk(app, conf)
    return bulk_filter

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;

namespace ServiciosWCF.Requerimiento
{
    [ServiceContract]
    public interface IRequerimientoService
    {
        [OperationContract]
        int InsertarRequerimiento(Dominio.Dtos.requerimientoDTO dto);
          [OperationContract]
        bool ActualizarRequerimiento(Dominio.Dtos.requerimientoDTO dto);
          [OperationContract]
        bool EliminarRequerimiento(int idrequerimiento);
          [OperationContract]
        List<Dominio.Dtos.requerimientoDTO> ListarRequerimientoXidusuario(int idusuario);
          [OperationContract]
        List<Dominio.Dtos.requerimientoDTO> ListarRequerimientoXidalmacen(int idalmacen);
          [OperationContract]
        List<Dominio.Dtos.requerimientoDTO> ListarRequerimientoXdetallerequerimiento(string detallerequerimiento);
          [OperationContract]
        List<Dominio.Dtos.requerimientoDTO> ListarRequerimientos();
          [OperationContract]
        Dominio.Dtos.requerimientoDTO BuscarRequerimientoPorID(int idrequerimiento);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
    android:id="@+id/scrollView"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="16dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            android:text="Typeface"
            android:textAppearance="?android:listSeparatorTextViewStyle"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-thin"
            android:text="Roboto Thin"
            android:textAppearance="@style/TextAppearance.AppCompat.Display1"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-light"
            android:text="Roboto Light"
            android:textAppearance="@style/TextAppearance.AppCompat.Display1"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif"
            android:text="Roboto Regular"
            android:textAppearance="@style/TextAppearance.AppCompat.Display1"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-medium"
            android:text="Roboto Medium"
            android:textAppearance="@style/TextAppearance.AppCompat.Display1"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif"
            android:text="Roboto Bold"
            android:textAppearance="@style/TextAppearance.AppCompat.Display1"
            android:textStyle="bold"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-black"
            android:text="Roboto Black"
            android:textAppearance="@style/TextAppearance.AppCompat.Display1"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-thin"
            android:text="Roboto Thin Italic"
            android:textAppearance="@style/TextAppearance.AppCompat.Display1"
            android:textStyle="italic"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-light"
            android:text="Roboto Light Italic"
            android:textAppearance="@style/TextAppearance.AppCompat.Display1"
            android:textStyle="italic"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif"
            android:text="Roboto Italic"
            android:textAppearance="@style/TextAppearance.AppCompat.Display1"
            android:textStyle="italic"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-medium"
            android:text="Roboto Medium Italic"
            android:textAppearance="@style/TextAppearance.AppCompat.Display1"
            android:textStyle="italic"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif"
            android:text="Roboto Bold Italic"
            android:textAppearance="@style/TextAppearance.AppCompat.Display1"
            android:textStyle="bold|italic"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-black"
            android:text="Roboto Black Italic"
            android:textAppearance="@style/TextAppearance.AppCompat.Display1"
            android:textStyle="italic"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            android:layout_marginTop="16dp"
            android:text="Styles"
            android:textAppearance="?android:listSeparatorTextViewStyle"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Display 4"
            android:textAppearance="@style/TextAppearance.AppCompat.Display4"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Display 3"
            android:textAppearance="@style/TextAppearance.AppCompat.Display3"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Display 2"
            android:textAppearance="@style/TextAppearance.AppCompat.Display2"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Display 1"
            android:textAppearance="@style/TextAppearance.AppCompat.Display1"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Headline"
            android:textAppearance="@style/TextAppearance.AppCompat.Headline"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Title"
            android:textAppearance="@style/TextAppearance.AppCompat.Title"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Subheading"
            android:textAppearance="@style/TextAppearance.AppCompat.Subhead"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Body 2"
            android:textAppearance="@style/TextAppearance.AppCompat.Body2"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Body 1"
            android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Caption"
            android:textAppearance="@style/TextAppearance.AppCompat.Caption"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button"
            android:textAppearance="@style/TextAppearance.AppCompat.Button"/>

    </LinearLayout>

</android.support.v4.widget.NestedScrollView>


text:
buffer-writer
===========

Helper for writting into Node buffers


text:
package org.apache.ignite.internal.util.nio;

import org.apache.ignite.*;
import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.plugin.extensions.communication.*;
import org.jetbrains.annotations.*;

import java.io.*;
import java.nio.*;
import java.util.*;

/**
 *
 */
public interface GridCommunicationClient {
    /**
     * Executes the given handshake closure on opened client passing underlying IO streams.
     * This method pulled to client interface a handshake is only operation requiring access
     * to both output and input streams.
     *
     * @param handshakeC Handshake.
     * @throws IgniteCheckedException If handshake failed.
     */
    void doHandshake(IgniteInClosure2X<InputStream, OutputStream> handshakeC) throws IgniteCheckedException;

    /**
     * @return {@code True} if client has been closed by this call,
     *      {@code false} if failed to close client (due to concurrent reservation or concurrent close).
     */
    boolean close();

    /**
     * Forces client close.
     */
    void forceClose();

    /**
     * @return {@code True} if client is closed;
     */
    boolean closed();

    /**
     * @return {@code True} if client was reserved, {@code false} otherwise.
     */
    boolean reserve();

    /**
     * Releases this client by decreasing reservations.
     */
    void release();

    /**
     * @return {@code True} if client was reserved.
     */
    boolean reserved();

    /**
     * Gets idle time of this client.
     *
     * @return Idle time of this client.
     */
    long getIdleTime();

    /**
     * @param data Data to send.
     * @throws IgniteCheckedException If failed.
     */
    void sendMessage(ByteBuffer data) throws IgniteCheckedException;

    /**
     * @param data Data to send.
     * @param len Length.
     * @throws IgniteCheckedException If failed.
     */
    void sendMessage(byte[] data, int len) throws IgniteCheckedException;

    /**
     * @param nodeId Node ID (provided only if versions of local and remote nodes are different).
     * @param msg Message to send.
     * @throws IgniteCheckedException If failed.
     * @return {@code True} if should try to resend message.
     */
    boolean sendMessage(@Nullable UUID nodeId, Message msg) throws IgniteCheckedException;

    /**
     * @param timeout Timeout.
     * @throws IOException If failed.
     */
    void flushIfNeeded(long timeout) throws IOException;

    /**
     * @return {@code True} if send is asynchronous.
     */
    boolean async();
}


text:
"""This module provides the code necessary to write a Hairball plugin."""

import kurt
from collections import Counter

class HairballPlugin(object):

    """The simple plugin name should go on the first comment line.

    The plugin description should start on the third line and can span as many
    lines as needed, though all newlines will be treated as a single space.

    If you are seeing this message it means you need to define a docstring for
    your plugin.

    """

    HAT_GREEN_FLAG = 0
    HAT_WHEN_I_RECEIVE = 1
    HAT_MOUSE = 2
    HAT_KEY = 3
    NO_HAT = 4

    BLOCKMAPPING = {
        'costume': frozenset([('switch backdrop to %s', 'absolute'),
                              ('next backdrop', 'relative'),
                              ('switch costume to %s', 'absolute'),
                              ('next costume', 'relative')]),
        'orientation': frozenset([('turn @turnRight %s degrees', 'relative'),
                                  ('turn @turnLeft %s degrees', 'relative'),
                                  ('point in direction %s', 'absolute'),
                                  ('point towards %s', 'relative')]),
        'position': frozenset([('move %s steps', 'relative'),
                               ('go to x:%s y:%s', 'absolute'),
                               ('go to %s', 'relative'),
                               ('glide %s secs to x:%s y:%s', 'relative'),
                               ('change x by %s', 'relative'),
                               ('set x to %s', 'absolute'),
                               ('change y by %s', 'relative'),
                               ('set y to %s', 'absolute')]),
        'size': frozenset([('change size by %s', 'relative'),
                           ('set size to %s%%', 'absolute')]),
        'visibility': frozenset([('hide', 'absolute'),
                                 ('show', 'absolute')])}

    @staticmethod
    def iter_blocks(block_list):
        """A generator for blocks contained in a block list.

        Yields tuples containing the block name, the depth that the block was
        found at, and finally a handle to the block itself.

        """
        # queue the block and the depth of the block
        queue = [(block, 0) for block in block_list
                 if isinstance(block, kurt.Block)]
        while queue:
            block, depth = queue.pop(0)
            assert block.type.text
            yield block.type.text, depth, block
            for arg in block.args:
                if hasattr(arg, '__iter__'):
                    queue[0:0] = [(x, depth + 1) for x in arg
                                  if isinstance(x, kurt.Block)]
                elif isinstance(arg, kurt.Block):
                    queue.append((arg, depth))

    @staticmethod
    def iter_scripts(scratch):
        """A generator for all scripts contained in a scratch file.

        yields stage scripts first, then scripts for each sprite

        """
        for script in scratch.stage.scripts:
            if not isinstance(script, kurt.Comment):
                yield script
        for sprite in scratch.sprites:
            for script in sprite.scripts:
                if not isinstance(script, kurt.Comment):
                    yield script

    @staticmethod
    def iter_sprites(scratch):
        """A generator for all sprites contained in a scratch file."""
        for sprite in scratch.sprites:
            yield sprite

    @staticmethod
    def iter_sprite_scripts(scratch):
        """A generator for all scripts contained in a scratch file.

        yields stage scripts first, then scripts for each sprite

        """
        for script in scratch.stage.scripts:
            if not isinstance(script, kurt.Comment):
                yield ('Stage', script)
        for sprite in scratch.sprites:
            for script in sprite.scripts:
                if not isinstance(script, kurt.Comment):
                    yield (sprite.name, script)

    @staticmethod
    def script_start_type(script):
        """Return the type of block the script begins with."""
        if script[0].type.text == 'when @greenFlag clicked':
            return HairballPlugin.HAT_GREEN_FLAG
        elif script[0].type.text == 'when I receive %s':
            return HairballPlugin.HAT_WHEN_I_RECEIVE
        elif script[0].type.text == 'when this sprite clicked':
            return HairballPlugin.HAT_MOUSE
        elif script[0].type.text == 'when %s key pressed':
            return HairballPlugin.HAT_KEY
        else:
            return HairballPlugin.NO_HAT

    @classmethod
    def get_broadcast_events(cls, script):
        """Return a Counter of event-names that were broadcast.

        The Count will contain the key True if any of the broadcast blocks
        contain a parameter that is a variable.

        """
        events = Counter()
        for name, _, block in cls.iter_blocks(script):
            if 'broadcast %s' in name:
                if isinstance(block.args[0], kurt.Block):
                    events[True] += 1
                else:
                    events[block.args[0].lower()] += 1
        return events

    @classmethod
    def tag_reachable_scripts(cls, scratch):
        """Tag each script with attribute reachable.

        The reachable attribute will be set false for any script that does not
        begin with a hat block. Additionally, any script that begins with a
        'when I receive' block whose event-name doesn't appear in a
        corresponding broadcast block is marked as unreachable.

        """
        if getattr(scratch, 'hairball_prepared', False):  # Only process once
            return

        reachable = set()
        untriggered_events = {}
        # Initial pass to find reachable and potentially reachable scripts
        for script in cls.iter_scripts(scratch):
            if not isinstance(script, kurt.Comment):
                starting_type = cls.script_start_type(script)
                if starting_type == cls.NO_HAT:
                    script.reachable = False
                elif starting_type == cls.HAT_WHEN_I_RECEIVE:
                    # Value will be updated if reachable
                    script.reachable = False
                    message = script[0].args[0].lower()
                    untriggered_events.setdefault(message, set()).add(script)
                else:
                    script.reachable = True
                    reachable.add(script)
        # Expand reachable states based on broadcast events
        while reachable:
            for event in cls.get_broadcast_events(reachable.pop()):
                if event in untriggered_events:
                    for script in untriggered_events.pop(event):
                        script.reachable = True
                        reachable.add(script)
        scratch.hairball_prepared = True

    @property
    def description(self):
        """Attribute that returns the plugin description from its docstring."""
        lines = []
        for line in self.__doc__.split('\n')[2:]:
            line = line.strip()
            if line:
                lines.append(line)
        return ' '.join(lines)

    @property
    def name(self):
        """Attribute that returns the plugin name from its docstring."""
        return self.__doc__.split('\n')[0]

    def _process(self, scratch, filename, **kwargs):
        """Internal hook that marks reachable scripts before calling analyze.

        Returns data exactly as returned by the analyze method.

        """
        self.tag_reachable_scripts(scratch)
        return self.analyze(scratch, filename=filename, **kwargs)

    def analyze(self, scratch, filename, **kwargs):
        """Perform the analysis and return the results.

        :param scratch: A Kurt instance which represents the scratch file. This
          will always be the first parameter.
        :param filename: The path to the loaded file. This parameter will
          always be passed by keyword (don't depend on its position).

        This function must be overridden by a subclass.

        """
        raise NotImplementedError('Subclass must implement this method')

    def finalize(self):
        """Overwrite this function to be notified when analysis is complete.

        This is useful for saving/outputing aggregate results or performing any
        necessary cleanup.

        """
        pass


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>wCMF 4.0: ControllerTestCase Class Reference</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="A MDSD framework for building reliable, maintainable and extendable web applications with PHP">
  <meta name="keywords" content="PHP, web application framework, model driven development">
  <meta name="author" content="wemove digital solutions">
  <link rel="shortcut icon" href="theme/images/favicon.ico">

  <link href="theme/css/doxstyles.css" rel="stylesheet">

  <link href="theme/bootstrap3/css/bootstrap.min.css" rel="stylesheet">
  <link href="theme/bootstrap3/css/font-awesome.min.css" rel="stylesheet">

  <link href="theme/js/tocify/jquery.tocify.css" rel="stylesheet">

  <link href="theme/css/syntax.css" rel="stylesheet">
  <link href="theme/css/style.css" rel="stylesheet">

          <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".menu-navbar-collapse">
            Toggle navigation
          </button>
          wCMF 4.0

 Guides

Getting started

Architecture

Model

Persistence

Presentation

Configuration

Security

I18n & l10n

Tests

 API

 Code

 Support

                <input id="MSearchField" type="text" class="form-control" placeholder="Search API" name="query" onkeyup="searchBox.OnSearchFieldChange(event)">

wcmf

test

lib

ControllerTestCase

Protected Member Functions |
List of all members

ControllerTestCase Class Reference

Detailed Description

ControllerTestCase is the base class for test cases used for Controllers.

Author

ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 22 of file ControllerTestCase.php.

   Inheritance diagram for ControllerTestCase:

This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.

Protected Member Functions

 	runRequest ($action, $data)

 	getControllerName ()

 Protected Member Functions inherited from DatabaseTestCase

 	setUp ()

 	tearDown ()

Additional Inherited Members

 Public Member Functions inherited from DatabaseTestCase

 	getConnection ()

Member Function Documentation

          runRequest
          (

          $action,

          $data

          )

protected

Make a request to the controller.

This method makes sure that the requested action is routed to the controller to be tested. The calling method has to make sure that a session is started, if necessary (e.g. by calling TestUtil::startSession()). The transaction will be rolled back before the request is run in order to avoid side effects.

Parameters

$action	The action

$data	An associative array with additional key/value pairs for the Request instance

Returns

Response instance

Definition at line 34 of file ControllerTestCase.php.

          getControllerName
          (
          	)

abstractprotected

Get the fully qualified name of the controller to test.

Returns

The name of the controller

        © 2016 wemove digital solutions

          Generated on Fri Jul 15 2016 22:20:52 for wCMF by  doxygen 1.8.10


text:
@media -sass-debug-info{filename{font-family:file\:\/\/\/tmp\/assetic_compassSsHs0Y\.scss}line{font-family:\000031}}
#tuti-twitter {
  width: 200px;
  height: 200px;
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/tmp\/assetic_compassSsHs0Y\.scss}line{font-family:\000035}}
#tuti-facebook {
  width: 200px;
  height: 200px;
}


text:
from datetime import date
from django.test import TestCase, RequestFactory, Client
from test_app.models import TestModel

class ViewsTest(TestCase):
    def setUp(self):
        self.factory = RequestFactory()
        self.m = TestModel()
        self.m.date = date(2015, 2, 21)
        self.id = self.m.save()
        self.n = TestModel()
        self.n.date = date.today()
        self.n.save()

    def test_get_context_data(self):
        response = self.client.get(f'/detail/{self.m.id}', {},
                                   HTTP_X_REQUESTED_WITH="XMLHttpRequest")

        base_template = response.context['base_template']
        self.assertTrue("octopus/ajax.html" == base_template)

        response = self.client.get(f'/detail/{self.m.id}', {})

        base_template = response.context['base_template']
        self.assertTrue("base.html" == base_template)

    def test_fragment_response(self):
        response = self.client.get(f'/detail/{self.m.id}', {},
                                   HTTP_X_REQUESTED_WITH="XMLHttpRequest")

        conversation = response.content.strip()

        self.assertTrue(
            conversation.startswith(b'Fancy people talking about fancy dances'))

        self.assertTrue(b'The truth' not in conversation)
        self.assertTrue(
            conversation.endswith(b'Loneliness, violence, and peanut butter'))

    def test_full_response(self):
        response = self.client.get('/list/', {}).content.strip()

        self.assertTrue(b'too much milksteak' in response)


text:
#include <sm/gen.h>
SM_RCSID("@(#)$Id: debug.c,v 1.32 2009/09/20 05:38:46 ca Exp $")

/*
**  libsm debugging and tracing
**  For documentation, see debug.html.
*/

#include <ctype.h>
#include <stdlib.h>
#if _FFR_DEBUG_PID_TIME
#include <unistd.h>
#include <time.h>
#endif /* _FFR_DEBUG_PID_TIME */
#include <setjmp.h>
#include <sm/io.h>
#include <sm/assert.h>
#include <sm/conf.h>
#include <sm/debug.h>
#include <sm/string.h>
#include <sm/varargs.h>
#include <sm/heap.h>

static void		 sm_debug_reset __P((void));
static const char	*parse_named_setting_x __P((const char *));

/*
**  Abstractions for printing trace messages.
*/

/*
**  The output file to which trace output is directed.
**  There is a controversy over whether this variable
**  should be process global or thread local.
**  To make the interface more abstract, we've hidden the
**  variable behind access functions.
*/

static SM_FILE_T *SmDebugOutput = smioout;

/*
**  SM_DEBUG_FILE -- Returns current debug file pointer.
**
**	Parameters:
**		none.
**
**	Returns:
**		current debug file pointer.
*/

SM_FILE_T *
sm_debug_file()
{
	return SmDebugOutput;
}

/*
**  SM_DEBUG_SETFILE -- Sets debug file pointer.
**
**	Parameters:
**		fp -- new debug file pointer.
**
**	Returns:
**		none.
**
**	Side Effects:
**		Sets SmDebugOutput.
*/

void
sm_debug_setfile(fp)
	SM_FILE_T *fp;
{
	SmDebugOutput = fp;
}

/*
**  SM_DEBUG_CLOSE -- Close debug file pointer.
**
**	Parameters:
**		none.
**
**	Returns:
**		none.
**
**	Side Effects:
**		Closes SmDebugOutput.
*/

void
sm_debug_close()
{
	if (SmDebugOutput != NULL && SmDebugOutput != smioout)
	{
		sm_io_close(SmDebugOutput, SM_TIME_DEFAULT);
		SmDebugOutput = NULL;
	}
}

/*
**  SM_DPRINTF -- printf() for debug output.
**
**	Parameters:
**		fmt -- format for printf()
**
**	Returns:
**		none.
*/

#if _FFR_DEBUG_PID_TIME
SM_DEBUG_T SmDBGPidTime = SM_DEBUG_INITIALIZER("sm_trace_pid_time",
	"@(#)$Debug: sm_trace_pid_time - print pid and time in debug $");
#endif /* _FFR_DEBUG_PID_TIME */

void
#if SM_VA_STD
sm_dprintf(char *fmt, ...)
#else /* SM_VA_STD */
sm_dprintf(fmt, va_alist)
	char *fmt;
	va_dcl
#endif /* SM_VA_STD */
{
	SM_VA_LOCAL_DECL

	if (SmDebugOutput == NULL)
		return;
#if _FFR_DEBUG_PID_TIME
	/* note: this is ugly if the output isn't a full line! */
	if (sm_debug_active(&SmDBGPidTime, 1))
	{
		static char str[32] = "[1900-00-00/00:00:00] ";
		struct tm *tmp;
		time_t currt;

		currt = time((time_t *)0);
		tmp = localtime(&currt);
		snprintf(str, sizeof(str), "[%d-%02d-%02d/%02d:%02d:%02d] ",
			1900 + tmp->tm_year,	/* HACK */
			tmp->tm_mon + 1,
			tmp->tm_mday,
			tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
		sm_io_fprintf(SmDebugOutput, SmDebugOutput->f_timeout,
			"%ld: %s ", (long) getpid(), str);
	}
#endif /* _FFR_DEBUG_PID_TIME */

	SM_VA_START(ap, fmt);
	sm_io_vfprintf(SmDebugOutput, SmDebugOutput->f_timeout, fmt, ap);
	SM_VA_END(ap);
}

/*
**  SM_DFLUSH -- Flush debug output.
**
**	Parameters:
**		none.
**
**	Returns:
**		none.
*/

void
sm_dflush()
{
	sm_io_flush(SmDebugOutput, SM_TIME_DEFAULT);
}

/*
**  This is the internal database of debug settings.
**  The semantics of looking up a setting in the settings database
**  are that the *last* setting specified in a -d option on the sendmail
**  command line that matches a given SM_DEBUG structure is the one that is
**  used.  That is necessary to conform to the existing semantics of
**  the sendmail -d option.  We store the settings as a linked list in
**  reverse order, so when we do a lookup, we take the *first* entry
**  that matches.
*/

typedef struct sm_debug_setting SM_DEBUG_SETTING_T;
struct sm_debug_setting
{
	const char		*ds_pattern;
	unsigned int		ds_level;
	SM_DEBUG_SETTING_T	*ds_next;
};
SM_DEBUG_SETTING_T *SmDebugSettings = NULL;

/*
**  We keep a linked list of SM_DEBUG structures that have been initialized,
**  for use by sm_debug_reset.
*/

SM_DEBUG_T *SmDebugInitialized = NULL;

const char SmDebugMagic[] = "sm_debug";

/*
**  SM_DEBUG_RESET -- Reset SM_DEBUG structures.
**
**	Reset all SM_DEBUG structures back to the uninitialized state.
**	This is used by sm_debug_addsetting to ensure that references to
**	SM_DEBUG structures that occur before sendmail processes its -d flags
**	do not cause those structures to be permanently forced to level 0.
**
**	Parameters:
**		none.
**
**	Returns:
**		none.
*/

static void
sm_debug_reset()
{
	SM_DEBUG_T *debug;

	for (debug = SmDebugInitialized;
	     debug != NULL;
	     debug = debug->debug_next)
	{
		debug->debug_level = SM_DEBUG_UNKNOWN;
	}
	SmDebugInitialized = NULL;
}

/*
**  SM_DEBUG_ADDSETTING_X -- add an entry to the database of debug settings
**
**	Parameters:
**		pattern -- a shell-style glob pattern (see sm_match).
**			WARNING: the storage for 'pattern' will be owned by
**			the debug package, so it should either be a string
**			literal or the result of a call to sm_strdup_x.
**		level -- a non-negative integer.
**
**	Returns:
**		none.
**
**	Exceptions:
**		F:sm_heap -- out of memory
*/

void
sm_debug_addsetting_x(pattern, level)
	const char *pattern;
	int level;
{
	SM_DEBUG_SETTING_T *s;

	SM_REQUIRE(pattern != NULL);
	SM_REQUIRE(level >= 0);
	s = sm_malloc_x(sizeof(SM_DEBUG_SETTING_T));
	s->ds_pattern = pattern;
	s->ds_level = (unsigned int) level;
	s->ds_next = SmDebugSettings;
	SmDebugSettings = s;
	sm_debug_reset();
}

/*
**  PARSE_NAMED_SETTING_X -- process a symbolic debug setting
**
**	Parameters:
**		s -- Points to a non-empty \0 or , terminated string,
**		     of which the initial character is not a digit.
**
**	Returns:
**		pointer to terminating \0 or , character.
**
**	Exceptions:
**		F:sm.heap -- out of memory.
**
**	Side Effects:
**		adds the setting to the database.
*/

static const char *
parse_named_setting_x(s)
	const char *s;
{
	const char *pat, *endpat;
	int level;

	pat = s;
	while (*s != '\0' && *s != ',' && *s != '.')
		++s;
	endpat = s;
	if (*s == '.')
	{
		++s;
		level = 0;
		while (isascii(*s) && isdigit(*s))
		{
			level = level * 10 + (*s - '0');
			++s;
		}
		if (level < 0)
			level = 0;
	}
	else
		level = 1;

	sm_debug_addsetting_x(sm_strndup_x(pat, endpat - pat), level);

	/* skip trailing junk */
	while (*s != '\0' && *s != ',')
		++s;

	return s;
}

/*
**  SM_DEBUG_ADDSETTINGS_X -- process a list of debug options
**
**	Parameters:
**		s -- a list of debug settings, eg the argument to the
**		     sendmail -d option.
**
**		The syntax of the string s is as follows:
**
**		<settings> ::= <setting> | <settings> "," <setting>
**		<setting> ::= <categories> | <categories> "." <level>
**		<categories> ::= [a-zA-Z_*?][a-zA-Z0-9_*?]*
**
**		However, note that we skip over anything we don't
**		understand, rather than report an error.
**
**	Returns:
**		none.
**
**	Exceptions:
**		F:sm.heap -- out of memory
**
**	Side Effects:
**		updates the database of debug settings.
*/

void
sm_debug_addsettings_x(s)
	const char *s;
{
	for (;;)
	{
		if (*s == '\0')
			return;
		if (*s == ',')
		{
			++s;
			continue;
		}
		s = parse_named_setting_x(s);
	}
}

/*
**  SM_DEBUG_LOADLEVEL -- Get activation level of the specified debug object.
**
**	Parameters:
**		debug -- debug object.
**
**	Returns:
**		Activation level of the specified debug object.
**
**	Side Effects:
**		Ensures that the debug object is initialized.
*/

int
sm_debug_loadlevel(debug)
	SM_DEBUG_T *debug;
{
	if (debug->debug_level == SM_DEBUG_UNKNOWN)
	{
		SM_DEBUG_SETTING_T *s;

		for (s = SmDebugSettings; s != NULL; s = s->ds_next)
		{
			if (sm_match(debug->debug_name, s->ds_pattern))
			{
				debug->debug_level = s->ds_level;
				goto initialized;
			}
		}
		debug->debug_level = 0;
	initialized:
		debug->debug_next = SmDebugInitialized;
		SmDebugInitialized = debug;
	}
	return (int) debug->debug_level;
}

/*
**  SM_DEBUG_LOADACTIVE -- Activation level reached?
**
**	Parameters:
**		debug -- debug object.
**		level -- level to check.
**
**	Returns:
**		true iff the activation level of the specified debug
**			object >= level.
**
**	Side Effects:
**		Ensures that the debug object is initialized.
*/

bool
sm_debug_loadactive(debug, level)
	SM_DEBUG_T *debug;
	int level;
{
	return sm_debug_loadlevel(debug) >= level;
}


text:
package org.mybatis.guice.transactional;

import javax.transaction.xa.XAException;

public class MyBatisXAException extends XAException {
	private static final long serialVersionUID = -7280133560046132709L;

	public MyBatisXAException(String message, int errorCode) {
        super(message);
        this.errorCode = errorCode;
    }

    public MyBatisXAException(String message, int errorCode, Throwable t) {
        super(message);
        this.errorCode = errorCode;
        initCause(t);
    }

}


text:
CREATE PROCEDURE [a b]
AS
BEGIN
EXEC sp_execute_external_script @language = N'R'
    , @script = N'
# comment
x <- 1
'
    , @input_data_1 = N'-- comment
SELECT * FROM ABC
-- comment'
    WITH RESULT SETS (([MY] NVARCHAR(max)));
END;


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:paddingBottom="15dp"
    android:orientation="vertical">

    <TextView
        android:id="@+id/tv_views_title_and_value_title"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="left|center_vertical"
        android:textColor="#ffa8abad"
        android:paddingBottom="10dp"
        android:textSize="15sp" />

    <TextView
        android:id="@+id/tv_views_title_and_value_value"
        android:textIsSelectable="true"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:background="@drawable/selector_border_normal"
        android:gravity="left|center_vertical"
        android:layout_marginLeft="15dp"
        android:hint="@null"
        android:textColor="@color/base_font" />

</LinearLayout>


text:
import scala.collection.immutable.HashMap

/**
  * Created by menzelmi on 27.09.16.
  */
object WordCounter {

  lazy val nonWord = "[^\\p{L}\\p{Nd}]+"

  def count(text: TraversableOnce[String]): Map[String, Int] =
    text.flatMap(_.split("\\s+"))
      .map(_.replaceAll(nonWord, "").toLowerCase)
      .filter(_.length > 0)
      .foldRight(HashMap.empty[String, Int])(
        (word, countsMap) => countsMap + (word -> (countsMap.getOrElse(word, 0) + 1))
      )

}


text:
import { Commit, Result, ResultStatus, Rule } from './rule-types';

type ConfirmModifyCallback = (proposedMessage: string) => Promise<boolean>;

export default async function ruleRunner(
  rules: Rule[],
  commit: Commit,
): Promise<Result> {
  const currentCommit = commit;
  let lastModifyResult: Result | null = null;

  for (const rule of rules) {
    const result = await rule.evaluate(currentCommit);

    switch (result.status) {
      case ResultStatus.Approved:
        continue;
      case ResultStatus.Modify:
        if (!result.proposed) {
          throw new Error('Rule error: there is no proposed message!');
        }

        lastModifyResult = result;
        currentCommit.message.raw = result.proposed;
        continue;
      case ResultStatus.Rejected:
        if (!result.warning) {
          throw new Error('Rule error: there is no warning message!');
        }

        return result;
    }
  }

  return (
    lastModifyResult || {
      status: ResultStatus.Approved,
    }
  );
}


text:
// @AngularClass

exports.config = {
  baseUrl: 'http://localhost:3000/',

  allScriptsTimeout: 11000,

  framework: 'jasmine',

  jasmineNodeOpts: {
    defaultTimeoutInterval: 60000,
    showTiming: true
  },

  capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
      'args': ['show-fps-counter=true']
    }
  },

  seleniumServerJar: './node_modules/protractor/selenium/selenium-server-standalone-2.47.1.jar',

  specs: [
    'test/**/*.e2e.js'
  ],

  onPrepare: function() {
    browser.ignoreSynchronization = true;
  }

};