text:
var __extends = this.__extends || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var egret;
(function (egret) {
    /**
     * 这个类是HTML5的WebWrapper的第一个版本
     */
    var Browser = (function (_super) {
        __extends(Browser, _super);
        function Browser() {
            _super.call(this);
            this.ua = navigator.userAgent.toLowerCase();
            this.trans = this._getTrans();
        }
        Browser.getInstance = function () {
            if (Browser.instance == null) {
                Browser.instance = new Browser();
            }
            return Browser.instance;
        };
        Object.defineProperty(Browser.prototype, "isMobile", {
            /**
             * @deprecated
             * @returns {boolean}
             */
            get: function () {
                egret.Logger.warning("Browser.isMobile接口参数已经变更,请尽快调整用法为 egret.MainContext.deviceType == egret.MainContext.DEVICE_MOBILE ");
                return egret.MainContext.deviceType == egret.MainContext.DEVICE_MOBILE;
            },
            enumerable: true,
            configurable: true
        });
        Browser.prototype._getHeader = function (tempStyle) {
            if ("transform" in tempStyle) {
                return "";
            }
            var transArr = ["webkit", "ms", "Moz", "O"];
            for (var i = 0; i < transArr.length; i++) {
                var transform = transArr[i] + 'Transform';
                if (transform in tempStyle)
                    return transArr[i];
            }
            return "";
        };
        Browser.prototype._getTrans = function () {
            var tempStyle = document.createElement('div').style;
            var _header = this._getHeader(tempStyle);
            var type = "transform";
            if (_header == "") {
                return type;
            }
            return _header + type.charAt(0).toUpperCase() + type.substr(1);
        };
        Browser.prototype.$new = function (x) {
            return this.$(document.createElement(x));
        };
        Browser.prototype.$ = function (x) {
            var parent = document;
            var el = (x instanceof HTMLElement) ? x : parent.querySelector(x);
            if (el) {
                el.find = el.find || this.$;
                el.hasClass = el.hasClass || function (cls) {
                    return this.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
                };
                el.addClass = el.addClass || function (cls) {
                    if (!this.hasClass(cls)) {
                        if (this.className) {
                            this.className += " ";
                        }
                        this.className += cls;
                    }
                    return this;
                };
                el.removeClass = el.removeClass || function (cls) {
                    if (this.hasClass(cls)) {
                        this.className = this.className.replace(cls, '');
                    }
                    return this;
                };
                el.remove = el.remove || function () {
                    //                    if (this.parentNode)
                    //                        this.parentNode.removeChild(this);
                    //                        return this;
                };
                el.appendTo = el.appendTo || function (x) {
                    x.appendChild(this);
                    return this;
                };
                el.prependTo = el.prependTo || function (x) {
                    (x.childNodes[0]) ? x.insertBefore(this, x.childNodes[0]) : x.appendChild(this);
                    return this;
                };
                el.transforms = el.transforms || function () {
                    this.style[Browser.getInstance().trans] = Browser.getInstance().translate(this.position) + Browser.getInstance().rotate(this.rotation) + Browser.getInstance().scale(this.scale) + Browser.getInstance().skew(this.skew);
                    return this;
                };
                el.position = el.position || { x: 0, y: 0 };
                el.rotation = el.rotation || 0;
                el.scale = el.scale || { x: 1, y: 1 };
                el.skew = el.skew || { x: 0, y: 0 };
                el.translates = function (x, y) {
                    this.position.x = x;
                    this.position.y = y - egret.MainContext.instance.stage.stageHeight;
                    this.transforms();
                    return this;
                };
                el.rotate = function (x) {
                    this.rotation = x;
                    this.transforms();
                    return this;
                };
                el.resize = function (x, y) {
                    this.scale.x = x;
                    this.scale.y = y;
                    this.transforms();
                    return this;
                };
                el.setSkew = function (x, y) {
                    this.skew.x = x;
                    this.skew.y = y;
                    this.transforms();
                    return this;
                };
            }
            return el;
        };
        Browser.prototype.translate = function (a) {
            return "translate(" + a.x + "px, " + a.y + "px) ";
        };
        Browser.prototype.rotate = function (a) {
            return "rotate(" + a + "deg) ";
        };
        Browser.prototype.scale = function (a) {
            return "scale(" + a.x + ", " + a.y + ") ";
        };
        Browser.prototype.skew = function (a) {
            return "skewX(" + -a.x + "deg) skewY(" + a.y + "deg)";
        };
        return Browser;
    })(egret.HashObject);
    egret.Browser = Browser;
    Browser.prototype.__class__ = "egret.Browser";
})(egret || (egret = {}));


text:
package io.spring.configuration;

import javax.sql.DataSource;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;

/**
 * @author Michael Minella
 */
@Configuration
public class DataSourceConfiguration {

	@Bean
	public DataSource dataSource() {
		return new EmbeddedDatabaseBuilder()
			.setType(EmbeddedDatabaseType.HSQL)
			.build();
	}

	@Bean
	public DataSource secondDataSource() {
		return new EmbeddedDatabaseBuilder()
			.setType(EmbeddedDatabaseType.H2)
			.build();
	}
}

redpajama_set_name: RedPajamaGithub


text:
class Notifier < ApplicationMailer
  default :from => "noreplylivoras@163.com"

  def order_received(order)
    @order = order

    mail to: order.email, subject: "你的订单已确定", cc: "livoras@163.com"
  end

  def order_shipped
    @greeting = "Hi"

    mail to: "to@example.org"
  end
end


text:
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
# Install system components
RUN apt-get update -y && apt-get install -y  curl gnupg apt-transport-https && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list' && apt-get update -y && apt-get install -y powershell

# Start PowerShell
SHELL ["pwsh", "-Command"]

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS startup
# Install system components
RUN apt-get update -y && apt-get install -y  curl gnupg apt-transport-https && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list' && apt-get update -y && apt-get install -y powershell

# Start PowerShell
SHELL ["pwsh", "-Command"]

FROM startup AS build

WORKDIR /source

COPY . .
RUN dotnet restore "src/Parking/FreeParkingSystem.Parking.API/FreeParkingSystem.Parking.API.csproj"

WORKDIR "/source/src/Parking/FreeParkingSystem.Parking.API"

RUN dotnet build "FreeParkingSystem.Parking.API.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "FreeParkingSystem.Parking.API.csproj" -c Release -o /app

WORKDIR "/"
ADD tools app/tools
ADD src/Parking/FreeParkingSystem.Parking.API/Properties/Run.ps1 /app/Run.ps1
RUN Remove-Item .\source -Recurse -Force
FROM base AS final
WORKDIR /app
COPY --from=publish /app .

ENTRYPOINT ["pwsh","-File", "Run.ps1"]


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0; URL=ColinSternResume.pdf" />
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Colin Stern's Resume</title>

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

    <link href="css/main.css" rel="stylesheet">

    <link href='http://fonts.googleapis.com/css?family=Montserrat:700' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Lora:400italic' rel='stylesheet' type='text/css'>
    <link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">

Resume Redirect

                You are not automatically redirected to my resume, please click here


text:
<!DOCTYPE html>

        <title>Install - SmartCMS</title>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />
        <link rel="stylesheet" href="css/style.css" />

T&C + MIT Licence

Vailidation

Database Setup

Create The First User

Finishing

Terms and Conditions

                                Welcome to the install of our CMS! If you continue to browse and use this CMS, you are agreeing to comply with and be bound by the following terms and conditions of use, which govern AtlasDev's relationship with you in relation to this CMS. If you disagree with any part of these terms and conditions, please do not use our CMS.

                                The term 'AtlasDev' or 'us' or 'we' refers to the owner of the CMS. The term 'you' refers to the user or viewer of this CMS.

                                The use of this CMS is subject to the following terms of use:

The content of the pages of this CMS is for your general information and use only. It is subject to change without notice.

Neither we nor any third parties provide any warranty or guarantee as to the accuracy, timeliness, performance, completeness or suitability of the information and materials found or offered on this CMS for any particular purpose. You acknowledge that such information and materials may contain inaccuracies or errors and we expressly exclude liability for any such inaccuracies or errors to the fullest extent permitted by law.

Your use of any information or materials on this CMS is entirely at your own risk, for which we shall not be liable. It shall be your own responsibility to ensure that any products, services or information available through this CMS meet your specific requirements.

This CMS contains material which is owned by or licensed to us. This material includes, but is not limited to, the design, layout, look, appearance and graphics. Reproduction is prohibited other than in accordance with the copyright notice, which forms part of these terms and conditions.

All trade marks reproduced in this CMS which are not the property of, or licensed to, the operator are acknowledged on the CMS.

Unauthorised use of this CMS may give rise to a claim for damages and/or be a criminal offence.
                                From time to time this CMS may also include links to other websites. These links are provided for your convenience to provide further information. They do not signify that we endorse the CMS. We have no responsibility for the content of the linked CMS.

Your use of this CMS and any dispute arising out of such use of the CMS is subject to the laws of the Kingdom of the Netherlands.

MIT agreement

                                Copyright © 2014 AtlasDev

                                Permission is hereby granted, free of charge, to any person obtaining a copy
                                of this software and associated documentation files (the "Software"), to deal
                                in the Software without restriction, including without limitation the rights
                                to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
                                copies of the Software, and to permit persons to whom the Software is
                                furnished to do so, subject to the following conditions:

                                The above copyright notice and this permission notice shall be included in
                                all copies or substantial portions of the Software.

                                THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
                                IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
                                FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
                                AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
                                LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
                                OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
                                THE SOFTWARE.

                            <input type="checkbox" name="licence" value="agreed" id="tnc" /> I have read and accepted the terms and conditions and the MIT licence

Validation

Database Setup

Create The First User

Thank you for installing SmartCMS!

                                You are now ready to use your brand new CMS! We recomment the following things for you:

                                    Delete the install directory from your ftp client. This is not needed, but we do however recomment it. You know, in case we fail you.

                                    Add some new text to the home page. The default text is boring, issn't it? You can change it by clicking on the Edit button next to the header, just on the home page, how awsome is that?!

                                    Login at the admin backend. Look in the heart of the system!

                                    Change the theme of the site. The default theme is awsome, but there are some community made which are awsome too! Take a look at it in the admin backend, at Themes/Install.

                                    Add some modules. That's the awsome thing about SmartCMS, Its modulair! You can add awsome things to your site, whitin some mouseclicks. They are both made by our developers (official) and community made (unofficial). You can add things like Forums or Blogs. You can install modules in the admin backend at Modules/Install

Previous

Next

Finish

                        Copyright © 2014 AtlasDev


text:
package org.apache.qpid.codec;

import org.apache.mina.transport.socket.nio.SocketConnector;
import org.apache.mina.common.ConnectFuture;
import org.apache.mina.common.IoHandlerAdapter;
import org.apache.mina.common.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.qpid.framing.AMQDataBlock;
import org.apache.qpid.framing.AMQFrame;
import org.apache.qpid.framing.BasicDeliverBody;
import org.apache.qpid.framing.ContentBody;

import java.net.InetSocketAddress;

public class Client extends IoHandlerAdapter
{
    //private static final int[] DEFAULT_SIZES = new int[]{1024, 512, 256, 128, 56};
    //private static final int[] DEFAULT_SIZES = new int[]{256, 256, 256, 256, 256, 512, 512, 512, 512, 512};
    private static final int[] DEFAULT_SIZES = new int[]{256, 512, 256, 512, 256, 512, 256, 512, 256, 512};
    //private static final int[] DEFAULT_SIZES = new int[]{1024, 1024, 1024, 1024, 1024};

    private final IoSession _session;
    private final long _start;
    private final int _size;
    private final int _count;
    private int _received;
    private boolean _closed;

    Client(String host, int port, int size, int count) throws Exception
    {
        _count = count;
        _size = size;
        AMQDataBlock block = BasicDeliverTest.getDataBlock(size);

        InetSocketAddress address = new InetSocketAddress(host, port);
        ConnectFuture future = new SocketConnector().connect(address, this);
        future.join();
        _session = future.getSession();

        _start = System.currentTimeMillis();
        for(int i = 0; i < count; i++)
        {
            _session.write(block);
        }
    }

    void close()
    {
        long time = System.currentTimeMillis() - _start;
        System.out.println("Received " + _received + " messages of " + _size
                                       + " bytes in " + time + "ms.");
        _session.close();
        synchronized(this)
        {
            _closed = true;
            notify();
        }
    }

    void waitForClose() throws InterruptedException
    {
        synchronized(this)
        {
            while(!_closed)
            {
                wait();
            }
        }
    }

    public void sessionCreated(IoSession session) throws Exception
    {
        session.getFilterChain().addLast("protocolFilter", new ProtocolCodecFilter(new AMQCodecFactory(false)));
    }

    public void messageReceived(IoSession session, Object object) throws Exception
    {
        if(isContent(object) && ++_received == _count) close();
    }

    public void exceptionCaught(IoSession session, Throwable throwable) throws Exception
    {
        throwable.printStackTrace();
        close();
    }

    private static boolean isDeliver(Object o)
    {
        return o instanceof AMQFrame && ((AMQFrame) o).getBodyFrame() instanceof BasicDeliverBody;
    }

    private static boolean isContent(Object o)
    {
        return o instanceof AMQFrame && ((AMQFrame) o).getBodyFrame() instanceof ContentBody;
    }

    public static void main(String[] argv) throws Exception
    {
        String host = argv.length > 0 ? argv[0] : "localhost";
        int port = argv.length > 1 ? Integer.parseInt(argv[1]) : 8888;
        int count = argv.length > 2 ? Integer.parseInt(argv[2]) : 10000;
        int[] sizes = argv.length > 3 ? new int[]{Integer.parseInt(argv[3])} : DEFAULT_SIZES;

        System.out.println("Connecting to " + host + ":" + port);

        for(int i = 0; i < sizes.length; i++)
        {
            new Client(host, port, sizes[i], count).waitForClose();
            Thread.sleep(1000);
        }
    }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Boost.Geometry (aka GGL, Generic Geometry Library)</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">

Main Page

Related Pages

Modules

Namespaces

Classes

Files

Examples

Class List

Class Index

Class Hierarchy

Class Members

boost

geometry

single_tag

boost::geometry::single_tag Struct Reference

For single-geometries (point, linestring, polygon, box, ring, segment)
 More...

Inheritance diagram for boost::geometry::single_tag:

  <map id="boost::geometry::single_tag_map" name="boost::geometry::single_tag_map">
<area href="structboost_1_1geometry_1_1box__tag.html" title="Convenience 2D or 3D box (mbr / aabb) identifying tag. " alt="boost::geometry::box_tag" shape="rect" coords="0,56,181,80"/>
<area href="structboost_1_1geometry_1_1linestring__tag.html" title="OGC Linestring identifying tag. " alt="boost::geometry::linestring_tag" shape="rect" coords="191,56,372,80"/>
<area href="structboost_1_1geometry_1_1point__tag.html" title="OGC Point identifying tag. " alt="boost::geometry::point_tag" shape="rect" coords="382,56,563,80"/>
<area href="structboost_1_1geometry_1_1polygon__tag.html" title="OGC Polygon identifying tag. " alt="boost::geometry::polygon_tag" shape="rect" coords="573,56,754,80"/>
<area href="structboost_1_1geometry_1_1ring__tag.html" title="Convenience (linear) ring identifying tag. " alt="boost::geometry::ring_tag" shape="rect" coords="764,56,945,80"/>
<area href="structboost_1_1geometry_1_1segment__tag.html" title="Convenience segment (2-points) identifying tag. " alt="boost::geometry::segment_tag" shape="rect" coords="955,56,1136,80"/>
</map>

Detailed Description

For single-geometries (point, linestring, polygon, box, ring, segment)

April 2, 2011

Copyright © 2007-2011 Barend Gehrels, Amsterdam, the Netherlands

Copyright © 2008-2011 Bruno Lalande, Paris, France

Copyright © 2009-2010 Mateusz Loskot, London, UK

<address style="text-align: right;">
Documentation is generated by Doxygen
</address>


text:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
		<encoder>
			<pattern>%d [%thread] %-5level %logger - %msg%n</pattern>
		</encoder>
	</appender>

	<appender name="CYCLIC" class="ch.qos.logback.core.read.CyclicBufferAppender">
		<MaxSize>512</MaxSize>
	</appender>

	<root level="info">
		<appender-ref ref="STDOUT" />
		<appender-ref ref="CYCLIC" />
	</root>
</configuration>


text:
#ifndef _CHROMATOGRAMLIST_SAVITZKYGOLAYSMOOTHER_HPP_CLI_
#define _CHROMATOGRAMLIST_SAVITZKYGOLAYSMOOTHER_HPP_CLI_

#include "pwiz/analysis/chromatogram_processing/ChromatogramList_SavitzkyGolaySmoother.hpp"
#include "pwiz/utility/misc/IntegerSet.hpp"

namespace pwiz {
namespace CLI {
namespace msdata {

/// ChromatogramList implementation to smooth intensities with SG method
public ref class ChromatogramList_SavitzkyGolaySmoother : public ChromatogramList
{
    internal: //ChromatogramList_NativeCentroider(pwiz::analysis::ChromatogramList_NativeCentroider* base)
              //: ChromatogramList((boost::shared_ptr<pwiz::msdata::ChromatogramList>*) base), base_(base) {}
              virtual ~ChromatogramList_SavitzkyGolaySmoother()
              {if (base_) delete base_; if (ChromatogramList::base_) delete ChromatogramList::base_;}
              pwiz::analysis::ChromatogramList_SavitzkyGolaySmoother* base_;

    public:

    ChromatogramList_SavitzkyGolaySmoother(ChromatogramList^ inner,
                                       System::Collections::Generic::IEnumerable<int>^ msLevelsToSmooth)
    : ChromatogramList(0)
    {
        pwiz::util::IntegerSet msLevelSet;
        for each(int i in msLevelsToSmooth)
            msLevelSet.insert(i);
        base_ = new pwiz::analysis::ChromatogramList_SavitzkyGolaySmoother(*inner->base_, msLevelSet);
        ChromatogramList::base_ = new boost::shared_ptr<pwiz::msdata::ChromatogramList>(base_);
    }

    static bool accept(msdata::ChromatogramList^ inner)
    {return pwiz::analysis::ChromatogramList_SavitzkyGolaySmoother::accept(*inner->base_);}
};

} // namespace analysis
} // namespace CLI
} // namespace pwiz

#endif // _CHROMATOGRAMLIST_SAVITZKYGOLAYSMOOTHER_HPP_CLI_


text:
package io.getlime.security.powerauth.app.nextstep;

import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

/**
 * Spring Boot servlet initializer.
 *
 * @author Petr Dvorak, petr@wultra.com
 */
public class ServletInitializer extends SpringBootServletInitializer {

    /**
     * Configure servlet initialization.
     * @param application Application.
     * @return Spring application builder.
     */
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(NextStepApplication.class);
    }

}


text:
import socket
import unittest

from mockito import when

import redis_server
from tests.unit.stubs import SocketStub

class TestRedisConnection(unittest.TestCase):
    SERVER_ADDRESS = ("127.0.0.1", 6379)

    def test_create_socket(self):
        socket_stub = SocketStub()
        when(socket).socket(socket.AF_INET, socket.SOCK_STREAM).thenReturn(socket_stub)
        result = redis_server.create_socket()
        self.assertEquals(socket_stub, result)

    def test_listen_to_port(self):
        socket_stub = SocketStub()
        redis_server.listen(socket_stub, self.SERVER_ADDRESS)
        self.assertTrue(socket_stub.bound)
        self.assertEquals(self.SERVER_ADDRESS, socket_stub.address)
        self.assertTrue(socket_stub.listening)

    def test_accept_connections(self):
        socket_stub = SocketStub()
        redis_server.accept(socket_stub)
        self.assertTrue(socket_stub.accepting)

    def test_data_receive(self):
        socket_stub = SocketStub()
        data = redis_server.receive_data(socket_stub)
        self.assertTrue(socket_stub.received)
        self.assertEquals(data, "data")

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


text:
usage() {
  program=$(basename $0)
  echo "Usage: $program stash"
  exit 1
}

# Make sure we're in a repository
git status >/dev/null 2>&1
if [ $? -ne 0 ]; then
    echo "Not in a git repository"
    exit 1
fi

# mydir=$(mktemp -dt "$0")
tempdir=/tmp/Stash$$.tmp
mkdir $tempdir

# Get the diff for the current index
git --no-pager diff > $tempdir/index.txt

# Get the diff for the specified stash (or latest stash)
git --no-pager stash show -p $1 >$tempdir/stash.txt

# diff the diffs
diff $tempdir/index.txt $tempdir/stash.txt
rm -rf $tempdir


text:
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {
  assert,
  assertExists,
  assertInstanceof,
} from '../../assert.js';
import * as expert from '../../expert.js';
import {DeviceOperator} from '../../mojo/device_operator.js';
import {CaptureIntent} from '../../mojo/type.js';
import * as state from '../../state.js';
import {
  Mode,
  Resolution,
} from '../../type.js';
import {StreamConstraints} from '../stream_constraints.js';

import {
  ModeBase,
  ModeFactory,
} from './mode_base.js';
import {
  PhotoFactory,
  PhotoHandler,
} from './photo.js';
import {PortraitFactory, PortraitHandler} from './portrait.js';
import {
  ScanFactory,
  ScanHandler,
} from './scan.js';
import {
  VideoFactory,
  VideoHandler,
} from './video.js';

export {PhotoHandler, PhotoResult} from './photo.js';
export {getDefaultScanCorners, ScanHandler} from './scan.js';
export {
  GifResult,
  setAvc1Parameters,
  Video,
  VideoHandler,
  VideoResult,
} from './video.js';

/**
 * Callback to trigger mode switching. Should return whether mode switching
 * succeed.
 */
export type DoSwitchMode = () => Promise<boolean>;

export type CaptureHandler =
    PhotoHandler&PortraitHandler&ScanHandler&VideoHandler;

/**
 * Parameters for capture settings.
 */
interface CaptureParams {
  mode: Mode;
  constraints: StreamConstraints;
  captureResolution: Resolution|null;
  videoSnapshotResolution: Resolution|null;
}

/**
 * The abstract interface for the mode configuration.
 */
interface ModeConfig {
  /**
   * @return Resolves to boolean indicating whether the mode is supported by
   *     video device with specified device id.
   */
  isSupported(deviceId: string|null): Promise<boolean>;

  isSupportPTZ(captureResolution: Resolution, previewResolution: Resolution):
      boolean;

  /**
   * Makes video capture device prepared for capturing in this mode.
   *
   * @param constraints Constraints for preview stream.
   */
  prepareDevice(constraints: StreamConstraints, captureResolution: Resolution):
      Promise<void>;

  /**
   * Gets factory to create capture object for this mode.
   */
  getCaptureFactory(): ModeFactory;

  /**
   * Mode to be fallbacked to when fail to configure this mode.
   */
  readonly fallbackMode: Mode;
}

/**
 * Mode controller managing capture sequence of different camera mode.
 */
export class Modes {
  /**
   * Capture controller of current camera mode.
   */
  current: ModeBase|null = null;

  /**
   * Parameters to create mode capture controller.
   */
  private captureParams: CaptureParams|null = null;

  /**
   * Mode classname and related functions and attributes.
   */
  private readonly allModes: {[mode in Mode]: ModeConfig};

  private handler: CaptureHandler|null = null;

  constructor() {
    // Workaround for b/184089334 on PTZ camera to use preview frame as photo
    // result.
    function checkSupportPTZForPhotoMode(
        captureResolution: Resolution, previewResolution: Resolution) {
      return captureResolution.equals(previewResolution);
    }

    /**
     * Prepare the device for the specific resolution and capture intent.
     */
    async function prepareDeviceForPhoto(
        constraints: StreamConstraints, resolution: Resolution,
        captureIntent: CaptureIntent): Promise<void> {
      const deviceOperator = DeviceOperator.getInstance();
      if (deviceOperator === null) {
        return;
      }
      const deviceId = constraints.deviceId;
      await deviceOperator.setCaptureIntent(deviceId, captureIntent);
      await deviceOperator.setStillCaptureResolution(deviceId, resolution);
    }

    this.allModes = {
      [Mode.VIDEO]: {
        getCaptureFactory: () => {
          const params = this.getCaptureParams();
          return new VideoFactory(
              params.constraints, params.captureResolution,
              params.videoSnapshotResolution, assertExists(this.handler));
        },
        isSupported: async () => true,
        isSupportPTZ: () => true,
        prepareDevice: async (constraints) => {
          const deviceOperator = DeviceOperator.getInstance();
          if (deviceOperator === null) {
            return;
          }
          const deviceId = constraints.deviceId;
          await deviceOperator.setCaptureIntent(
              deviceId, CaptureIntent.VIDEO_RECORD);
          await deviceOperator.setMultipleStreamsEnabled(
              deviceId,
              expert.isEnabled(
                  expert.ExpertOption.ENABLE_MULTISTREAM_RECORDING),
          );

          if (await deviceOperator.isBlobVideoSnapshotEnabled(deviceId)) {
            await deviceOperator.setStillCaptureResolution(
                deviceId,
                assertExists(this.getCaptureParams().videoSnapshotResolution));
          }

          let minFrameRate = 0;
          let maxFrameRate = 0;
          if (constraints.video?.frameRate) {
            const frameRate = constraints.video.frameRate;
            if (typeof frameRate === 'number') {
              minFrameRate = frameRate;
              maxFrameRate = frameRate;
            } else if (frameRate.exact) {
              minFrameRate = frameRate.exact;
              maxFrameRate = frameRate.exact;
            } else if (frameRate.min && frameRate.max) {
              minFrameRate = frameRate.min;
              maxFrameRate = frameRate.max;
            }
            // TODO(wtlee): To set the fps range to the default value, we should
            // remove the frameRate from constraints instead of using incomplete
            // range.
          }
          await deviceOperator.setFpsRange(
              deviceId, minFrameRate, maxFrameRate);
        },
        fallbackMode: Mode.PHOTO,
      },
      [Mode.PHOTO]: {
        getCaptureFactory: () => {
          const params = this.getCaptureParams();
          return new PhotoFactory(
              params.constraints, params.captureResolution,
              assertExists(this.handler));
        },
        isSupported: async () => true,
        isSupportPTZ: checkSupportPTZForPhotoMode,
        prepareDevice: async (constraints, resolution) => prepareDeviceForPhoto(
            constraints, resolution, CaptureIntent.STILL_CAPTURE),
        fallbackMode: Mode.SCAN,
      },
      [Mode.PORTRAIT]: {
        getCaptureFactory: () => {
          const params = this.getCaptureParams();
          return new PortraitFactory(
              params.constraints, params.captureResolution,
              assertExists(this.handler));
        },
        isSupported: async (deviceId) => {
          if (deviceId === null) {
            return false;
          }
          const deviceOperator = DeviceOperator.getInstance();
          if (deviceOperator === null) {
            return false;
          }
          return deviceOperator.isPortraitModeSupported(deviceId);
        },
        isSupportPTZ: checkSupportPTZForPhotoMode,
        prepareDevice: async (constraints, resolution) => prepareDeviceForPhoto(
            constraints, resolution, CaptureIntent.STILL_CAPTURE),
        fallbackMode: Mode.PHOTO,
      },
      [Mode.SCAN]: {
        getCaptureFactory: () => {
          const params = this.getCaptureParams();
          return new ScanFactory(
              params.constraints, params.captureResolution,
              assertExists(this.handler));
        },
        isSupported: async () => true,
        isSupportPTZ: checkSupportPTZForPhotoMode,
        prepareDevice: async (constraints, resolution) => prepareDeviceForPhoto(
            constraints, resolution, CaptureIntent.STILL_CAPTURE),
        fallbackMode: Mode.PHOTO,
      },
    };

    expert.addObserver(
        expert.ExpertOption.SAVE_METADATA, () => this.updateSaveMetadata());
  }

  initialize(handler: CaptureHandler): void {
    this.handler = handler;
  }

  private getCaptureParams(): CaptureParams {
    assert(this.captureParams !== null);
    return this.captureParams;
  }

  /**
   * Gets all mode candidates. Desired trying sequence of candidate modes is
   * reflected in the order of the returned array.
   */
  async getModeCandidates(deviceId: string|null, startingMode: Mode):
      Promise<Mode[]> {
    const tried = new Set<Mode>();
    const results: Mode[] = [];
    let mode = startingMode;
    while (!tried.has(mode)) {
      tried.add(mode);
      if (await this.isSupported(mode, deviceId)) {
        results.push(mode);
      }
      mode = this.allModes[mode].fallbackMode;
    }
    return results;
  }

  /**
   * Gets factory to create mode capture object.
   */
  getModeFactory(mode: Mode): ModeFactory {
    return this.allModes[mode].getCaptureFactory();
  }

  /**
   * @param mode Mode for the capture.
   * @param constraints Constraints for preview stream.
   * @param captureResolution Capture resolution. May be null on device not
   *     support of setting resolution.
   * @param videoSnapshotResolution Video snapshot resolution. May be null on
   *     device not support of setting resolution.
   */
  setCaptureParams(
      mode: Mode, constraints: StreamConstraints,
      captureResolution: Resolution|null,
      videoSnapshotResolution: Resolution|null): void {
    this.captureParams =
        {mode, constraints, captureResolution, videoSnapshotResolution};
  }

  /**
   * Makes video capture device prepared for capturing in this mode.
   */
  async prepareDevice(): Promise<void> {
    if (state.get(state.State.USE_FAKE_CAMERA)) {
      return;
    }
    const {mode, captureResolution, constraints} = this.getCaptureParams();
    return this.allModes[mode].prepareDevice(
        constraints, assertInstanceof(captureResolution, Resolution));
  }

  async isSupported(mode: Mode, deviceId: string|null): Promise<boolean> {
    return this.allModes[mode].isSupported(deviceId);
  }

  isSupportPTZ(
      mode: Mode, captureResolution: Resolution,
      previewResolution: Resolution): boolean {
    return this.allModes[mode].isSupportPTZ(
        captureResolution, previewResolution);
  }

  /**
   * Creates and updates current mode object.
   *
   * @param factory The factory ready for producing mode capture object.
   */
  async updateMode(factory: ModeFactory): Promise<void> {
    if (this.current !== null) {
      await this.current.clear();
      await this.disableSaveMetadata();
    }
    this.current = factory.produce();
    await this.updateSaveMetadata();
  }

  /**
   * Clears everything when mode is not needed anymore.
   */
  async clear(): Promise<void> {
    if (this.current !== null) {
      await this.current.clear();
      await this.disableSaveMetadata();
    }
    this.captureParams = null;
    this.current = null;
  }

  /**
   * Checks whether to save image metadata or not.
   *
   * @return Promise for the operation.
   */
  private async updateSaveMetadata(): Promise<void> {
    if (expert.isEnabled(expert.ExpertOption.SAVE_METADATA)) {
      await this.enableSaveMetadata();
    } else {
      await this.disableSaveMetadata();
    }
  }

  /**
   * Enables save metadata of subsequent photos in the current mode.
   *
   * @return Promise for the operation.
   */
  private async enableSaveMetadata(): Promise<void> {
    if (this.current !== null) {
      await this.current.addMetadataObserver();
    }
  }

  /**
   * Disables save metadata of subsequent photos in the current mode.
   *
   * @return Promise for the operation.
   */
  private async disableSaveMetadata(): Promise<void> {
    if (this.current !== null) {
      await this.current.removeMetadataObserver();
    }
  }
}


text:
<?php

namespace FlexCMS\BasicCMS\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Message extends Model
{
    use SoftDeletes;

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'messages';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['sender_name', 'sender_phone', 'sender_email',
    	'created_by', 'updated_by', 'status', 'is_read', 'is_seen'];

    protected $dates = ['deleted_at'];

    public static $rules = array(
        'sender_name'=>'required',
        'sender_phone'=>'required',
        'sender_email'=>'required'
    );

    public static function validate($data, $rules = null) {
        return Validator::make($data, $rules == null ? static::$rules : $rules);
    }
}


text:
srcdir=.

# Determine which filters are available
USE_FILTER_SZIP="no"
USE_FILTER_DEFLATE="yes"
USE_FILTER_SHUFFLE="yes"
USE_FILTER_FLETCHER32="yes"
USE_FILTER_NBIT="yes"
USE_FILTER_SCALEOFFSET="yes"

TESTNAME=h5dump
EXIT_SUCCESS=0
EXIT_FAILURE=1

DUMPER=h5dump                     # The tool name
DUMPER_BIN=`pwd`/$DUMPER          # The path of the tool binary

H5DIFF=../h5diff/h5diff           # The h5diff tool name
H5DIFF_BIN=`pwd`/$H5DIFF          # The path of the h5diff  tool binary

H5IMPORT=../h5import/h5import     # The h5import tool name
H5IMPORT_BIN=`pwd`/$H5IMPORT      # The path of the h5import  tool binary

RM='rm -rf'
CMP='cmp -s'
DIFF='diff -c'
CP='cp'
DIRNAME='dirname'
LS='ls'
AWK='awk'

nerrors=0
verbose=yes

# source dirs
SRC_TOOLS="$srcdir/../"

SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles"
# testfiles source dirs for tools
SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES"
SRC_H5DUMP_TESTFILES="$SRC_TOOLS_TESTFILES"
SRC_H5DUMP_ERRORFILES="$srcdir/errfiles"
SRC_H5DIFF_TESTFILES="$SRC_TOOLS/h5diff/testfiles"
SRC_H5COPY_TESTFILES="$SRC_TOOLS/h5copy/testfiles"
SRC_H5REPACK_TESTFILES="$SRC_TOOLS/h5repack/testfiles"
SRC_H5JAM_TESTFILES="$SRC_TOOLS/h5jam/testfiles"
SRC_H5STAT_TESTFILES="$SRC_TOOLS/h5stat/testfiles"
SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/h5import/testfiles"

TEST_P_DIR=./testfiles
TESTDIR=./testfiles/pbits
test -d $TEST_P_DIR || mkdir -p $TEST_P_DIR
test -d $TESTDIR || mkdir -p $TESTDIR

######################################################################
# test files
# --------------------------------------------------------------------
# All the test files copy from source directory to test directory
# NOTE: Keep this framework to add/remove test files.
#       Any test files from other tools can be used in this framework.
#       This list are also used for checking exist.
#       Comment '#' without space can be used.
# --------------------------------------------------------------------
LIST_HDF5_TEST_FILES="
$SRC_H5DUMP_TESTFILES/packedbits.h5
$SRC_H5DUMP_TESTFILES/tarray1.h5
$SRC_H5DUMP_TESTFILES/tcompound.h5
"

LIST_OTHER_TEST_FILES="
$SRC_H5DUMP_TESTFILES/tnofilename-with-packed-bits.ddl
$SRC_H5DUMP_TESTFILES/tpbitsArray.ddl
$SRC_H5DUMP_TESTFILES/tpbitsCompound.ddl
$SRC_H5DUMP_TESTFILES/tpbitsIncomplete.ddl
$SRC_H5DUMP_TESTFILES/tpbitsLengthExceeded.ddl
$SRC_H5DUMP_TESTFILES/tpbitsCharLengthExceeded.ddl
$SRC_H5DUMP_TESTFILES/tpbitsIntLengthExceeded.ddl
$SRC_H5DUMP_TESTFILES/tpbitsLongLengthExceeded.ddl
$SRC_H5DUMP_TESTFILES/tpbitsLengthPositive.ddl
$SRC_H5DUMP_TESTFILES/tpbitsMax.ddl
$SRC_H5DUMP_TESTFILES/tpbitsMaxExceeded.ddl
$SRC_H5DUMP_TESTFILES/tpbitsOffsetExceeded.ddl
$SRC_H5DUMP_TESTFILES/tpbitsCharOffsetExceeded.ddl
$SRC_H5DUMP_TESTFILES/tpbitsIntOffsetExceeded.ddl
$SRC_H5DUMP_TESTFILES/tpbitsLongOffsetExceeded.ddl
$SRC_H5DUMP_TESTFILES/tpbitsOffsetNegative.ddl
$SRC_H5DUMP_TESTFILES/tpbitsOverlapped.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSigned.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsigned.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedInt.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedLong.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedWhole.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedWhole.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedIntWhole.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedIntWhole.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedLongWhole.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongWhole.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole1.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole1.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole63.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole63.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSigned4.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsigned4.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedInt8.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt8.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedLong16.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong16.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong32.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong32.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSigned2.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsigned2.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedInt4.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt4.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedLong8.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong8.ddl
$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong16.ddl
$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong16.ddl
"

LIST_ERROR_TEST_FILES="
${SRC_H5DUMP_ERRORFILES}/tnofilename-with-packed-bits.err
${SRC_H5DUMP_ERRORFILES}/tpbitsCharLengthExceeded.err
${SRC_H5DUMP_ERRORFILES}/tpbitsCharOffsetExceeded.err
${SRC_H5DUMP_ERRORFILES}/tpbitsIncomplete.err
${SRC_H5DUMP_ERRORFILES}/tpbitsIntLengthExceeded.err
${SRC_H5DUMP_ERRORFILES}/tpbitsIntOffsetExceeded.err
${SRC_H5DUMP_ERRORFILES}/tpbitsLengthExceeded.err
${SRC_H5DUMP_ERRORFILES}/tpbitsLengthPositive.err
${SRC_H5DUMP_ERRORFILES}/tpbitsLongLengthExceeded.err
${SRC_H5DUMP_ERRORFILES}/tpbitsLongOffsetExceeded.err
${SRC_H5DUMP_ERRORFILES}/tpbitsMaxExceeded.err
${SRC_H5DUMP_ERRORFILES}/tpbitsOffsetExceeded.err
${SRC_H5DUMP_ERRORFILES}/tpbitsOffsetNegative.err
"

#
# copy test files and expected output files from source dirs to test dir
#
COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES $LIST_ERROR_TEST_FILES"

COPY_TESTFILES_TO_TESTDIR()
{
    # copy test files. Used -f to make sure get a new copy
    for tstfile in $COPY_TESTFILES
    do
        # ignore '#' comment
        echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
        RET=$?
        if [ $RET -eq 1 ]; then
            # skip cp if srcdir is same as destdir
            # this occurs when build/test performed in source dir and
            # make cp fail
            SDIR=`$DIRNAME $tstfile`
            INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
            INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
            if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
    	        $CP -f $tstfile $TESTDIR
                if [ $? -ne 0 ]; then
                    echo "Error: FAILED to copy $tstfile ."

                    # Comment out this to CREATE expected file
                    exit $EXIT_FAILURE
                fi
            fi
        fi
    done
}

CLEAN_TESTFILES_AND_TESTDIR()
{
    # skip rm if srcdir is same as destdir
    # this occurs when build/test performed in source dir and
    # make cp fail
    SDIR=`$DIRNAME $tstfile`
    INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
    INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
    if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
        $RM $TESTDIR
    fi
}

# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Testing".
#
TESTING() {
   SPACES="                                                               "
   echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
}

# Source in the output filter function definitions.
. $srcdir/../../bin/output_filter.sh

# Run a test and print PASS or *FAIL*.  If a test fails then increment
# the `nerrors' global variable and (if $verbose is set) display the
# difference between the actual output and the expected output. The
# expected output is given as the first argument to this function and
# the actual output file is calculated by replacing the `.ddl' with
# `.out'.  The actual output is not removed if $HDF5_NOCLEANUP has a
# non-zero value.
#
TOOLTEST() {
    expect="$TESTDIR/$1"
    actual="$TESTDIR/`basename $1 .ddl`.out"
    actual_err="$TESTDIR/`basename $1 .ddl`.err"
    actual_sav=${actual}-sav
    actual_err_sav=${actual_err}-sav
    shift

    # Run test.
    TESTING $DUMPER $@
    (
    cd $TESTDIR
      $RUNSERIAL $DUMPER_BIN "$@"
    ) >$actual 2>$actual_err

    # save actual and actual_err in case they are needed later.
    cp $actual $actual_sav
    STDOUT_FILTER $actual
    cp $actual_err $actual_err_sav
    STDERR_FILTER $actual_err
    cat $actual_err >> $actual

  if [ ! -f $expect ]; then
    # Create the expect file if it doesn't yet exist.
     echo " CREATED"
     cp $actual $expect
    elif $CMP $expect $actual; then
     echo " PASSED"
    else
     echo "*FAILED*"
     echo "    Expected result (*.ddl) differs from actual result (*.out)"
   nerrors="`expr $nerrors + 1`"
   test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/    /'
    fi

    # Clean up output file
    if test -z "$HDF5_NOCLEANUP"; then
   rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext
    fi

}

# same as TOOLTEST1 but compares generated file to expected output
#                   and compares the generated data file to the expected data file
# used for the binary tests that expect a full path in -o without -b
TOOLTEST2() {

    expectdata="$TESTDIR/$1"
    expect="$TESTDIR/`basename $1 .exp`.ddl"
    actualdata="$TESTDIR/`basename $1 .exp`.txt"
    actual="$TESTDIR/`basename $1 .exp`.out"
    actual_err="$TESTDIR/`basename $1 .exp`.err"
    shift

    # Run test.
    TESTING $DUMPER $@
    (
      cd $TESTDIR
      $RUNSERIAL $DUMPER_BIN "$@"
    ) >$actual 2>$actual_err
    cat $actual_err >> $actual

    if [ ! -f $expect ]; then
    # Create the expect file if it doesn't yet exist.
     echo " CREATED"
     cp $actual $expect
    elif $CMP $expect $actual; then
      if [ ! -f $expectdata ]; then
      # Create the expect data file if it doesn't yet exist.
        echo " CREATED"
        cp $actualdata $expectdata
      elif $CMP $expectdata $actualdata; then
        echo " PASSED"
      else
        echo "*FAILED*"
        echo "    Expected datafile (*.exp) differs from actual datafile (*.txt)"
        nerrors="`expr $nerrors + 1`"
        test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/    /'
      fi
    else
     echo "*FAILED*"
     echo "    Expected result (*.ddl) differs from actual result (*.out)"
     nerrors="`expr $nerrors + 1`"
     test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/    /'
    fi

    # Clean up output file
    if test -z "$HDF5_NOCLEANUP"; then
     rm -f $actual $actualdata $actual_err
    fi

}

# same as TOOLTEST but filters error stack outp
# Extract file name, line number, version and thread IDs because they may be different
TOOLTEST3() {

    expect="$TESTDIR/$1"
    actual="$TESTDIR/`basename $1 .ddl`.out"
    actual_err="$TESTDIR/`basename $1 .ddl`.err"
    actual_ext="$TESTDIR/`basename $1 .ddl`.ext"
    actual_sav=${actual}-sav
    actual_err_sav=${actual_err}-sav
    shift

    # Run test.
    TESTING $DUMPER $@
    (
      cd $TESTDIR
      $RUNSERIAL $DUMPER_BIN "$@"
    ) >$actual 2>$actual_err

    # save actual and actual_err in case they are needed later.
    cp $actual $actual_sav
    STDOUT_FILTER $actual
    cp $actual_err $actual_err_sav
    STDERR_FILTER $actual_err

    # Extract file name, line number, version and thread IDs because they may be different
    sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
        -e 's/line [0-9]*/line (number)/' \
        -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
        -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
        -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
        -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
     $actual_err > $actual_ext
    cat $actual_ext >> $actual

    if [ ! -f $expect ]; then
    # Create the expect file if it doesn't yet exist.
     echo " CREATED"
     cp $actual $expect
    elif $CMP $expect $actual; then
     echo " PASSED"
    else
     echo "*FAILED*"
     echo "    Expected result (*.ddl) differs from actual result (*.out)"
     nerrors="`expr $nerrors + 1`"
     test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/    /'
    fi

    # Clean up output file
    if test -z "$HDF5_NOCLEANUP"; then
   rm -f $actual $actual_err $actual_sav $actual_err_sav
    fi

}

# same as TOOLTEST3 but filters error stack output and compares to an error file
# Extract file name, line number, version and thread IDs because they may be different
TOOLTEST4() {

    expect="$TESTDIR/$1"
    expect_err="$TESTDIR/`basename $1 .ddl`.err"
    actual="$TESTDIR/`basename $1 .ddl`.out"
    actual_err="$TESTDIR/`basename $1 .ddl`.oerr"
    actual_ext="$TESTDIR/`basename $1 .ddl`.ext"
    actual_sav=${actual}-sav
    actual_err_sav=${actual_err}-sav
    shift

    # Run test.
    TESTING $DUMPER $@
    (
      cd $TESTDIR
      $RUNSERIAL $DUMPER_BIN "$@"
    ) >$actual 2>$actual_err

    # save actual and actual_err in case they are needed later.
    cp $actual $actual_sav
    STDOUT_FILTER $actual
    cp $actual_err $actual_err_sav
    STDERR_FILTER $actual_err

    # Extract file name, line number, version and thread IDs because they may be different
    sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
        -e 's/line [0-9]*/line (number)/' \
        -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
        -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
        -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
        -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
     $actual_err > $actual_ext
    #cat $actual_ext >> $actual

    if [ ! -f $expect ]; then
    # Create the expect file if it doesn't yet exist.
     echo " CREATED"
     cp $actual $expect
    elif $CMP $expect $actual; then
     if $CMP $expect_err $actual_ext; then
      echo " PASSED"
    else
     echo "*FAILED*"
     echo "    Expected result (*.err) differs from actual result (*.oerr)"
     nerrors="`expr $nerrors + 1`"
     test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/    /'
    fi
    else
     echo "*FAILED*"
     echo "    Expected result (*.ddl) differs from actual result (*.out)"
     nerrors="`expr $nerrors + 1`"
     test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/    /'
    fi

    # Clean up output file
    if test -z "$HDF5_NOCLEANUP"; then
   rm -f $actual $actual_err $actual_sav $actual_err_sav
    fi

}

# Print a "SKIP" message
SKIP() {
   TESTING $DUMPER $@
    echo  " -SKIP-"
}

# Print a line-line message left justified in a field of 70 characters
#
PRINT_H5DIFF() {
 SPACES="                                                               "
 echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012'
}

# Call the h5diff tool
#
DIFFTEST()
{
    PRINT_H5DIFF  $@
    (
  cd $TESTDIR
  $RUNSERIAL $H5DIFF_BIN "$@" -q
    )
    RET=$?
    if [ $RET != 0 ] ; then
         echo "*FAILED*"
         nerrors="`expr $nerrors + 1`"
    else
         echo " PASSED"
    fi

}

# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Verifying".
#
PRINT_H5IMPORT() {
 SPACES="                                                               "
 echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012'
}

# Call the h5import tool
#
IMPORTTEST()
{
    # remove the output hdf5 file if it exists
    hdf5_file="$TESTDIR/$5"
    if [ -f $hdf5_file ]; then
     rm -f $hdf5_file
    fi

    PRINT_H5IMPORT  $@
    (
  cd $TESTDIR
  $RUNSERIAL $H5IMPORT_BIN "$@"
    )
    RET=$?
    if [ $RET != 0 ] ; then
         echo "*FAILED*"
         nerrors="`expr $nerrors + 1`"
    else
         echo " PASSED"
    fi

}

##############################################################################
##############################################################################
###        T H E   T E S T S                                            ###
##############################################################################
##############################################################################
# prepare for test
COPY_TESTFILES_TO_TESTDIR

####### test for dataset packed bits ######

# test failure handling
# Missing file name
TOOLTEST tnofilename-with-packed-bits.ddl --enable-error-stack
# Limits:
# Maximum number of packed bits is 8 (for now).
# Maximum integer size is 64 (for now).
# Maximun Offset is 63 (Maximum size - 1).
# Maximum Offset+Length is 64 (Maximum size).
# Tests:
# Normal operation on both signed and unsigned int datasets.
# Sanity check
# Their rawdata output should be the same.
TOOLTEST tpbitsSignedWhole.ddl --enable-error-stack -d /DS08BITS -M 0,8 packedbits.h5
TOOLTEST tpbitsUnsignedWhole.ddl --enable-error-stack -d /DU08BITS -M 0,8 packedbits.h5
TOOLTEST tpbitsSignedIntWhole.ddl --enable-error-stack -d /DS16BITS -M 0,16 packedbits.h5
TOOLTEST tpbitsUnsignedIntWhole.ddl --enable-error-stack -d /DU16BITS -M 0,16 packedbits.h5
TOOLTEST tpbitsSignedLongWhole.ddl --enable-error-stack -d /DS32BITS -M 0,32 packedbits.h5
TOOLTEST tpbitsUnsignedLongWhole.ddl --enable-error-stack -d /DU32BITS -M 0,32 packedbits.h5
TOOLTEST tpbitsSignedLongLongWhole.ddl --enable-error-stack -d /DS64BITS -M 0,64 packedbits.h5
TOOLTEST tpbitsUnsignedLongLongWhole.ddl --enable-error-stack -d /DU64BITS -M 0,64 packedbits.h5
TOOLTEST tpbitsSignedLongLongWhole63.ddl --enable-error-stack -d /DS64BITS -M 0,63 packedbits.h5
TOOLTEST tpbitsUnsignedLongLongWhole63.ddl --enable-error-stack -d /DU64BITS -M 0,63 packedbits.h5
TOOLTEST tpbitsSignedLongLongWhole1.ddl --enable-error-stack -d /DS64BITS -M 1,63 packedbits.h5
TOOLTEST tpbitsUnsignedLongLongWhole1.ddl --enable-error-stack -d /DU64BITS -M 1,63 packedbits.h5
# Half sections
TOOLTEST tpbitsSigned4.ddl --enable-error-stack -d /DS08BITS -M 0,4,4,4 packedbits.h5
TOOLTEST tpbitsUnsigned4.ddl --enable-error-stack -d /DU08BITS -M 0,4,4,4 packedbits.h5
TOOLTEST tpbitsSignedInt8.ddl --enable-error-stack -d /DS16BITS -M 0,8,8,8 packedbits.h5
TOOLTEST tpbitsUnsignedInt8.ddl --enable-error-stack -d /DU16BITS -M 0,8,8,8 packedbits.h5
TOOLTEST tpbitsSignedLong16.ddl --enable-error-stack -d /DS32BITS -M 0,16,16,16 packedbits.h5
TOOLTEST tpbitsUnsignedLong16.ddl --enable-error-stack -d /DU32BITS -M 0,16,16,16 packedbits.h5
TOOLTEST tpbitsSignedLongLong32.ddl --enable-error-stack -d /DS64BITS -M 0,32,32,32 packedbits.h5
TOOLTEST tpbitsUnsignedLongLong32.ddl --enable-error-stack -d /DU64BITS -M 0,32,32,32 packedbits.h5
# Quarter sections
TOOLTEST tpbitsSigned2.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5
TOOLTEST tpbitsUnsigned2.ddl --enable-error-stack -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5
TOOLTEST tpbitsSignedInt4.ddl --enable-error-stack -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5
TOOLTEST tpbitsUnsignedInt4.ddl --enable-error-stack -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5
TOOLTEST tpbitsSignedLong8.ddl --enable-error-stack -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5
TOOLTEST tpbitsUnsignedLong8.ddl --enable-error-stack -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5
TOOLTEST tpbitsSignedLongLong16.ddl --enable-error-stack -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5
TOOLTEST tpbitsUnsignedLongLong16.ddl --enable-error-stack -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5
# Begin and End
TOOLTEST tpbitsSigned.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,6 packedbits.h5
TOOLTEST tpbitsUnsigned.ddl --enable-error-stack -d /DU08BITS -M 0,2,2,6 packedbits.h5
TOOLTEST tpbitsSignedInt.ddl --enable-error-stack -d /DS16BITS -M 0,2,10,6 packedbits.h5
TOOLTEST tpbitsUnsignedInt.ddl --enable-error-stack -d /DU16BITS -M 0,2,10,6 packedbits.h5
TOOLTEST tpbitsSignedLong.ddl --enable-error-stack -d /DS32BITS -M 0,2,26,6 packedbits.h5
TOOLTEST tpbitsUnsignedLong.ddl --enable-error-stack -d /DU32BITS -M 0,2,26,6 packedbits.h5
TOOLTEST tpbitsSignedLongLong.ddl --enable-error-stack -d /DS64BITS -M 0,2,58,6 packedbits.h5
TOOLTEST tpbitsUnsignedLongLong.ddl --enable-error-stack -d /DU64BITS -M 0,2,58,6 packedbits.h5
# Overlapped packed bits.
TOOLTEST tpbitsOverlapped.ddl --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5
# Maximum number of packed bits.
TOOLTEST tpbitsMax.ddl --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5
# Compound type.
TOOLTEST tpbitsCompound.ddl --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5
# Array type.
TOOLTEST tpbitsArray.ddl --enable-error-stack -d /Dataset1 -M 0,1,1,1 tarray1.h5
# Test Error handling.
# Too many packed bits requested. Max is 8 for now.
TOOLTEST tpbitsMaxExceeded.ddl --enable-error-stack -d /DS08BITS -M 0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5
# Offset too large. Max is 7 (8-1) for now.
TOOLTEST tpbitsOffsetExceeded.ddl --enable-error-stack -d /DS08BITS -M 64,1 packedbits.h5
TOOLTEST tpbitsCharOffsetExceeded.ddl --enable-error-stack -d /DS08BITS -M 8,1 packedbits.h5
TOOLTEST tpbitsIntOffsetExceeded.ddl --enable-error-stack -d /DS16BITS -M 16,1 packedbits.h5
TOOLTEST tpbitsLongOffsetExceeded.ddl --enable-error-stack -d /DS32BITS -M 32,1 packedbits.h5
# Bad offset, must not be negative.
TOOLTEST tpbitsOffsetNegative.ddl --enable-error-stack -d /DS08BITS -M -1,1 packedbits.h5
# Bad length, must not be positive.
TOOLTEST tpbitsLengthPositive.ddl --enable-error-stack -d /DS08BITS -M 4,0 packedbits.h5
# Offset+Length is too large. Max is 8 for now.
TOOLTEST tpbitsLengthExceeded.ddl --enable-error-stack -d /DS08BITS -M 37,28 packedbits.h5
TOOLTEST tpbitsCharLengthExceeded.ddl --enable-error-stack -d /DS08BITS -M 2,7 packedbits.h5
TOOLTEST tpbitsIntLengthExceeded.ddl --enable-error-stack -d /DS16BITS -M 10,7 packedbits.h5
TOOLTEST tpbitsLongLengthExceeded.ddl --enable-error-stack -d /DS32BITS -M 26,7 packedbits.h5
# Incomplete pair of packed bits request.
TOOLTEST tpbitsIncomplete.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5

# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR

# Report test results and exit
if test $nerrors -eq 0 ; then
    echo "All $TESTNAME tests passed."
    exit $EXIT_SUCCESS
else
    echo "$TESTNAME tests failed with $nerrors errors."
    exit $EXIT_FAILURE
fi


text:
import unittest
import sys
from test.test_support import check_py3k_warnings, CleanImport, run_unittest
import warnings

if not sys.py3kwarning:
    raise unittest.SkipTest('%s must be run with the -3 flag' % __name__)

try:
    from test.test_support import __warningregistry__ as _registry
except ImportError:
    def check_deprecated_module(module_name):
        return False
else:
    past_warnings = _registry.keys()
    del _registry
    def check_deprecated_module(module_name):
        """Lookup the past warnings for module already loaded using
        test_support.import_module(..., deprecated=True)
        """
        return any(module_name in msg and ' removed' in msg
                   and issubclass(cls, DeprecationWarning)
                   and (' module' in msg or ' package' in msg)
                   for (msg, cls, line) in past_warnings)

def reset_module_registry(module):
    try:
        registry = module.__warningregistry__
    except AttributeError:
        pass
    else:
        registry.clear()

class TestPy3KWarnings(unittest.TestCase):

    def assertWarning(self, _, warning, expected_message):
        self.assertEqual(str(warning.message), expected_message)

    def assertNoWarning(self, _, recorder):
        self.assertEqual(len(recorder.warnings), 0)

    def test_backquote(self):
        expected = 'backquote not supported in 3.x; use repr()'
        with check_py3k_warnings((expected, SyntaxWarning)):
            exec "`2`" in {}

    def test_paren_arg_names(self):
        expected = 'parenthesized argument names are invalid in 3.x'
        def check(s):
            with check_py3k_warnings((expected, SyntaxWarning)):
                exec s in {}
        check("def f((x)): pass")
        check("def f((((x))), (y)): pass")
        check("def f((x), (((y))), m=32): pass")
        # Something like def f((a, (b))): pass will raise the tuple
        # unpacking warning.

    def test_forbidden_names(self):
        # So we don't screw up our globals
        def safe_exec(expr):
            def f(**kwargs): pass
            exec expr in {'f' : f}

        tests = [("True", "assignment to True or False is forbidden in 3.x"),
                 ("False", "assignment to True or False is forbidden in 3.x"),
                 ("nonlocal", "nonlocal is a keyword in 3.x")]
        with check_py3k_warnings(('', SyntaxWarning)) as w:
            for keyword, expected in tests:
                safe_exec("{0} = False".format(keyword))
                self.assertWarning(None, w, expected)
                w.reset()
                try:
                    safe_exec("obj.{0} = True".format(keyword))
                except NameError:
                    pass
                self.assertWarning(None, w, expected)
                w.reset()
                safe_exec("def {0}(): pass".format(keyword))
                self.assertWarning(None, w, expected)
                w.reset()
                safe_exec("class {0}: pass".format(keyword))
                self.assertWarning(None, w, expected)
                w.reset()
                safe_exec("def f({0}=43): pass".format(keyword))
                self.assertWarning(None, w, expected)
                w.reset()

    def test_type_inequality_comparisons(self):
        expected = 'type inequality comparisons not supported in 3.x'
        with check_py3k_warnings() as w:
            self.assertWarning(int < str, w, expected)
            w.reset()
            self.assertWarning(type < object, w, expected)

    def test_object_inequality_comparisons(self):
        expected = 'comparing unequal types not supported in 3.x'
        with check_py3k_warnings() as w:
            self.assertWarning(str < [], w, expected)
            w.reset()
            self.assertWarning(object() < (1, 2), w, expected)

    def test_dict_inequality_comparisons(self):
        expected = 'dict inequality comparisons not supported in 3.x'
        with check_py3k_warnings() as w:
            self.assertWarning({} < {2:3}, w, expected)
            w.reset()
            self.assertWarning({} <= {}, w, expected)
            w.reset()
            self.assertWarning({} > {2:3}, w, expected)
            w.reset()
            self.assertWarning({2:3} >= {}, w, expected)

    def test_cell_inequality_comparisons(self):
        expected = 'cell comparisons not supported in 3.x'
        def f(x):
            def g():
                return x
            return g
        cell0, = f(0).func_closure
        cell1, = f(1).func_closure
        with check_py3k_warnings() as w:
            self.assertWarning(cell0 == cell1, w, expected)
            w.reset()
            self.assertWarning(cell0 < cell1, w, expected)

    def test_code_inequality_comparisons(self):
        expected = 'code inequality comparisons not supported in 3.x'
        def f(x):
            pass
        def g(x):
            pass
        with check_py3k_warnings() as w:
            self.assertWarning(f.func_code < g.func_code, w, expected)
            w.reset()
            self.assertWarning(f.func_code <= g.func_code, w, expected)
            w.reset()
            self.assertWarning(f.func_code >= g.func_code, w, expected)
            w.reset()
            self.assertWarning(f.func_code > g.func_code, w, expected)

    def test_builtin_function_or_method_comparisons(self):
        expected = ('builtin_function_or_method '
                    'order comparisons not supported in 3.x')
        func = eval
        meth = {}.get
        with check_py3k_warnings() as w:
            self.assertWarning(func < meth, w, expected)
            w.reset()
            self.assertWarning(func > meth, w, expected)
            w.reset()
            self.assertWarning(meth <= func, w, expected)
            w.reset()
            self.assertWarning(meth >= func, w, expected)
            w.reset()
            self.assertNoWarning(meth == func, w)
            self.assertNoWarning(meth != func, w)
            lam = lambda x: x
            self.assertNoWarning(lam == func, w)
            self.assertNoWarning(lam != func, w)

    def test_frame_attributes(self):
        template = "%s has been removed in 3.x"
        f = sys._getframe(0)
        for attr in ("f_exc_traceback", "f_exc_value", "f_exc_type"):
            expected = template % attr
            with check_py3k_warnings() as w:
                self.assertWarning(getattr(f, attr), w, expected)
                w.reset()
                self.assertWarning(setattr(f, attr, None), w, expected)

    def test_sort_cmp_arg(self):
        expected = "the cmp argument is not supported in 3.x"
        lst = range(5)
        cmp = lambda x,y: -1

        with check_py3k_warnings() as w:
            self.assertWarning(lst.sort(cmp=cmp), w, expected)
            w.reset()
            self.assertWarning(sorted(lst, cmp=cmp), w, expected)
            w.reset()
            self.assertWarning(lst.sort(cmp), w, expected)
            w.reset()
            self.assertWarning(sorted(lst, cmp), w, expected)

    def test_sys_exc_clear(self):
        expected = 'sys.exc_clear() not supported in 3.x; use except clauses'
        with check_py3k_warnings() as w:
            self.assertWarning(sys.exc_clear(), w, expected)

    def test_methods_members(self):
        expected = '__members__ and __methods__ not supported in 3.x'
        class C:
            __methods__ = ['a']
            __members__ = ['b']
        c = C()
        with check_py3k_warnings() as w:
            self.assertWarning(dir(c), w, expected)

    def test_softspace(self):
        expected = 'file.softspace not supported in 3.x'
        with file(__file__) as f:
            with check_py3k_warnings() as w:
                self.assertWarning(f.softspace, w, expected)
            def set():
                f.softspace = 0
            with check_py3k_warnings() as w:
                self.assertWarning(set(), w, expected)

    def test_slice_methods(self):
        class Spam(object):
            def __getslice__(self, i, j): pass
            def __setslice__(self, i, j, what): pass
            def __delslice__(self, i, j): pass
        class Egg:
            def __getslice__(self, i, h): pass
            def __setslice__(self, i, j, what): pass
            def __delslice__(self, i, j): pass

        expected = "in 3.x, __{0}slice__ has been removed; use __{0}item__"

        for obj in (Spam(), Egg()):
            with check_py3k_warnings() as w:
                self.assertWarning(obj[1:2], w, expected.format('get'))
                w.reset()
                del obj[3:4]
                self.assertWarning(None, w, expected.format('del'))
                w.reset()
                obj[4:5] = "eggs"
                self.assertWarning(None, w, expected.format('set'))

    def test_tuple_parameter_unpacking(self):
        expected = "tuple parameter unpacking has been removed in 3.x"
        with check_py3k_warnings((expected, SyntaxWarning)):
            exec "def f((a, b)): pass"

    def test_buffer(self):
        expected = 'buffer() not supported in 3.x'
        with check_py3k_warnings() as w:
            self.assertWarning(buffer('a'), w, expected)

    def test_file_xreadlines(self):
        expected = ("f.xreadlines() not supported in 3.x, "
                    "try 'for line in f' instead")
        with file(__file__) as f:
            with check_py3k_warnings() as w:
                self.assertWarning(f.xreadlines(), w, expected)

    def test_hash_inheritance(self):
        with check_py3k_warnings() as w:
            # With object as the base class
            class WarnOnlyCmp(object):
                def __cmp__(self, other): pass
            self.assertEqual(len(w.warnings), 0)
            w.reset()
            class WarnOnlyEq(object):
                def __eq__(self, other): pass
            self.assertEqual(len(w.warnings), 1)
            self.assertWarning(None, w,
                 "Overriding __eq__ blocks inheritance of __hash__ in 3.x")
            w.reset()
            class WarnCmpAndEq(object):
                def __cmp__(self, other): pass
                def __eq__(self, other): pass
            self.assertEqual(len(w.warnings), 1)
            self.assertWarning(None, w,
                 "Overriding __eq__ blocks inheritance of __hash__ in 3.x")
            w.reset()
            class NoWarningOnlyHash(object):
                def __hash__(self): pass
            self.assertEqual(len(w.warnings), 0)
            # With an intermediate class in the heirarchy
            class DefinesAllThree(object):
                def __cmp__(self, other): pass
                def __eq__(self, other): pass
                def __hash__(self): pass
            class WarnOnlyCmp(DefinesAllThree):
                def __cmp__(self, other): pass
            self.assertEqual(len(w.warnings), 0)
            w.reset()
            class WarnOnlyEq(DefinesAllThree):
                def __eq__(self, other): pass
            self.assertEqual(len(w.warnings), 1)
            self.assertWarning(None, w,
                 "Overriding __eq__ blocks inheritance of __hash__ in 3.x")
            w.reset()
            class WarnCmpAndEq(DefinesAllThree):
                def __cmp__(self, other): pass
                def __eq__(self, other): pass
            self.assertEqual(len(w.warnings), 1)
            self.assertWarning(None, w,
                 "Overriding __eq__ blocks inheritance of __hash__ in 3.x")
            w.reset()
            class NoWarningOnlyHash(DefinesAllThree):
                def __hash__(self): pass
            self.assertEqual(len(w.warnings), 0)

    def test_operator(self):
        from operator import isCallable, sequenceIncludes

        callable_warn = ("operator.isCallable() is not supported in 3.x. "
                         "Use hasattr(obj, '__call__').")
        seq_warn = ("operator.sequenceIncludes() is not supported "
                    "in 3.x. Use operator.contains().")
        with check_py3k_warnings() as w:
            self.assertWarning(isCallable(self), w, callable_warn)
            w.reset()
            self.assertWarning(sequenceIncludes(range(3), 2), w, seq_warn)

    def test_nonascii_bytes_literals(self):
        expected = "non-ascii bytes literals not supported in 3.x"
        with check_py3k_warnings((expected, SyntaxWarning)):
            exec "b'\xbd'"

class TestStdlibRemovals(unittest.TestCase):

    # test.testall not tested as it executes all unit tests as an
    # import side-effect.
    all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new', 'rexec',
                        'Bastion', 'compiler', 'dircache', 'mimetools',
                        'fpformat', 'ihooks', 'mhlib', 'statvfs', 'htmllib',
                        'sgmllib', 'rfc822', 'sunaudio')
    inclusive_platforms = {'irix' : ('pure', 'AL', 'al', 'CD', 'cd', 'cddb',
                                     'cdplayer', 'CL', 'cl', 'DEVICE', 'GL',
                                     'gl', 'ERRNO', 'FILE', 'FL', 'flp', 'fl',
                                     'fm', 'GET', 'GLWS', 'imgfile', 'IN',
                                     'IOCTL', 'jpeg', 'panel', 'panelparser',
                                     'readcd', 'SV', 'torgb', 'WAIT'),
                          'darwin' : ('autoGIL', 'Carbon', 'OSATerminology',
                                      'icglue', 'Nav',
                                      # MacOS should (and does) give a Py3kWarning, but one of the
                                      # earlier tests already imports the MacOS extension which causes
                                      # this test to fail. Disabling the test for 'MacOS' avoids this
                                      # spurious test failure.
                                      #'MacOS',
                                      'aepack',
                                      'aetools', 'aetypes', 'applesingle',
                                      'appletrawmain', 'appletrunner',
                                      'argvemulator', 'bgenlocations',
                                      'EasyDialogs', 'macerrors', 'macostools',
                                      'findertools', 'FrameWork', 'ic',
                                      'gensuitemodule', 'icopen', 'macresource',
                                      'MiniAEFrame', 'pimp', 'PixMapWrapper',
                                      'terminalcommand', 'videoreader',
                                      '_builtinSuites', 'CodeWarrior',
                                      'Explorer', 'Finder', 'Netscape',
                                      'StdSuites', 'SystemEvents', 'Terminal',
                                      'cfmfile', 'bundlebuilder', 'buildtools',
                                      'ColorPicker', 'Audio_mac'),
                           'sunos5' : ('sunaudiodev', 'SUNAUDIODEV'),
                          }
    optional_modules = ('bsddb185', 'Canvas', 'dl', 'linuxaudiodev', 'imageop',
                        'sv', 'bsddb', 'dbhash')

    def check_removal(self, module_name, optional=False):
        """Make sure the specified module, when imported, raises a
        DeprecationWarning and specifies itself in the message."""
        with CleanImport(module_name), warnings.catch_warnings():
            warnings.filterwarnings("error", ".+ (module|package) .+ removed",
                                    DeprecationWarning, __name__)
            warnings.filterwarnings("error", ".+ removed .+ (module|package)",
                                    DeprecationWarning, __name__)
            try:
                __import__(module_name, level=0)
            except DeprecationWarning as exc:
                self.assertIn(module_name, exc.args[0],
                              "%s warning didn't contain module name"
                              % module_name)
            except ImportError:
                if not optional:
                    self.fail("Non-optional module {0} raised an "
                              "ImportError.".format(module_name))
            else:
                # For extension modules, check the __warningregistry__.
                # They won't rerun their init code even with CleanImport.
                if not check_deprecated_module(module_name):
                    self.fail("DeprecationWarning not raised for {0}"
                              .format(module_name))

    def test_platform_independent_removals(self):
        # Make sure that the modules that are available on all platforms raise
        # the proper DeprecationWarning.
        for module_name in self.all_platforms:
            self.check_removal(module_name)

    def test_platform_specific_removals(self):
        # Test the removal of platform-specific modules.
        for module_name in self.inclusive_platforms.get(sys.platform, []):
            self.check_removal(module_name, optional=True)

    def test_optional_module_removals(self):
        # Test the removal of modules that may or may not be built.
        for module_name in self.optional_modules:
            self.check_removal(module_name, optional=True)

    def test_os_path_walk(self):
        msg = "In 3.x, os.path.walk is removed in favor of os.walk."
        def dumbo(where, names, args): pass
        for path_mod in ("ntpath", "macpath", "os2emxpath", "posixpath"):
            mod = __import__(path_mod)
            reset_module_registry(mod)
            with check_py3k_warnings() as w:
                mod.walk("crashers", dumbo, None)
            self.assertEqual(str(w.message), msg)

    def test_reduce_move(self):
        from operator import add
        # reduce tests may have already triggered this warning
        reset_module_registry(unittest.case)
        with warnings.catch_warnings():
            warnings.filterwarnings("error", "reduce")
            self.assertRaises(DeprecationWarning, reduce, add, range(10))

    def test_mutablestring_removal(self):
        # UserString.MutableString has been removed in 3.0.
        import UserString
        # UserString tests may have already triggered this warning
        reset_module_registry(UserString)
        with warnings.catch_warnings():
            warnings.filterwarnings("error", ".*MutableString",
                                    DeprecationWarning)
            self.assertRaises(DeprecationWarning, UserString.MutableString)

def test_main():
    run_unittest(TestPy3KWarnings,
                 TestStdlibRemovals)

if __name__ == '__main__':
    test_main()


text:
{-# LANGUAGE GADTs, CPP, Trustworthy, TemplateHaskell, TupleSections, ViewPatterns, DeriveDataTypeable, ScopedTypeVariables #-}

module Main where

import JavaScript.Web.Worker.Extras

import qualified Tarefa6_li1g175 as G175

main :: IO ()
main = runSyncWorker $ \(inp::[String],player::Int,ticks::Int) -> G175.bot inp player ticks


text:
<?php

namespace Media;

class Method_Index extends Method_Template
{
    public function template ( )
	{
        if ( isset( $this->view ) )
        {
            if (isset($this->model))
            {
                die('Have Model');

//                return \Response::forge( \View::forge('frontend/post/show/image')->set($this->data, null, false) );
            }
            elseif ( isset($this->collectionModel) )
            {

//                print_r($this->collectionModel);
//                die('Have Models and Views');

                return \Response::forge( $this->view->set($this->data, null, false) );
            }

        }
        if ( is_array($this->data) )
        {
            // Do array stuff

            $name = strtolower($this->modelName);
            echo $name;
            die('Some Data');
            return \View::forge( $name , $this->data);
        }
        echo '<pre>';
        print_r($this);
        die('No Data');
//		$this->data[$this->modelName] = $this->model::find('all');

        return View::forge($this->modelName, $this->data);
	}
}


text:
package com.planet_ink.coffee_mud.Items.CompTech;
import com.planet_ink.coffee_mud.Items.Basic.StdContainer;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.Technical.TechType;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.lang.ref.WeakReference;
import java.util.*;

public class StdCompFuellessGenerator extends StdElecCompItem implements PowerGenerator
{
	@Override
	public String ID()
	{
		return "StdCompFuellessGenerator";
	}

	public StdCompFuellessGenerator()
	{
		super();
		setName("a generator");
		setDisplayText("a generator sits here.");
		setDescription("If you put the right place, under the right circumstances, I'll bet it makes power.");

		material=RawMaterial.RESOURCE_STEEL;
		setPowerCapacity(1000);
		setPowerRemaining(0);
		baseGoldValue=0;
		basePhyStats.setWeight(500);
		recoverPhyStats();
	}

	protected int   generatedAmtPerTick = 1;

	protected int getAdjustedGeneratedAmountPerTick()
	{
		return generatedAmtPerTick;
	}

	@Override
	public int getGeneratedAmountPerTick()
	{
		return generatedAmtPerTick;
	}

	@Override
	public void setGeneratedAmountPerTick(int amt)
	{
		generatedAmtPerTick=amt;
	}

	@Override
	public TechType getTechType()
	{
		return TechType.SHIP_GENERATOR;
	}

	protected boolean canGenerateRightNow()
	{
		return true;
	}

	@Override
	public void executeMsg(Environmental myHost, CMMsg msg)
	{
		super.executeMsg(myHost, msg);
		if(msg.amITarget(this))
		{
			switch(msg.targetMinor())
			{
			case CMMsg.TYP_GET:
				break;
			case CMMsg.TYP_INSTALL:
				break;
			case CMMsg.TYP_ACTIVATE:
				if((msg.source().location()!=null)&&(!CMath.bset(msg.targetMajor(), CMMsg.MASK_CNTRLMSG)))
					msg.source().location().show(msg.source(), this, CMMsg.MSG_OK_VISUAL, L("<S-NAME> power(s) up <T-NAME>."));
				this.activate(true);
				break;
			case CMMsg.TYP_DEACTIVATE:
				if((msg.source().location()!=null)&&(!CMath.bset(msg.targetMajor(), CMMsg.MASK_CNTRLMSG)))
					msg.source().location().show(msg.source(), this, CMMsg.MSG_OK_VISUAL, L("<S-NAME> shut(s) down <T-NAME>."));
				this.activate(false);
				break;
			case CMMsg.TYP_LOOK:
				if(CMLib.flags().canBeSeenBy(this, msg.source()))
					msg.source().tell(L("@x1 is currently @x2",name(),(activated()?"delivering power.\n\r":"deactivated/shut down.\n\r")));
				return;
			case CMMsg.TYP_POWERCURRENT:
				if((msg.value()==0) && (activated()))
				{
					if((((powerCapacity() - powerRemaining()) >= getGeneratedAmountPerTick())
						||(powerRemaining() < getGeneratedAmountPerTick()))
					&&(this.canGenerateRightNow()))
					{
						double generatedAmount = getAdjustedGeneratedAmountPerTick();
						generatedAmount *= this.getComputedEfficiency() * this.getFinalManufacturer().getEfficiencyPct();
						long newAmount=powerRemaining() + Math.round(generatedAmount);
						if(newAmount > powerCapacity())
							newAmount=powerCapacity();
						setPowerRemaining(newAmount);
					}
				}
				break;
			}
		}
	}

	@Override
	public boolean sameAs(Environmental E)
	{
		if(!(E instanceof StdCompFuellessGenerator))
			return false;
		return super.sameAs(E);
	}

}


text:
package kafka.api

import kafka.controller.LeaderIsrAndControllerEpoch
import kafka.utils._

import scala.collection.Set

object LeaderAndIsr {
  val initialLeaderEpoch: Int = 0
  val initialZKVersion: Int = 0
  val NoLeader = -1
  val LeaderDuringDelete = -2
}

case class LeaderAndIsr(var leader: Int, var leaderEpoch: Int, var isr: List[Int], var zkVersion: Int) {
  def this(leader: Int, isr: List[Int]) = this(leader, LeaderAndIsr.initialLeaderEpoch, isr, LeaderAndIsr.initialZKVersion)

  override def toString: String = {
    Json.encode(Map("leader" -> leader, "leader_epoch" -> leaderEpoch, "isr" -> isr))
  }
}

case class PartitionStateInfo(leaderIsrAndControllerEpoch: LeaderIsrAndControllerEpoch, allReplicas: Set[Int]) {

  def replicationFactor = allReplicas.size

  override def toString: String = {
    val partitionStateInfo = new StringBuilder
    partitionStateInfo.append("(LeaderAndIsrInfo:" + leaderIsrAndControllerEpoch.toString)
    partitionStateInfo.append(",ReplicationFactor:" + replicationFactor + ")")
    partitionStateInfo.append(",AllReplicas:" + allReplicas.mkString(",") + ")")
    partitionStateInfo.toString()
  }
}


text:
import * as path from "path";
export * from "./isAllowedMixin";
export * from "./isAllowedMixinForStructure";
export * from "./isOverloadStructure";

export const rootFolder = path.join(__dirname, "../../");


text:
// Fig. 7.37: elevatorButton.h
// ElevatorButton class definition.
#ifndef ELEVATORBUTTON_H
#define ELEVATORBUTTON_H

class Elevator;  // forward declaration

class ElevatorButton {

public:
   ElevatorButton( Elevator & );  // constructor
   ~ElevatorButton();             // destructor

   void pressButton();            // press the button
   void resetButton();            // reset the button

private:
   bool pressed;                  // state of button

   // reference to elevator containing this button
   Elevator &elevatorRef;

}; // end class ElevatorButton

#endif // ELEVATORBUTTON_H


text:
namespace euphoria::core
{
    float
    from01f(float lower_bound, float upper_bound, float value)
    {
        return value * (upper_bound - lower_bound) + lower_bound;
    }

    template <>
    float
    from01(const Range<float>& range, float value)
    {
        return from01f
        (
            range.lower_bound,
            range.upper_bound,
            value
        );
    }
}


text:
namespace Google.Maps.StreetView
{
	public abstract class StreetViewBase : BaseRequest
	{
		/// <summary>
		/// Defines the center of the map, equidistant from all edges of the
		/// map. This parameter takes an <see cref="Location" />-derived instance identifying a
		/// unique location on the face of the earth. Use <see cref="LatLng" /> for a
		/// {latitude,longitude} pair (e.g. 40.714728,-73.998672) or use <see cref="Location" /> for a
		/// string address (e.g. "city hall, new york, ny"). Either Location or PanoramaId is required.
		/// </summary>
		public Location Location { get; set; }

		/// <summary>
		/// PanoramaId is a specific panorama ID. These are generally stable.
		/// Either Location or PanoramaId is required.
		/// </summary>
		public string PanoramaId { get; set; }
	}
}


text:
package tests;

import com.badlogic.gdx.Files.FileType;
import com.cocos2dj.base.Director;
import com.cocos2dj.basic.Engine;
import com.cocos2dj.platform.AppDelegate;
import com.cocos2dj.platform.FileUtils;
import com.cocos2dj.platform.ResolutionPolicy;

/**
 *
 * @author xujun
 */
public class TestAppDelegate_Tests implements AppDelegate {

	TestController _testController;

	@Override
	public void initConfiguration() {
		Engine.setSingleThreadMode();
//		Engine.setDoubleThreadMode();
	}

	@Override
	public boolean applicationDidFinishLaunching() {
		FileUtils.getInstance().addSearchPath("/Users/xujun/remoteProject/Cocos2dJavaImages", FileType.Absolute, true);
		FileUtils.getInstance().addSearchPath("Resource", FileType.Internal, true);

		Director.getInstance().getOpenGLView().setDesignResolutionSize(1136, 640, ResolutionPolicy.EXACT_FIT);

		_testController = TestController.getInstance();
		_testController.start();
		return true;
	}

	@Override
	public void applicationDidEnterBackground() {
		if(_testController != null) {
			_testController.onEnterBackground();
		}
		Director.getInstance().stopAnimation();
	}

	@Override
	public void applicationWillEnterForeground() {
		if(_testController != null) {
			_testController.onEnterForeground();
		}
		Director.getInstance().startAnimation();
	}

}


text:
```
docker build -t demo .
docker run --rm demo
```


text:
namespace bookbot {

Trajectory PerformVelocityProfileSearch(
    const Path& desired_path, const Trajectory1DPoint& initial_state,
    const VelocityPlannerParams& params, const Trajectory& previous_trajectory,
    const SignedDistanceField& distance_field);

}  // namespace bookbot

#endif  // BOOKBOT_PRIMITIVE_VELOCITY_PLANNER_VELOCITY_PROFILE_SEARCH_H_


text:
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <groupId>com.googlecode.smartref</groupId>
   <artifactId>smartref</artifactId>
   <packaging>jar</packaging>
   <version>0.1.0-SNAPSHOT</version>

   <dependencies>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>4.7</version>
      </dependency>
   </dependencies>

   <build>
      <plugins>
         <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
               <source>1.5</source>
               <target>1.5</target>
            </configuration>
         </plugin>
      </plugins>
   </build>
</project>


text:
<?php

namespace Magento\Checkout\Test\Unit\Block\Onepage;

use Magento\Sales\Model\Order;

/**
 * Class SuccessTest
 * @package Magento\Checkout\Block\Onepage
 */
class SuccessTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \Magento\Checkout\Block\Onepage\Success
     */
    protected $block;

    /**
     * @var \Magento\Sales\Model\Order\Config | \PHPUnit_Framework_MockObject_MockObject
     */
    protected $orderConfig;

    /**
     * @var \Magento\Checkout\Model\Session | \PHPUnit_Framework_MockObject_MockObject
     */
    protected $checkoutSession;

    protected function setUp()
    {
        $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);

        $this->orderConfig = $this->getMock('Magento\Sales\Model\Order\Config', [], [], '', false);

        $this->checkoutSession = $this->getMockBuilder(
            'Magento\Checkout\Model\Session'
        )
            ->disableOriginalConstructor()
            ->getMock();

        $this->block = $objectManager->getObject(
            'Magento\Checkout\Block\Onepage\Success',
            [
                'orderConfig' => $this->orderConfig,
                'checkoutSession' => $this->checkoutSession
            ]
        );
    }

    public function testGetAdditionalInfoHtml()
    {
        $layout = $this->getMock('Magento\Framework\View\LayoutInterface', [], [], '', false);
        $layout->expects(
            $this->once()
        )->method(
            'renderElement'
        )->with(
            'order.success.additional.info'
        )->will(
            $this->returnValue('AdditionalInfoHtml')
        );
        $this->block->setLayout($layout);
        $this->assertEquals('AdditionalInfoHtml', $this->block->getAdditionalInfoHtml());
    }

    /**
     * @dataProvider invisibleStatusesProvider
     *
     * @param array $invisibleStatuses
     * @param bool $expectedResult
     */
    public function testToHtmlOrderVisibleOnFront(array $invisibleStatuses, $expectedResult)
    {
        $orderId = 5;
        $realOrderId = 100003332;
        $status = Order::STATE_PENDING_PAYMENT;

        $order = $this->getMockBuilder('Magento\Sales\Model\Order')
            ->disableOriginalConstructor()
            ->getMock();

        $this->checkoutSession->expects($this->once())
            ->method('getLastRealOrder')
            ->willReturn($order);
        $order->expects($this->atLeastOnce())
            ->method('getEntityId')
            ->willReturn($orderId);
        $order->expects($this->atLeastOnce())
            ->method('getIncrementId')
            ->willReturn($realOrderId);
        $order->expects($this->atLeastOnce())
            ->method('getStatus')
            ->willReturn($status);

        $this->orderConfig->expects($this->any())
            ->method('getInvisibleOnFrontStatuses')
            ->willReturn($invisibleStatuses);

        $this->block->toHtml();

        $this->assertEquals($expectedResult, $this->block->getIsOrderVisible());
    }

    public function invisibleStatusesProvider()
    {
        return [
            [[Order::STATE_PENDING_PAYMENT, 'status2'],  false],
            [['status1', 'status2'], true]
        ];
    }
}


text:
namespace caffe2 {
namespace {

REGISTER_CPU_OPERATOR(Partition, PartitionOp);
REGISTER_CPU_OPERATOR(LengthsPartition, LengthsPartitionOp);

OPERATOR_SCHEMA(Partition)
    .NumInputsOutputs([](int in, int out) {
      return in > 0 && out > 0 && out % in == 0;
    })
    .SetDoc(R"DOC(
Splits the input int tensor into multiple ones according to the first tensor.

Takes the first input and partitions it to shards according to the remainder of
values modulo the number of partitions. It requires that the first tensor is of
integral type. The number of partitions is derived as (num_output / num_input).

If additional inputs are present they must have the same shape as the first
input, optionally with extra trailing dimensions. They will be partitioned
accordingly to the first input.

Optional arg 'pack_first_input' transforms the first tensor values as
X_ij / num_partitions.

Outputs are ordered as
X_0_part_0, X_1_part_0, ..., X_N-1_part_0, X_0_part_1, ..., X_N-1_part_K-1
)DOC")
    .Arg(
        "pack_first_input",
        "(int, default 0) If set, the operator transforms "
        "the first tensor values as floor(X_ij / num_partitions)")
    .Input(
        0,
        "input",
        "Input tensor containing data to be partitioned. The "
        "number of input tensors might be greater than 1 but must have the "
        "same shape as the previous tensors.")
    .Output(
        0,
        "partitions",
        "Output Partitions. The number of output tensors has to be a "
        "multiple of the number of input tensors.");

OPERATOR_SCHEMA(LengthsPartition)
    .NumInputsOutputs([](int in, int out) {
      return in >= 2 && out > 0 && out % in == 0;
    })
    .SetDoc(R"DOC(
LengthsPartition splits the input int tensor into multiple ones according to the
second tensor. The first dimension is expected to be the tensor that describes
lengths of the elements.

Takes the second input and partitions it to shards according to the remainder of
values modulo the number of partitions. It requires the second tensor to be
a 1D-tensor of the integral type. The first tensor should be 1D-tensor of int32
that would represent the lengths of the elements in the input. The number of
partitions is derived as (num_output / num_input).

If additional inputs are present they must have the same shape as the first
input, optionally with extra trailing dimensions. They will be partitioned
accordingly to the first input.

Optional arg 'pack_first_input' transforms the first tensor values as
X_ij / num_partitions.

Outputs are ordered as
X_0_part_0, X_1_part_0, ..., X_N-1_part_0, X_0_part_1, ..., X_N-1_part_K-1
)DOC")
    .Arg(
        "pack_first_input",
        "(int, default 0) If set, the operator transforms "
        "the first tensor values as floor(X_ij / num_partitions)")
    .Input(
        0,
        "input",
        "Input tensor containing data to be partitioned. The "
        "number of input tensors might be greater than 1 but must have the "
        "same shape as the previous tensors.")
    .Output(
        0,
        "partitions",
        "Output Partitions. The number of output tensors has to be a "
        "multiple of the number of input tensors.");

// This should actually have gradient, but for now nothing uses it.
// Because gradient computation right now is not input/output aware it can't be
// GRADIENT_NOT_IMPLEMENTEDYET
NO_GRADIENT(Partition);
NO_GRADIENT(LengthsPartition);
} // namespace
} // namespace caffe2


text:
set -x
exec 1> >(tee /var/log/geomancer-install.log) 2>&1

echo "Geomancer app activation beginning."

# Activate process control, which manages gunicorn and worker processes
cp files/supervisor.conf /etc/supervisor/conf.d/geomancer.conf
supervisorctl reread
supervisorctl update

# Customize and activate web configuration
NGINX_CONF=/etc/nginx/sites-available/geomancer.conf
cp files/nginx.conf $NGINX_CONF
sed -i "s/STUB_SERVER_NAME/$1/" $NGINX_CONF
ln -s $NGINX_CONF /etc/nginx/sites-enabled/geomancer.conf
rm /etc/nginx/sites-enabled/default
service nginx restart

echo "Geomancer app activation ending."


text:
namespace mscorlib
{
	namespace System
	{
		namespace Runtime
		{
			namespace CompilerServices
			{

				//Public Methods Tests

				//Public Static Methods Tests

				// Method RaiseContractFailedEvent
				//		Signature: mscorlib::System::Diagnostics::Contracts::ContractFailureKind::__ENUM__ failureKind, mscorlib::System::String userMessage, mscorlib::System::String conditionText, mscorlib::System::Exception innerException
				TEST(mscorlib_System_Runtime_CompilerServices_ContractHelper_Fixture,RaiseContractFailedEvent_StaticTest)
				{

				}

				// Method TriggerFailure
				//		Signature: mscorlib::System::Diagnostics::Contracts::ContractFailureKind::__ENUM__ kind, mscorlib::System::String displayMessage, mscorlib::System::String userMessage, mscorlib::System::String conditionText, mscorlib::System::Exception innerException
				TEST(mscorlib_System_Runtime_CompilerServices_ContractHelper_Fixture,TriggerFailure_StaticTest)
				{

				}

			}
		}
	}
}


text:
'''
Created by auto_sdk on 2014-12-17 17:22:51
'''
from top.api.base import RestApi
class SubuserFullinfoGetRequest(RestApi):
	def __init__(self,domain='gw.api.taobao.com',port=80):
		RestApi.__init__(self,domain, port)
		self.fields = None
		self.sub_id = None
		self.sub_nick = None

	def getapiname(self):
		return 'taobao.subuser.fullinfo.get'