text:
#pragma once

#include "TokenStream.h"

namespace antlr4 {

  class ANTLR4CPP_PUBLIC UnbufferedTokenStream : public TokenStream {
  public:
    UnbufferedTokenStream(TokenSource *tokenSource);
    UnbufferedTokenStream(TokenSource *tokenSource, int bufferSize);
    UnbufferedTokenStream(const UnbufferedTokenStream& other) = delete;
    virtual ~UnbufferedTokenStream();

    UnbufferedTokenStream& operator = (const UnbufferedTokenStream& other) = delete;

    virtual Token* get(size_t i) const override;
    virtual Token* LT(ssize_t i) override;
    virtual size_t LA(ssize_t i) override;

    virtual TokenSource* getTokenSource() const override;

    virtual std::string getText(const misc::Interval &interval) override;
    virtual std::string getText() override;
    virtual std::string getText(RuleContext *ctx) override;
    virtual std::string getText(Token *start, Token *stop) override;

    virtual void consume() override;

    ///
    /// Return a marker that we can release later.
    ///

    /// The specific marker value used for this class allows for some level of
    /// protection against misuse where {@code seek()} is called on a mark or
    /// {@code release()} is called in the wrong order.
    ///
    virtual ssize_t mark() override;
    virtual void release(ssize_t marker) override;
    virtual size_t index() override;
    virtual void seek(size_t index) override;
    virtual size_t size() override;
    virtual std::string getSourceName() const override;

  protected:
    /// Make sure we have 'need' elements from current position p. Last valid
    /// p index is tokens.length - 1.  p + need - 1 is the tokens index 'need' elements
    /// ahead.  If we need 1 element, (p+1-1)==p must be less than tokens.length.
    TokenSource *_tokenSource;

    ///
    /// A moving window buffer of the data being scanned. While there's a marker,
    /// we keep adding to buffer. Otherwise, <seealso cref="#consume consume()"/> resets so
    /// we start filling at index 0 again.
    ///

    std::vector<std::unique_ptr<Token>> _tokens;

    ///
    /// 0..n-1 index into <seealso cref="#tokens tokens"/> of next token.
    ///

    /// The {@code LT(1)} token is {@code tokens[p]}. If {@code p == n}, we are
    /// out of buffered tokens.
    ///
    size_t _p;

    ///
    /// Count up with <seealso cref="#mark mark()"/> and down with
    /// <seealso cref="#release release()"/>. When we {@code release()} the last mark,
    /// {@code numMarkers} reaches 0 and we reset the buffer. Copy
    /// {@code tokens[p]..tokens[n-1]} to {@code tokens[0]..tokens[(n-1)-p]}.
    ///
    int _numMarkers;

    ///
    /// This is the {@code LT(-1)} token for the current position.
    ///
    Token *_lastToken;

    ///
    /// When {@code numMarkers > 0}, this is the {@code LT(-1)} token for the
    /// first token in <seealso cref="#tokens"/>. Otherwise, this is {@code null}.
    ///
    Token *_lastTokenBufferStart;

    ///
    /// Absolute token index. It's the index of the token about to be read via
    /// {@code LT(1)}. Goes from 0 to the number of tokens in the entire stream,
    /// although the stream size is unknown before the end is reached.
    ///

    /// This value is used to set the token indexes if the stream provides tokens
    /// that implement <seealso cref="WritableToken"/>.
    ///
    size_t _currentTokenIndex;

    virtual void sync(ssize_t want);

    ///
    /// Add {@code n} elements to the buffer. Returns the number of tokens
    /// actually added to the buffer. If the return value is less than {@code n},
    /// then EOF was reached before {@code n} tokens could be added.
    ///
    virtual size_t fill(size_t n);
    virtual void add(std::unique_ptr<Token> t);

    size_t getBufferStartIndex() const;

  private:
    void InitializeInstanceFields();
  };

} // namespace antlr4


text:
package org.springframework.vault.support;

import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

/**
 * Unit tests for {@link VaultTransitContext}.
 *
 * @author Mark Paluch
 */
class VaultTransitContextUnitTests {

	@Test
	void rejectsNullContext() {
		assertThatIllegalArgumentException()
				.isThrownBy(() -> VaultTransitContext.fromContext(null));
	}

	@Test
	void createsFromContext() {

		byte[] bytes = new byte[] { 1 };

		VaultTransitContext context = VaultTransitContext.fromContext(bytes);

		assertThat(context.getContext()).isEqualTo(bytes);
		assertThat(context.getNonce()).isEmpty();
	}

	@Test
	void rejectsNullNonce() {
		assertThatIllegalArgumentException()
				.isThrownBy(() -> VaultTransitContext.fromNonce(null));
	}

	@Test
	void createsFromNonce() {

		byte[] bytes = new byte[] { 1 };

		VaultTransitContext context = VaultTransitContext.fromNonce(bytes);

		assertThat(context.getNonce()).isEqualTo(bytes);
		assertThat(context.getContext()).isEmpty();
	}
}

redpajama_set_name: RedPajamaGithub


text:
CREATE TABLE `exon` (
  `exon_id` int(10) unsigned NOT NULL auto_increment,
  `seq_region_id` int(10) unsigned NOT NULL default '0',
  `seq_region_start` int(10) unsigned NOT NULL default '0',
  `seq_region_end` int(10) unsigned NOT NULL default '0',
  `seq_region_strand` tinyint(2) NOT NULL default '0',
  `phase` tinyint(2) NOT NULL default '0',
  `end_phase` tinyint(2) NOT NULL default '0',
  `is_current` BOOLEAN DEFAULT 1,
  `is_constitutive` BOOLEAN DEFAULT 0,
  PRIMARY KEY  (`exon_id`),
  KEY `seq_region_idx` (`seq_region_id`,`seq_region_start`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin;


text:
package com.livescribe.importsecretkeytool.ftp;

public class FileItem {
	private String filename;
	private boolean isDirectory;

	public FileItem(String filename, boolean isDirectory) {
		super();
		this.filename = filename;
		this.isDirectory = isDirectory;
	}

	public boolean isDirectory() {
		return isDirectory;
	}

	public String getFilename() {
		return filename;
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 1.3//EN"
"http://struts.apache.org/dtds/tiles-config_1_3.dtd">
<tiles-definitions>
	<definition name="company-template" path="/jsp/tiles/company-layout.jsp">
		<put name="header" value="/jsp/tiles/template-company/header.jsp" />
		<put name="footer" value="/jsp/tiles/template-company/footer.jsp" />
	</definition>

</tiles-definitions>


text:
<!DOCTYPE HTML>

        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>{{site}}</title>
        <link href="{{static_url('css/bootstrap.min.css')}}" rel="stylesheet" media="screen">
        <link href="{{static_url('css/shire.css')}}" rel="stylesheet" media="screen">
        {% block css %}
        {% endblock %}

                    <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".nav-collapse">

                    </button>
                    {{site}}

                      {% block nav_items %}
                        {% for href, id, caption in navigation_bar %}

                        {{ caption|e }}

                        {% endfor %}
                      {% endblock %}

                      {% block navbar_form %}
                      {% endblock %}

                          {% if current_user %}

   {{current_user['email']}}

                          Sign out

                          {% else %}

                          Sign in

                          {% endif %}

                {% block body %}
                {% endblock %}

                Powered by shire.

            {{ xsrf_form_html() }}

            {% if handler.application.settings.debug %}

               0.2 else 'green'}}">Page processed in {{(request.request_time() * 1000)|round(2)}}ms

            {% endif %}

        {% block js %}
        {% endblock %}


text:
;(function( $, window ){

/*
	http://www.w3.org/TR/DOM-Level-3-Events/#event-type-wheel
*/

// jQuery method
$.fn.fire = function( type, opts ){
	opts = opts || {};
	// translate pageX to clientX
	if ( opts.pageX && !opts.clientX )
		opts.clientX = opts.pageX - $( window ).scrollLeft();
	// translate pageY to clientY
	if ( opts.pageY && !opts.clientY )
		opts.clientY = opts.pageY - $( window ).scrollTop();
	// iterate the jquery collection
	return this.each(function(){
		// clone options uniquely for each instance
		opts = $.extend( {}, $.fire.defaults, opts );
		// instanitate a new event
		new $.fire( this, type, opts );
	});
};

// Constructor
$.fire = function( element, type, opts ){
	this.element = element;
	this.type = type;
	this.event = this.create( opts );
	this.dispatch();
};

// Defaults
$.fire.defaults = {
	bubbles: true,
	cancelable: true,
	view: window,
	detail: 0,
	screenX: 0,
	screenY: 0,
	clientX: 0,
	clientY: 0,
	ctrlKey: false,
	altKey: false,
	shiftKey: false,
	metaKey: false,
	button: 0
};

// Methods
$.fire.prototype = {
	create: function( opts ){
		switch ( this.type ){
			case "mousemove":
				opts.cancelable = false;
			case "mousedown":
			case "mouseup":
			case "mouseover":
			case "mouseout":
			case "click":
			case "dblclick":
			case "touchstart":
			case "touchmove":
			case "touchend":
				return this.mouse( opts );
			case "keyup":
			case "keypress":
			case "keydown":
				return this.key( opts );
			default:
				return this.event( opts );
		}
	},
	event: function( opts ){
		var event;
		if ( document.createEvent ){
			event = document.createEvent("HTMLEvents");
			event.initEvent(
				this.type,
				opts.bubbles,
				opts.cancelable
			);
			$.extend( event, {
				view: opts.view,
				detail: opts.detail,
				screenX: opts.screenX,
				screenY: opts.screenY,
				clientX: opts.clientX,
				clientY: opts.clientY,
				ctrlKey: opts.ctrlKey,
				altKey: opts.altKey,
				shiftKey: opts.shiftKey,
				metaKey: opts.metaKey,
				keyCode: opts.keyCode,
				charCode: opts.charCode,
				button: opts.button
			});
		}
		else if ( document.createEventObject ) {
			event = $.extend( document.createEventObject(), opts );
		}
		return event;
	},
	mouse: function( opts ){
		var event;
		if ( document.createEvent ){
			event = document.createEvent("MouseEvents");
			event.initMouseEvent(
				this.type,
				opts.bubbles,
				opts.cancelable,
				opts.view,
				opts.detail,
				opts.screenX,
				opts.screenY,
				opts.clientX,
				opts.clientY,
				opts.ctrlKey,
				opts.altKey,
				opts.shiftKey,
				opts.metaKey,
				opts.button,
				$( opts.relatedTarget )[0] || document.body.parentNode
			);
		}
		else if ( document.createEventObject ) {
			event = this.event();
			event.button = { 0:1, 1:4, 2:2 }[ event.button ] || event.button;
		}
		return event;
	},
	key: function( opts ){
		var event;
		if ( document.createEvent ) {
			try {
				event = document.createEvent("KeyEvents");
				event.initKeyEvent(
					this.type,
					opts.bubbles,
					opts.cancelable,
					opts.view,
					opts.ctrlKey,
					opts.altKey,
					opts.shiftKey,
					opts.metaKey,
					opts.keyCode,
					opts.charCode
				);
			}
			catch ( err ){
				event = this.event( opts );
			}
		}
		else if ( document.createEventObject ){
			event = this.event( opts );
		}
		if ( $.browser.msie || $.browser.opera ){
			event.keyCode = opts.charCode > 0 ? opts.charCode : opts.keyCode;
			event.charCode = undefined;
		}
		return event;
	},
	dispatch: function(){
		if ( this.element.dispatchEvent )
			this.element.dispatchEvent( this.event );
		else if ( this.element.fireEvent )
			this.element.fireEvent( 'on'+this.type, this.event );
	}
};

})( jQuery, window );


text:
package com.google.wave.api.robot;

/**
 * Exception thrown when retrieving robot capabilities.
 *
 */
public class CapabilityFetchException extends Exception {

  public final int httpStatus;
  /**
   * Constructs a new exception with the given detail message.
   */
  public CapabilityFetchException(String message) {
    super(message);
    httpStatus = 0;
  }

  /**
   * Constructs a new exception with the given cause.
   */
  public CapabilityFetchException(Throwable cause) {
    super(cause);
    httpStatus = 0;
  }

  /**
   * Constructs a new exception with the given detail message and cause.
   */
  public CapabilityFetchException(String message, Throwable cause) {
    super(message, cause);
    httpStatus = 0;
  }

  public CapabilityFetchException(String message, int status) {
    super(message);
    httpStatus = status;
  }
}


text:
using System;
using System.Collections.Generic;
using Caliburn.Micro;
using Features.CrossPlatform.Results;
using Features.CrossPlatform.ViewModels.Activity;

namespace Features.CrossPlatform.ViewModels
{
    public class BubblingViewModel : Screen
    {
        public BindableCollection<MessageActivityViewModel> Phrases { get; } = new BindableCollection<MessageActivityViewModel>
        {
            new MessageActivityViewModel(Lipsum.Get(32)),
            new MessageActivityViewModel(Lipsum.Get(32)),
            new MessageActivityViewModel(Lipsum.Get(32)),
            new MessageActivityViewModel(Lipsum.Get(32))
        };

        public IEnumerable<IResult> SelectPhrase(MessageActivityViewModel phrase)
        {
            yield return new MessageDialogResult($"The selected phrase was {phrase.Message}.", "Phrase Selected");
        }
    }
}


text:
package com.sun.jmx.snmp;

/**
 * Represents an SNMP null value.
 *
This API is a Sun Microsystems internal API  and is subject
 * to change without notice.

 */

public class SnmpNull extends SnmpValue {
    private static final long serialVersionUID = 1783782515994279177L;

    // CONSTRUCTORS
    //-------------
    /**
     * Constructs a new SnmpNull.
     */
    public SnmpNull() {
        tag = NullTag ;
    }

    /**
     * Constructs a new SnmpNull.
     *
For mibgen private use only.
     */
    public SnmpNull(String dummy) {
        this();
    }

    /**
     * Constructs a new SnmpNull from the specified tag value.
     * @param t The initialization value.
     */
    public SnmpNull(int t) {
        tag = t ;
    }

    // PUBLIC METHODS
    //---------------
    /**
     * Returns the tag value of this SnmpNull.
     * @return The value.
     */
    public int getTag() {
        return tag ;
    }

    /**
     * Converts the NULL value to its ASN.1 String form.
     * When the tag is not the universal one, it is preprended
     * to the String form.
     * @return The String representation of the value.
     */
    public String toString() {
        String result = "" ;
        if (tag != 5) {
            result += "[" + tag + "] " ;
        }
        result += "NULL" ;
        switch(tag) {
        case errNoSuchObjectTag :
            result += " (noSuchObject)" ;
            break ;

        case errNoSuchInstanceTag :
            result += " (noSuchInstance)" ;
            break ;

        case errEndOfMibViewTag :
            result += " (endOfMibView)" ;
            break ;
        }
        return result ;
    }

    /**
     * Converts the NULL value to its SnmpOid form.
     * Normally, a NULL value cannot be used as an index value,
     * this method triggers an exception.
     * @return The OID representation of the value.
     */
    public SnmpOid toOid() {
        throw new IllegalArgumentException() ;
    }

    /**
     * Performs a clone action. This provides a workaround for the
     * SnmpValue interface.
     * @return The SnmpValue clone.
     */
    final synchronized public SnmpValue duplicate() {
        return (SnmpValue) clone() ;
    }

    /**
     * Clones the SnmpNull object, making a copy of its data.
     * @return The object clone.
     */
    final synchronized public Object clone() {
        SnmpNull  newclone = null ;
        try {
            newclone = (SnmpNull) super.clone() ;
            newclone.tag = tag ;
        } catch (CloneNotSupportedException e) {
            throw new InternalError(e) ; // vm bug.
        }
        return newclone ;
    }

    /**
     * Returns a textual description of the type object.
     * @return ASN.1 textual description.
     */
    final public String getTypeName() {
        return name ;
    }

    /**
     * Checks if this SnmpNull object corresponds to a noSuchObject value.
     * @return true if the tag equals {@link SnmpDataTypeEnums#errNoSuchObjectTag},
     * false otherwise.
     */
    public boolean isNoSuchObjectValue() {
        return (tag == SnmpDataTypeEnums.errNoSuchObjectTag);
    }

    /**
     * Checks if this SnmpNull object corresponds to a noSuchInstance value.
     * @return true if the tag equals {@link SnmpDataTypeEnums#errNoSuchInstanceTag},
     * false otherwise.
     */
    public boolean isNoSuchInstanceValue() {
        return (tag == SnmpDataTypeEnums.errNoSuchInstanceTag);
    }

    /**
     * Checks if this SnmpNull object corresponds to an endOfMibView value.
     * @return true if the tag equals {@link SnmpDataTypeEnums#errEndOfMibViewTag},
     * false otherwise.
     */
    public boolean isEndOfMibViewValue() {
        return (tag == SnmpDataTypeEnums.errEndOfMibViewTag);
    }

    // VARIABLES
    //----------
    /**
     * Name of the type.
     */
    final static String name = "Null" ;

    /**
     * This is the tag of the NULL value. By default, it is the universal tag value.
     */
    private int tag = 5 ;
}


text:
package org.sanelib.ils.api.converters.author;

import org.sanelib.ils.api.converters.ConverterHelper;
import org.sanelib.ils.api.converters.DtoToCommandConverter;
import org.sanelib.ils.api.dto.author.AuthorDto;
import org.sanelib.ils.core.commands.ProcessCommand;
import org.sanelib.ils.core.commands.author.DeleteAuthor;
import org.sanelib.ils.core.exceptions.ProcessError;
import org.springframework.stereotype.Component;

@Component
public class DeleteAuthorConverter implements DtoToCommandConverter<AuthorDto> {
    public ProcessCommand convert(AuthorDto dto, ProcessError processError) throws NoSuchFieldException, IllegalAccessException {

        DeleteAuthor command = new DeleteAuthor();

        ConverterHelper.checkCodeRequired(dto, command, processError);

       return command;
    }
}


text:
using System;
using System.Collections.Generic;
using System.CodeDom;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.ServiceModel;

namespace Thinktecture.Tools.Web.Services.CodeGeneration
{
    /// <summary>
    /// This class contains the code decorator implementation for generating the
    /// service type.
    /// </summary>
    internal class ServiceTypeGenerator : ICodeDecorator
    {
        ExtendedCodeDomTree code;
        CustomCodeGenerationOptions options;
        string serviceTypeName;

        #region ICodeDecorator Members

        public void Decorate(ExtendedCodeDomTree code, CustomCodeGenerationOptions options)
        {
            // Some validations to make debugging easier.
            Debug.Assert(code != null, "code parameter could not be null.");
            Debug.Assert(options != null, "options parameter could not be null.");

            // We execute this decorator only if we are generating the service side code.
            if (options.GenerateService)
            {
                // Initialize the state.
                this.code = code;
                this.options = options;
                CreateServiceType();
            }
        }

        #endregion

        #region Private Methods

        private void CreateServiceType()
        {
            // We can create the service type(s) only if we have one or more service
            // contract.
            if (code.ServiceContracts.Count > 0)
            {
                // Take a reference to the first ServiceContract available.
                // IMPORTANT!:(Currently we only support single service type)
                // May be want to support multiple service contracts in the next version.
                CodeTypeExtension srvContract = code.ServiceContracts[0];
                // Notify if srvContract is null. This would mean that we have constructed a bad
                // GeneratedCode instance from our CodeFactory.
                Debug.Assert(srvContract != null, "Generated service contract could not be null.");

                // Construct the service type name by removing the leading "I" character from
				// the service contract name that was added for generation of the interface.
            	string srvTypeName = srvContract.ExtendedObject.Name.Substring(1);

                // Create a new instance of CodeTypeDeclaration type representing the service type.
                CodeTypeDeclaration srvType = new CodeTypeDeclaration(srvTypeName);

                // Also wrap the CodeTypeDeclaration in an extension.
                CodeTypeExtension typeExt = new CodeTypeExtension(srvType);

                // This class.
                srvType.IsClass = true;

				switch (options.MethodImplementation)
				{
					case MethodImplementation.PartialClassMethodCalls:
						// The service type is partial so that the implementation methods can be written in separate file.
						srvType.IsPartial = true;
						break;
					case MethodImplementation.AbstractMethods:
						// The service type is abstract so that the operation methods can be made abstract.
						srvType.TypeAttributes |= TypeAttributes.Abstract;
						break;
				}

                // And this implements the service contract interface.
				if (code.CodeLanguauge == CodeLanguage.VisualBasic)
				{
					srvType.Members.Add(new CodeSnippetTypeMember("Implements " + srvContract.ExtendedObject.Name));
				}
				else
				{
					srvType.BaseTypes.Add(new CodeTypeReference(srvContract.ExtendedObject.Name));
				}

                // Now itterate the srvContractObject.Members and add each and every method in
                // the service contract type to the new type being created.
                foreach (CodeTypeMemberExtension methodExtension in srvContract.Methods)
                {
                    // Get a referece to the actual CodeMemberMethod object extended
                    // by ext.
                    CodeMemberMethod method = methodExtension.ExtendedObject as CodeMemberMethod;

                    // Create a new CodeMemeberMethod and copy the attributes.
                    CodeMemberMethod newMethod = new CodeMemberMethod();
                    newMethod.Name = method.Name;

                    // Implemented method has to be public.
                    newMethod.Attributes = MemberAttributes.Public;

                    // Notify that this member is implementing a method in the service contract.
					if (code.CodeLanguauge == CodeLanguage.VisualBasic)
					{
						newMethod.ImplementationTypes.Add(new CodeTypeReference(srvContract.ExtendedObject.Name));
					}
					else
					{
						newMethod.ImplementationTypes.Add(srvType.BaseTypes[0]);
					}

                    // Add all parametes to the newly created method.
                    foreach (CodeParameterDeclarationExpression cpde in method.Parameters)
                    {
                        newMethod.Parameters.Add(cpde);
                    }

                    // Set the return type.
                    newMethod.ReturnType = method.ReturnType;

					switch (options.MethodImplementation)
					{
						case MethodImplementation.PartialClassMethodCalls:
							{
								// Gather the parameters from the operation to pass into the implementation method.
								IEnumerable<CodeArgumentReferenceExpression> parameters = newMethod.Parameters
									.OfType<CodeParameterDeclarationExpression>()
									.Select(p => new CodeArgumentReferenceExpression(p.Name));

								// Create an expression to invoke the implementation method.
								CodeMethodInvokeExpression methodInvocation = new CodeMethodInvokeExpression(null, newMethod.Name + "Implementation", parameters.ToArray());

								// Check if the method has a return type.
								if (newMethod.ReturnType.BaseType != "System.Void")
								{
									// Make sure the call to the implementation method is returned.
									CodeMethodReturnStatement returnStatement = new CodeMethodReturnStatement(methodInvocation);
									newMethod.Statements.Add(returnStatement);
								}
								else
								{
									// Add the call to the implementation method without a return.
									newMethod.Statements.Add(methodInvocation);
								}
							}
							break;
						case MethodImplementation.NotImplementedException:
							{
								// Create a new code statement to throw NotImplementedExcption.
								CodeThrowExceptionStatement niex = new CodeThrowExceptionStatement(
									new CodeObjectCreateExpression(
										new CodeTypeReference(typeof(NotImplementedException)), new CodeExpression[] { })
									);

								// Add it to the statements collection in the new method.
								newMethod.Statements.Add(niex);
							}
							break;
						case MethodImplementation.AbstractMethods:
							{
								// No statement is required for the abstract methods.
								newMethod.Attributes |= MemberAttributes.Abstract;
								break;
							}
					}

					// Wrap the CodeMemberMethod in an extension. This could be useful for other extensions.
					CodeTypeMemberExtension newMethodExt = new CodeTypeMemberExtension(newMethod, typeExt);
					srvType.Members.Add(newMethodExt);
                }

                // Add the ServiceBehaviorAttribute attribute.
            	CodeAttributeDeclaration serviceBehaviorAttribute = new CodeAttributeDeclaration(
            		new CodeTypeReference(typeof(ServiceBehaviorAttribute)));

				if (!string.IsNullOrEmpty(options.InstanceContextMode))
				{
					CodeTypeReferenceExpression instanceContextModeEnum = new CodeTypeReferenceExpression(typeof(InstanceContextMode));
					CodeFieldReferenceExpression instanceContextModeValue = new CodeFieldReferenceExpression(instanceContextModeEnum, options.InstanceContextMode);
					CodeAttributeArgument instanceContextModeArgument = new CodeAttributeArgument("InstanceContextMode", instanceContextModeValue);
					serviceBehaviorAttribute.Arguments.Add(instanceContextModeArgument);
				}

				if (!string.IsNullOrEmpty(options.ConcurrencyMode))
				{
					CodeTypeReferenceExpression concurrencyModeEnum = new CodeTypeReferenceExpression(typeof(ConcurrencyMode));
					CodeFieldReferenceExpression concurrencyModeValue = new CodeFieldReferenceExpression(concurrencyModeEnum, options.ConcurrencyMode);
					CodeAttributeArgument concurrencyModeArgument = new CodeAttributeArgument("ConcurrencyMode", concurrencyModeValue);
					serviceBehaviorAttribute.Arguments.Add(concurrencyModeArgument);
				}

				if (!options.UseSynchronizationContext)
				{
					CodeAttributeArgument useSynchronizationContextAttribute = new CodeAttributeArgument("UseSynchronizationContext", new CodePrimitiveExpression(false));
					serviceBehaviorAttribute.Arguments.Add(useSynchronizationContextAttribute);
				}

            	typeExt.AddAttribute(serviceBehaviorAttribute);

                this.serviceTypeName = srvType.Name;
                // Finally add the newly created type to the code being generated.
                code.ServiceTypes.Add(typeExt);
            }
        }

        #endregion
    }
}


text:
#include "libtorrent/hasher.hpp"
#include "libtorrent/error_code.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/aux_/openssl.hpp"

namespace libtorrent {

#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif

	hasher::hasher()
	{
#ifdef TORRENT_USE_LIBGCRYPT
		gcry_md_open(&m_context, GCRY_MD_SHA1, 0);
#elif TORRENT_USE_COMMONCRYPTO
		CC_SHA1_Init(&m_context);
#elif TORRENT_USE_CRYPTOAPI
#elif defined TORRENT_USE_LIBCRYPTO
		SHA1_Init(&m_context);
#else
		SHA1_init(&m_context);
#endif
	}

	hasher::hasher(span<char const> data)
		: hasher()
	{
		update(data);
	}

	hasher::hasher(char const* data, int len)
		: hasher()
	{
		TORRENT_ASSERT(len > 0);
		update({data, len});
	}

#ifdef TORRENT_USE_LIBGCRYPT
	hasher::hasher(hasher const& h)
	{
		gcry_md_copy(&m_context, h.m_context);
	}

	hasher& hasher::operator=(hasher const& h) &
	{
		if (this == &h) return *this;
		gcry_md_close(m_context);
		gcry_md_copy(&m_context, h.m_context);
		return *this;
	}
#else
	hasher::hasher(hasher const&) = default;
	hasher& hasher::operator=(hasher const&) & = default;
#endif

	hasher& hasher::update(char const* data, int len)
	{
		return update({data, len});
	}

	hasher& hasher::update(span<char const> data)
	{
		TORRENT_ASSERT(data.size() > 0);
#ifdef TORRENT_USE_LIBGCRYPT
		gcry_md_write(m_context, data.data(), static_cast<std::size_t>(data.size()));
#elif TORRENT_USE_COMMONCRYPTO
		CC_SHA1_Update(&m_context, reinterpret_cast<unsigned char const*>(data.data()), CC_LONG(data.size()));
#elif TORRENT_USE_CRYPTOAPI
		m_context.update(data);
#elif defined TORRENT_USE_LIBCRYPTO
		SHA1_Update(&m_context, reinterpret_cast<unsigned char const*>(data.data())
			, static_cast<std::size_t>(data.size()));
#else
		SHA1_update(&m_context, reinterpret_cast<unsigned char const*>(data.data())
			, static_cast<std::size_t>(data.size()));
#endif
		return *this;
	}

	sha1_hash hasher::final()
	{
		sha1_hash digest;
#ifdef TORRENT_USE_LIBGCRYPT
		gcry_md_final(m_context);
		digest.assign(reinterpret_cast<char const*>(gcry_md_read(m_context, 0)));
#elif TORRENT_USE_COMMONCRYPTO
		CC_SHA1_Final(reinterpret_cast<unsigned char*>(digest.data()), &m_context);
#elif TORRENT_USE_CRYPTOAPI
		m_context.get_hash(digest.data(), digest.size());
#elif defined TORRENT_USE_LIBCRYPTO
		SHA1_Final(reinterpret_cast<unsigned char*>(digest.data()), &m_context);
#else
		SHA1_final(reinterpret_cast<unsigned char*>(digest.data()), &m_context);
#endif
		return digest;
	}

	void hasher::reset()
	{
#ifdef TORRENT_USE_LIBGCRYPT
		gcry_md_reset(m_context);
#elif TORRENT_USE_COMMONCRYPTO
		CC_SHA1_Init(&m_context);
#elif TORRENT_USE_CRYPTOAPI
		m_context.reset();
#elif defined TORRENT_USE_LIBCRYPTO
		SHA1_Init(&m_context);
#else
		SHA1_init(&m_context);
#endif
	}

	hasher::~hasher()
	{
#if defined TORRENT_USE_LIBGCRYPT
		gcry_md_close(m_context);
#endif
	}

#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO
#pragma clang diagnostic pop
#endif
}


text:
#ifndef WOBBLE_TESTS_H
#define WOBBLE_TESTS_H

#include <string>
#include <sstream>
#include <exception>
#include <functional>
#include <vector>

namespace wobble {
namespace tests {
struct LocationInfo;
}
}

/*
 * These global arguments will be shadowed by local variables in functions that
 * implement tests.
 *
 * They are here to act as default root nodes to fulfill method signatures when
 * tests are called from outside other tests.
 */
extern const wobble::tests::LocationInfo wobble_test_location_info;

namespace wobble {
namespace tests {

/**
 * Add information to the test backtrace for the tests run in the current
 * scope.
 *
 * Example usage:
 * \code
 * test_function(...)
 * {
 *    WOBBLE_TEST_INFO(info);
 *    for (unsigned i = 0; i < 10; ++i)
 *    {
 *       info() << "Iteration #" << i;
 *       ...
 *    }
 * }
 * \endcode
 */
struct LocationInfo : public std::stringstream
{
    LocationInfo() {}

    /**
     * Clear the current information and return the output stream to which new
     * information can be sent
     */
    std::ostream& operator()();
};

/// Information about one stack frame in the test execution stack
struct TestStackFrame
{
    const char* file;
    int line;
    const char* call;
    std::string local_info;

    TestStackFrame(const char* file, int line, const char* call)
        : file(file), line(line), call(call)
    {
    }

    TestStackFrame(const char* file, int line, const char* call, const LocationInfo& local_info)
        : file(file), line(line), call(call), local_info(local_info.str())
    {
    }

    std::string format() const;

    void format(std::ostream& out) const;
};

struct TestStack : public std::vector<TestStackFrame>
{
    using vector::vector;

    /// Return the formatted backtrace for this location
    std::string backtrace() const;

    /// Write the formatted backtrace for this location to \a out
    void backtrace(std::ostream& out) const;
};

/**
 * Exception thrown when a test assertion fails, normally by
 * Location::fail_test
 */
struct TestFailed : public std::exception
{
    std::string message;
    TestStack stack;

    TestFailed(const std::exception& e);

    template<typename ...Args>
    TestFailed(const std::exception& e, Args&&... args)
        : TestFailed(e)
    {
        add_stack_info(std::forward<Args>(args)...);
    }

    TestFailed(const std::string& message) : message(message) {}

    template<typename ...Args>
    TestFailed(const std::string& message, Args&&... args)
        : TestFailed(message)
    {
        add_stack_info(std::forward<Args>(args)...);
    }

    const char* what() const noexcept override { return message.c_str(); }

    template<typename ...Args>
    void add_stack_info(Args&&... args) { stack.emplace_back(std::forward<Args>(args)...); }
};

/**
 * Exception thrown when a test or a test case needs to be skipped
 */
struct TestSkipped : public std::exception
{
    std::string reason;

    TestSkipped();
    TestSkipped(const std::string& reason);
};

/**
 * Use this to declare a local variable with the given name that will be
 * picked up by tests as extra local info
 */
#define WOBBLE_TEST_INFO(name) \
    wobble::tests::LocationInfo wobble_test_location_info; \
    wobble::tests::LocationInfo& name = wobble_test_location_info

/**
 * The following assert_* functions throw TestFailed without capturing
 * file/line numbers, and need to be used inside wassert to give good error
 * messages. Do not use them in actual test cases, but you can use them to
 * implement test assertions.
 */

/// Test function that ensures that the actual value is true
template<typename A>
void assert_true(const A& actual)
{
    if (actual) return;
    std::stringstream ss;
    ss << "actual value " << actual << " is not true";
    throw TestFailed(ss.str());
}

void assert_true(std::nullptr_t actual);

/// Test function that ensures that the actual value is false
template<typename A>
void assert_false(const A& actual)
{
    if (!actual) return;
    std::stringstream ss;
    ss << "actual value " << actual << " is not false";
    throw TestFailed(ss.str());
}

void assert_false(std::nullptr_t actual);

template<typename LIST>
static inline void _format_list(std::ostream& o, const LIST& list) {
    bool first = true;
    o << "[";
    for (const auto& v: list)
    {
        if (first)
            first = false;
        else
            o << ", ";
        o << v;
    }
    o << "]";
}

template<typename T>
void assert_equal(const std::vector<T>& actual, const std::vector<T>& expected)
{
    if (actual == expected) return;
    std::stringstream ss;
    ss << "value ";
    _format_list(ss, actual);
    ss << " is different than the expected ";
    _format_list(ss, expected);
    throw TestFailed(ss.str());
}

template<typename T>
void assert_equal(const std::vector<T>& actual, const std::initializer_list<T>& expected)
{
    if (actual == expected) return;
    std::stringstream ss;
    ss << "value ";
    _format_list(ss, actual);
    ss << " is different than the expected ";
    _format_list(ss, expected);
    throw TestFailed(ss.str());
}

/**
 * Test function that ensures that the actual value is the same as a reference
 * one
 */
template<typename A, typename E>
void assert_equal(const A& actual, const E& expected)
{
    if (actual == expected) return;
    std::stringstream ss;
    ss << "value '" << actual << "' is different than the expected '" << expected << "'";
    throw TestFailed(ss.str());
}

/**
 * Test function that ensures that the actual value is different than a
 * reference one
 */
template<typename A, typename E>
void assert_not_equal(const A& actual, const E& expected)
{
    if (actual != expected) return;
    std::stringstream ss;
    ss << "value '" << actual << "' is not different than the expected '" << expected << "'";
    throw TestFailed(ss.str());
}

/// Ensure that the actual value is less than the reference value
template<typename A, typename E>
void assert_less(const A& actual, const E& expected)
{
    if (actual < expected) return;
    std::stringstream ss;
    ss << "value '" << actual << "' is not less than the expected '" << expected << "'";
    throw TestFailed(ss.str());
}

/// Ensure that the actual value is less or equal than the reference value
template<typename A, typename E>
void assert_less_equal(const A& actual, const E& expected)
{
    if (actual <= expected) return;
    std::stringstream ss;
    ss << "value '" << actual << "' is not less than or equals to the expected '" << expected << "'";
    throw TestFailed(ss.str());
}

/// Ensure that the actual value is greater than the reference value
template<typename A, typename E>
void assert_greater(const A& actual, const E& expected)
{
    if (actual > expected) return;
    std::stringstream ss;
    ss << "value '" << actual << "' is not greater than the expected '" << expected << "'";
    throw TestFailed(ss.str());
}

/// Ensure that the actual value is greather or equal than the reference value
template<typename A, typename E>
void assert_greater_equal(const A& actual, const E& expected)
{
    if (actual >= expected) return;
    std::stringstream ss;
    ss << "value '" << actual << "' is not greater than or equals to the expected '" << expected << "'";
    throw TestFailed(ss.str());
}

/// Ensure that the string \a actual starts with \a expected
void assert_startswith(const std::string& actual, const std::string& expected);

/// Ensure that the string \a actual ends with \a expected
void assert_endswith(const std::string& actual, const std::string& expected);

/// Ensure that the string \a actual contains \a expected
void assert_contains(const std::string& actual, const std::string& expected);

/// Ensure that the string \a actual does not contain \a expected
void assert_not_contains(const std::string& actual, const std::string& expected);

/**
 * Ensure that the string \a actual matches the extended regular expression
 * \a expected.
 *
 * The syntax is that of extended regular expression (see man regex(7) ).
 */
void assert_re_matches(const std::string& actual, const std::string& expected);

/**
 * Ensure that the string \a actual does not match the extended regular
 * expression \a expected.
 *
 * The syntax is that of extended regular expression (see man regex(7) ).
 */
void assert_not_re_matches(const std::string& actual, const std::string& expected);

template<class A>
struct Actual
{
    A _actual;
    Actual(const A& actual) : _actual(actual) {}
    ~Actual() {}

    void istrue() const { assert_true(_actual); }
    void isfalse() const { assert_false(_actual); }
    template<typename E> void operator==(const E& expected) const { assert_equal(_actual, expected); }
    template<typename E> void operator!=(const E& expected) const { assert_not_equal(_actual, expected); }
    template<typename E> void operator<(const E& expected) const { return assert_less(_actual, expected); }
    template<typename E> void operator<=(const E& expected) const { return assert_less_equal(_actual, expected); }
    template<typename E> void operator>(const E& expected) const { return assert_greater(_actual, expected); }
    template<typename E> void operator>=(const E& expected) const { return assert_greater_equal(_actual, expected); }
};

struct ActualCString
{
    const char* _actual;
    ActualCString(const char* s) : _actual(s) {}

    void istrue() const { return assert_true(_actual); }
    void isfalse() const { return assert_false(_actual); }
    void operator==(const char* expected) const;
    void operator==(const std::string& expected) const;
    void operator!=(const char* expected) const;
    void operator!=(const std::string& expected) const;
    void operator<(const std::string& expected) const;
    void operator<=(const std::string& expected) const;
    void operator>(const std::string& expected) const;
    void operator>=(const std::string& expected) const;
    void startswith(const std::string& expected) const;
    void endswith(const std::string& expected) const;
    void contains(const std::string& expected) const;
    void not_contains(const std::string& expected) const;
    void matches(const std::string& re) const;
    void not_matches(const std::string& re) const;
};

struct ActualStdString : public Actual<std::string>
{
    ActualStdString(const std::string& s) : Actual<std::string>(s) {}

    using Actual<std::string>::operator==;
    void operator==(const std::vector<uint8_t>& expected) const;
    using Actual<std::string>::operator!=;
    void operator!=(const std::vector<uint8_t>& expected) const;
    void startswith(const std::string& expected) const;
    void endswith(const std::string& expected) const;
    void contains(const std::string& expected) const;
    void not_contains(const std::string& expected) const;
    void matches(const std::string& re) const;
    void not_matches(const std::string& re) const;
};

struct ActualDouble : public Actual<double>
{
    using Actual::Actual;

    void almost_equal(double expected, unsigned places) const;
    void not_almost_equal(double expected, unsigned places) const;
};

template<typename A>
inline Actual<A> actual(const A& actual) { return Actual<A>(actual); }
inline ActualCString actual(const char* actual) { return ActualCString(actual); }
inline ActualCString actual(char* actual) { return ActualCString(actual); }
inline ActualStdString actual(const std::string& actual) { return ActualStdString(actual); }
inline ActualStdString actual(const std::vector<uint8_t>& actual) { return ActualStdString(std::string(actual.begin(), actual.end())); }
inline ActualDouble actual(double actual) { return ActualDouble(actual); }

struct ActualFunction : public Actual<std::function<void()>>
{
    using Actual::Actual;

    void throws(const std::string& what_match) const;
};

inline ActualFunction actual_function(std::function<void()> actual) { return ActualFunction(actual); }

struct ActualFile : public Actual<std::string>
{
    using Actual::Actual;

    void exists() const;
    void not_exists() const;
    void startswith(const std::string& data) const;
    void empty() const;
    void not_empty() const;
    void contents_equal(const std::string& data) const;
    void contents_equal(const std::vector<uint8_t>& data) const;
    void contents_equal(const std::initializer_list<std::string>& lines) const;
    void contents_match(const std::string& data_re) const;
    void contents_match(const std::initializer_list<std::string>& lines_re) const;
};

inline ActualFile actual_file(const std::string& pathname) { return ActualFile(pathname); }

/**
 * Run the given command, raising TestFailed with the appropriate backtrace
 * information if it threw an exception.
 *
 * If the command raises TestFailed, it adds the current stack to its stack
 * information.
 */
#define wassert(...) \
    do { try { \
        __VA_ARGS__ ; \
    } catch (wobble::tests::TestFailed& e) { \
        e.add_stack_info(__FILE__, __LINE__, #__VA_ARGS__, wobble_test_location_info); \
        throw; \
    } catch (std::exception& e) { \
        throw wobble::tests::TestFailed(e, __FILE__, __LINE__, #__VA_ARGS__, wobble_test_location_info); \
    } } while(0)

/// Shortcut to check that a given expression returns true
#define wassert_true(...) wassert(actual(__VA_ARGS__).istrue())

/// Shortcut to check that a given expression returns false
#define wassert_false(...) wassert(actual(__VA_ARGS__).isfalse())

/**
 * Ensure that the expression throws the given exception.
 *
 * Returns a copy of the exception, which can be used for further evaluation.
 */
#define wassert_throws(exc, ...) \
    [&]() { try { \
        __VA_ARGS__ ; \
        wfail_test(#__VA_ARGS__ " did not throw " #exc); \
    } catch (TestFailed& e) { \
        throw; \
    } catch (exc& e) { \
        return e; \
    } catch (std::exception& e) { \
        std::string msg(#__VA_ARGS__ " did not throw " #exc " but threw "); \
        msg += typeid(e).name(); \
        msg += " instead"; \
        wfail_test(msg); \
    } }()

/**
 * Call a function returning its result, and raising TestFailed with the
 * appropriate backtrace information if it threw an exception.
 *
 * If the function raises TestFailed, it adds the current stack to its stack
 * information.
 */
#define wcallchecked(func) \
    [&]() { try { \
        return func; \
    } catch (wobble::tests::TestFailed& e) { \
        e.add_stack_info(__FILE__, __LINE__, #func, wobble_test_location_info); \
        throw; \
    } catch (std::exception& e) { \
        throw wobble::tests::TestFailed(e, __FILE__, __LINE__, #func, wobble_test_location_info); \
    } }()

/**
 * Fail a test with an error message
 */
#define wfail_test(msg) wassert(throw wobble::tests::TestFailed((msg)))

struct TestCase;
struct TestController;
struct TestRegistry;
struct TestCaseResult;
struct TestMethod;
struct TestMethodResult;

/**
 * Test method information
 */
struct TestMethod
{
    /// Name of the test method
    std::string name;

    /// Documentation attached to this test method
    std::string doc;

    /**
     * Main body of the test method.
     *
     * If nullptr, the test will be skipped.
     */
    std::function<void()> test_function;

    TestMethod(const std::string& name)
        : name(name) {}

    TestMethod(const std::string& name, std::function<void()> test_function)
        : name(name), test_function(test_function) {}
};

/**
 * Test case collecting several test methods, and self-registering with the
 * singleton instance of TestRegistry.
 */
struct TestCase
{
    /// Name of the test case
    std::string name;

    /// All registered test methods
    std::vector<TestMethod> methods;

    /// Set to true the first time register_tests_once is run
    bool tests_registered = false;

    TestCase(const std::string& name);
    virtual ~TestCase() {}

    /**
     * Idempotent wrapper for register_tests()
     */
    void register_tests_once();

    /**
     * This will be called before running the test case, to populate it with
     * its test methods.
     *
     * This needs to be reimplemented with a function that will mostly be a
     * sequence of calls to add_method().
     */
    virtual void register_tests() = 0;

    /**
     * Set up the test case before it is run.
     */
    virtual void setup() {}

    /**
     * Clean up after the test case is run
     */
    virtual void teardown() {}

    /**
     * Set up before the test method is run
     */
    virtual void method_setup(TestMethodResult&) {}

    /**
     * Clean up after the test method is run
     */
    virtual void method_teardown(TestMethodResult&) {}

    /**
     * Call setup(), run all the tests that have been registered, then
     * call teardown().
     *
     * Exceptions in setup() and teardown() are caught and reported in
     * TestCaseResult. Test are run using run_test().
     */
    virtual TestCaseResult run_tests(TestController& controller);

    /**
     * Run a test method.
     *
     * Call method_setup(), run all the tests that have been registered, then
     * call method_teardown().
     *
     * Exceptions thrown by the test method are caught and reported in
     * TestMethodResult.
     *
     * Exceptions in method_setup() and method_teardown() are caught and
     * reported in TestMethodResult.
     */
    virtual TestMethodResult run_test(TestController& controller, TestMethod& method);

    /**
     * Register a new test method, with the actual test function to be added
     * later
     */
    TestMethod& add_method(const std::string& name)
    {
        methods.emplace_back(name);
        return methods.back();
    }

    /**
     * Register a new test method
     */
    template<typename ...Args>
    TestMethod& add_method(const std::string& name, std::function<void()> test_function)
    {
        methods.emplace_back(name, test_function);
        return methods.back();
    }

    /**
     * Register a new test method, including documentation
     */
    template<typename ...Args>
    TestMethod& add_method(const std::string& name, const std::string& doc, std::function<void()> test_function)
    {
        methods.emplace_back(name, test_function);
        methods.back().doc = doc;
        return methods.back();
    }
};

/**
 * Base class for test fixtures.
 *
 * A fixture will have a constructor and a destructor to do setup/teardown, and
 * a reset() function to be called inbetween tests.
 *
 * Fixtures do not need to descend from Fixture: this implementation is
 * provided as a default for tests that do not need one, or as a base for
 * fixtures that do not need reset().
 */
struct Fixture
{
    // Called before each test
    void test_setup() {}

    // Called after each test
    void test_teardown() {}
};

template<typename Fixture, typename... Args>
static inline Fixture* fixture_factory(Args... args)
{
    return new Fixture(args...);
}

/**
 * Test case that includes a fixture
 */
template<typename FIXTURE>
class FixtureTestCase : public TestCase
{
public:
    typedef FIXTURE Fixture;

    Fixture* fixture = nullptr;
    std::function<Fixture*()> make_fixture;

    template<typename... Args>
    FixtureTestCase(const std::string& name, Args... args)
        : TestCase(name)
    {
        make_fixture = std::bind(fixture_factory<FIXTURE, Args...>, args...);
    }

    void setup() override
    {
        TestCase::setup();
        fixture = make_fixture();
    }

    void teardown() override
    {
        delete fixture;
        fixture = 0;
        TestCase::teardown();
    }

    void method_setup(TestMethodResult& mr) override
    {
        TestCase::method_setup(mr);
        if (fixture) fixture->test_setup();
    }

    void method_teardown(TestMethodResult& mr) override
    {
        if (fixture) fixture->test_teardown();
        TestCase::method_teardown(mr);
    }

    /**
     * Register a new test method that takes a reference to the fixture as
     * argument.
     */
    template<typename ...Args>
    TestMethod& add_method(const std::string& name, std::function<void(FIXTURE&)> test_function)
    {
        return TestCase::add_method(name, [=]() { test_function(*fixture); });
    }

    /**
     * Register a new test method that takes a reference to the fixture as
     * argument, including documentation
     */
    template<typename ...Args>
    TestMethod& add_method(const std::string& name, const std::string& doc, std::function<void(FIXTURE&)> test_function)
    {
        return TestCase::add_method(name, doc, [=]() { test_function(*fixture); });
    }
};

}
}
#endif


text:
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class MakeTaglineMarkdown extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
        DB::table('settings')
            ->where(['key' => 'tagline'])
            ->update([
                'type' => 'markdown',
            ]);
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
        DB::table('settings')
            ->where(['key' => 'tagline'])
            ->update([
                'type' => 'text',
            ]);
	}

}


text:
<?php

/**
 * @file
 * Contains \DrupalCI\Plugin\BuildSteps\setup\Composer
 */

namespace DrupalCI\Plugin\BuildSteps\setup;

use DrupalCI\Plugin\JobTypes\JobInterface;
use DrupalCI\Console\Output;

/**
 * @PluginID("composer")
 *
 * Processes "setup: composer:" instructions from within a job
 * definition.
 */
class Composer extends SetupBase {

  /**
   * {@inheritdoc}
   *
   * @param string|array $arguments
   *   Arguments for a composer command. May be a string if one composer command
   *   is required to run or an array if multiple commands should run.
   */
  public function run(JobInterface $job, $data) {
    // Normalize the arguments to an array format.
    $data_list = (array) $data;

    $workingdir = $job->getJobCodebase()->getWorkingDir();

    foreach ($data_list as $data) {
      $cmd = $this->buildComposerCommand($data, $workingdir);
      $this->exec($cmd, $cmdoutput, $result);
    }
  }

  /**
   * Returns a full composer command based on the passed-in arguments.
   *
   * @param string $arguments
   *   The arguments for the composer command.
   *
   * @return string
   *   The full composer command string.
   */
  protected function buildComposerCommand($data, $workingdir) {
    return "./bin/composer $data $workingdir";
  }

}


text:
class C {
    static [s: string]: number;
}


text:
cask 'nvidia-geforce-now' do
  version '2.0.8.82,D31EB9'
  sha256 '7af7e0bd5cae3035b4e3112cef855f6d3dc0fa91328e9fe13db18720b89e32f5'

  url "https://ota-downloads.nvidia.com/ota/GeForceNOW-release_#{version.after_comma}.dmg"
  appcast 'https://ota.nvidia.com/release/available?product=GFN-mac&version=1.17.2.0&channel=OFFICIAL'
  name 'NVIDIA GeForce NOW'
  homepage 'https://www.nvidia.com/en-us/geforce/products/geforce-now/'

  depends_on macos: '>= :yosemite'

  # Renamed for consistency: app name is different in the Finder and in a shell.
  app 'GeForceNOW.app', target: 'NVIDIA GeForce NOW.app'

  zap trash: [
               '~/Library/Application Support/NVIDIA/GeForceNOW',
               '~/Library/Preferences/com.nvidia.gfnpc.mall.helper.plist',
             ]
end


text:
import collections
import contextlib
import copy
import warnings

import numpy
import six

import chainer
from chainer.backends import cuda
from chainer.backends import intel64
from chainer import initializers
from chainer import variable

def _is_shape(value):
    if value is None:
        return True
    elif isinstance(value, collections.Sequence):
        try:
            return all(int(x) for x in value)
        except TypeError:
            return False
    try:
        return int(value)
    except TypeError:
        return False

def _ensure_shape_dtype(value):
    # Return value paired with dtype FP32 if it is a shape.
    if _is_shape(value):
        return value, 'f'
    # Otherwise, returns it with assuming a shape-dtype pair.
    else:
        return value

class Link(object):

    """Building block of model definitions.

    Link is a building block of neural network models that support various
    features like handling parameters, defining network fragments,
    serialization, etc.

    Link is the primitive structure for the model definitions. It supports
    management of parameter variables and *persistent values* that should be
    incorporated to serialization.

    Parameter is an instance of :class:`~chainer.Parameter` registered to a
    link. A :class:`~chainer.Parameter` object can be registered as a
    parameter of the link by assigning it to an attribute within *an
    initialization scope*, which is a code surrounded by a
    :meth:`init_scope` context manager using the ``with`` statement.

    Persistent values are arrays, scalars, or any other serializable values
    registered via :meth:`register_persistent` or :meth:`add_persistent`.

    .. note::
       Whereas arbitrary serializable objects can be registered as persistent
       values, it is strongly recommended to just register values that should
       be treated as results of learning. A typical example of persistent
       values is ones computed during training and required for testing, e.g.
       running statistics for batch normalization.

    Parameters and persistent values are referred by their names. They can be
    accessed as attributes of the links. Link class itself manages the lists
    of names of parameters and persistent values to distinguish parameters and
    persistent values from other attributes.

    Link can be composed into more complex models. This composition feature is
    supported by child classes like :class:`Chain` and :class:`ChainList`. One
    can create a chain by combining one or more links. See the documents for
    these classes for details.

    As noted above, Link supports the serialization protocol of the
    :class:`~chainer.Serializer` class. **Note that only parameters and
    persistent values are saved and loaded.** Other attributes are considered
    as a part of user program (i.e. a part of network definition). In order to
    construct a link from saved file, other attributes must be identically
    reconstructed by user codes.

    .. admonition:: Example

       This is a simple example of custom link definition. Chainer itself also
       provides many links defined under the :mod:`~chainer.links` module. They
       might serve as examples, too.

       Consider we want to define a simple primitive link that implements a
       fully-connected layer based on the :func:`~functions.linear` function.
       Note that this function takes input units, a weight variable, and a bias
       variable as arguments. Then, the fully-connected layer can be defined as
       follows::

          import chainer
          import chainer.functions as F
          from chainer import initializers
          import numpy as np

          class LinearLayer(chainer.Link):

              def __init__(self, n_in, n_out):
                  super(LinearLayer, self).__init__()
                  with self.init_scope():
                      self.W = chainer.Parameter(
                          initializers.Normal(), (n_out, n_in))
                      self.b = chainer.Parameter(
                          initializers.Zero(), (n_out,))

              def forward(self, x):
                  return F.linear(x, self.W, self.b)

       This example shows that a user can define arbitrary parameters and use
       them in any methods. Links typically implement the ``forward``
       operator, although they can also provide other methods to implement the
       forward propagation.

    Args:
        params: *(deprecated since v2.0.0)* Names, shapes, and optional dtypes
            of initial parameters. The keywords are used as the parameter
            names and the corresponding values consist either of the shape or
            a tuple of shape and a dtype ``(shape, dtype)``. If only the shape
            is supplied, the default dtype will be used.

    Attributes:
        name (str): Name of this link, given by the parent chain (if exists).

    """

    def __init__(self, **params):
        self._params = set()
        self._persistent = set()
        self._cpu = True
        self._device_id = None
        self._within_init_scope = False
        self.name = None

        for name, value in six.iteritems(params):
            # Note: deprecation warning will be raised in add_param
            shape, dtype = _ensure_shape_dtype(value)
            self.add_param(name, shape, dtype=dtype)

    @property
    def xp(self):
        """Array module for this link.

        Depending on which of CPU/GPU this link is on, this property returns
        :mod:`numpy` or :mod:`cupy`.

        """
        return numpy if self._cpu else cuda.cupy

    @property
    def within_init_scope(self):
        """True if the current code is inside of an initialization scope.

        See :meth:`init_scope` for the details of the initialization scope.

        """
        return getattr(self, '_within_init_scope', False)

    @contextlib.contextmanager
    def init_scope(self):
        """Creates an initialization scope.

        This method returns a context manager object that enables registration
        of parameters (and links for :class:`~chainer.Chain`) by an assignment.
        A :class:`~chainer.Parameter` object can be automatically registered
        by assigning it to an attribute under this context manager.

        .. admonition:: Example

           In most cases, the parameter registration is done in the
           initializer method. Using the ``init_scope`` method, we can
           simply assign a :class:`~chainer.Parameter` object to register
           it to the link.

           .. code-block:: python

              class MyLink(chainer.Link):
                  def __init__(self):
                      super().__init__()
                      with self.init_scope():
                          self.W = chainer.Parameter(0, (10, 5))
                          self.b = chainer.Parameter(0, (5,))

        """
        old_flag = self.within_init_scope
        self._within_init_scope = True
        try:
            yield
        finally:
            self._within_init_scope = old_flag

    def __call__(self, *args, **kwargs):
        return self.forward(*args, **kwargs)

    def __setattr__(self, name, value):
        if self.within_init_scope and isinstance(value, variable.Parameter):
            value.name = name
            if not self._cpu:
                value.to_gpu(self._device_id)
            self._params.add(name)
            self._persistent.discard(name)
        super(Link, self).__setattr__(name, value)

    def __delattr__(self, name):
        self._params.discard(name)
        self._persistent.discard(name)
        super(Link, self).__delattr__(name)

    def add_param(self, name, shape=None, dtype=numpy.float32,
                  initializer=None):
        """Registers a parameter to the link.

        .. deprecated:: v2.0.0

           Assign a :class:`~chainer.Parameter` object directly to an
           attribute within :meth:`~chainer.Link.init_scope` instead.
           For example, the following code

           .. code-block:: python

               link.add_param('W', shape=(5, 3))

           can be replaced by the following assignment.

           .. code-block:: python

               with link.init_scope():
                   link.W = chainer.Parameter(None, (5, 3))

           The latter is easier for IDEs to keep track of the attribute's
           type.

        Args:
            name (str): Name of the parameter. This name is also used as the
                attribute name.
            shape (int or tuple of ints): Shape of the parameter array. If it
                is omitted, the parameter variable is left uninitialized.
            dtype: Data type of the parameter array.
            initializer: If it is not ``None``, the data is initialized with
                the given initializer. If it is an array, the data is directly
                initialized by it. If it is callable, it is used as a weight
                initializer. Note that in these cases, ``dtype`` argument is
                ignored.

        """
        warnings.warn('''\
Parameter registeration via Link.__init__ and Link.add_param are deprecated.
Assign a Parameter object directly to an attribute within a \
"with Link.init_scope():" block instead.
''', DeprecationWarning)
        if name in self.__dict__:
            raise AttributeError(
                'cannot register a new parameter %s: attribute exists'
                % name)
        if initializer is None:
            initializer = initializers.NaN(dtype)
        param = variable.Parameter(initializer, shape)
        with self.init_scope():
            setattr(self, name, param)

    def add_persistent(self, name, value):
        """Registers a persistent value to the link.

        The registered value is saved and loaded on serialization and
        deserialization. The value is set to an attribute of the link.

        Args:
            name (str): Name of the persistent value. This name is also used
                for the attribute name.
            value: Value to be registered.

        """
        d = self.__dict__
        if name in d:
            raise AttributeError(
                'cannot register a new persistent value %s: attribute exists'
                % name)
        self._persistent.add(name)
        self._params.discard(name)
        d[name] = value

    def register_persistent(self, name):
        """Registers an attribute of a given name as a persistent value.

        This is a convenient method to register an existing attribute as a
        persistent value. If ``name`` has been already registered as a
        parameter, this method removes it from the list of parameter names
        and re-registers it as a persistent value.

        Args:
            name (str): Name of the attribute to be registered.

        """
        if not hasattr(self, name):
            raise AttributeError(
                'cannot register non-existent attribute %s as a persistent '
                'value' % name)
        self._persistent.add(name)
        self._params.discard(name)

    def copy(self, mode='share'):
        """Copies the link hierarchy to new one.

        The whole hierarchy rooted by this link is copied. There are three
        modes to perform copy. Please see the document for the argument
        ``mode`` below.

        The name of the link is reset on the copy, since the copied instance
        does not belong to the original parent chain (even if exists).

        Args:
            mode (str): It should be either ``init``, ``copy``, or ``share``.
                ``init`` means parameter variables under the returned link
                object is re-initialized by calling their
                :meth:`~chainer.Parameter.initialize` method, so that all the
                parameters may have different initial values from the original
                link.
                ``copy`` means that the link object is deeply copied, so that
                its parameters are not re-initialized but are also deeply
                copied. Thus, all parameters have same initial values but can
                be changed independently.
                ``share`` means that the link is shallowly copied, so that its
                parameters' arrays are shared with the original one. Thus,
                their values are changed synchronously. The default ``mode``
                is ``share``.

        Returns:
            Link: Copied link object.

        """
        if mode == 'share':
            ret = copy.copy(self)
            ret._params = set(self._params)
            ret._persistent = set(self._persistent)
            ret.name = None
            d = ret.__dict__
            for name in ret._params:
                d[name] = copy.copy(d[name])
                d[name].grad = None
            return ret
        elif mode == 'copy':
            return copy.deepcopy(self)
        elif mode == 'init':
            ret = copy.deepcopy(self)
            for param in ret.params(include_uninit=False):
                param.initialize(param.shape)
            return ret
        else:
            raise ValueError(
                'The \'mode\' argument should be either \'init\','
                '\'copy\', or \'share\'. But {} was given.'.format(mode))

    def to_cpu(self):
        """Copies parameter variables and persistent values to CPU.

        This method does not handle non-registered attributes. If some of such
        attributes must be copied to CPU, the link implementation must
        override this method to do so.

        Returns: self

        """
        d = self.__dict__
        for name in self._params:
            d[name].to_cpu()
        for name in self._persistent:
            value = d[name]
            if isinstance(value, cuda.ndarray):
                d[name] = value.get()
            elif isinstance(value, intel64.mdarray):
                d[name] = numpy.array(value)
        self._cpu = True
        self._device_id = None
        return self

    def to_gpu(self, device=None):
        """Copies parameter variables and persistent values to GPU.

        This method does not handle non-registered attributes. If some of such
        attributes must be copied to GPU, the link implementation must
        override this method to do so.

        Args:
            device: Target device specifier. If omitted, the current device is
                used.

        Returns: self

        """
        cuda.check_cuda_available()
        if not self._cpu:
            return self
        d = self.__dict__
        with cuda._get_device(device):
            for name in self._params:
                d[name].to_gpu()
            for name in self._persistent:
                value = d[name]
                if isinstance(value, intel64.mdarray):
                    value = numpy.array(value)
                if isinstance(value, numpy.ndarray):
                    d[name] = cuda.to_gpu(value)
            self._device_id = cuda.cupy.cuda.get_device_id()
        self._cpu = False
        return self

    def to_intel64(self):
        """Copies parameter variables and persistent values to CPU."""
        intel64.check_ideep_available()
        d = self.__dict__
        for name in self._params:
            d[name].to_intel64()
        for name in self._persistent:
            value = d[name]
            if isinstance(value, cuda.ndarray):
                value = value.get()  # to numpy.ndarray
            if (isinstance(value, numpy.ndarray) and value.ndim in (1, 2, 4)):
                # TODO(kmaehashi): Remove ndim validation once iDeep has fixed.
                # Currently iDeep only supports (1, 2, 4)-dim arrays.
                # Note that array returned from `ideep.array` may not be an
                # iDeep mdarray, e.g., when the dtype is not float32.
                value = intel64.ideep.array(
                    value, itype=intel64.ideep.wgt_array)
            d[name] = value
        self._cpu = True
        self._device_id = None
        return self

    def params(self, include_uninit=True):
        """Returns a generator of all parameters under the link hierarchy.

        Args:
            include_uninit (bool): If ``True``, it also generates uninitialized
                parameters.

        Returns:
            A generator object that generates all parameters.

        """
        d = self.__dict__
        for name in self._params:
            if include_uninit or d[name].data is not None:
                yield d[name]

    def namedparams(self, include_uninit=True):
        """Returns a generator of all (path, param) pairs under the hierarchy.

        Args:
            include_uninit (bool): If ``True``, it also generates uninitialized
                parameters.

        Returns:
            A generator object that generates all (path, parameter) pairs. The
            paths are relative from this link.

        """
        d = self.__dict__
        for name in self._params:
            if include_uninit or d[name].data is not None:
                yield '/' + name, d[name]

    def links(self, skipself=False):
        """Returns a generator of all links under the hierarchy.

        Args:
            skipself (bool): If ``True``, then the generator skips this link
                and starts with the first child link.

        Returns:
            A generator object that generates all links.

        """
        if not skipself:
            yield self

    def namedlinks(self, skipself=False):
        """Returns a generator of all (path, link) pairs under the hierarchy.

        Args:
            skipself (bool): If ``True``, then the generator skips this link
                and starts with the first child link.

        Returns:
            A generator object that generates all (path, link) pairs.

        """
        if not skipself:
            yield '/', self

    def children(self):
        """Returns a generator of all child links.

        Returns:
            A generator object that generates all child links.

        """
        if 0:
            yield

    def copyparams(self, link, copy_persistent=True):
        """Copies all parameters from given link.

        This method copies data arrays of all parameters in the hierarchy. The
        copy is even done across the host and devices. Note that this method
        does not copy the gradient arrays.

        *From v5.0.0:* this method also copies the persistent values (e.g. the
        moving statistics of :class:`~chainer.links.BatchNormalization`). If
        the persistent value is an ndarray, the elements are copied. Otherwise,
        it is copied using :func:`copy.deepcopy`. The old behavior (not copying
        persistent values) can be reproduced with ``copy_persistent=False``.

        Args:
            link (Link): Source link object.
            copy_persistent (bool): If ``True``, persistent values are also
                copied. ``True`` by default.

        """
        src = link.__dict__
        dst = self.__dict__
        for name in self._params:
            dst[name].copydata(src[name])
        if copy_persistent:
            array_types = chainer.get_array_types()
            for name in self._persistent:
                d = dst[name]
                s = src[name]
                if isinstance(d, array_types) and isinstance(s, array_types):
                    cuda.copyto(d, s)
                else:
                    dst[name] = copy.deepcopy(s)

    def cleargrads(self):
        """Clears all gradient arrays.

        This method should be called before the backward computation at every
        iteration of the optimization.

        """
        for param in self.params():
            param.cleargrad()

    def zerograds(self):
        """Initializes all gradient arrays by zero.

        This method can be used for the same purpose of cleargrads, but less
        efficient. This method is left for backward compatibility.

        .. deprecated:: v1.15
           Use :meth:`cleargrads` instead.

        """
        warnings.warn(
            'Link.zerograds is deprecated. Use Link.cleargrads instead.',
            DeprecationWarning)
        for param in self.params():
            param.zerograd()

    def addgrads(self, link):
        """Accumulates gradient values from given link.

        This method adds each gradient array of the given link to corresponding
        gradient array of this link. The accumulation is even done across
        host and different devices.

        Args:
            link (Link): Source link object.

        """
        src = link.__dict__
        dst = self.__dict__
        for name in self._params:
            dst[name].addgrad(src[name])

    def enable_update(self):
        """Enables update rules of all parameters under the link hierarchy.

        This method sets the :attr:`~chainer.UpdateRule.enabled` flag of the
        update rule of each parameter variable to ``True``.

        """
        for param in self.params():
            rule = param.update_rule
            if rule is not None:
                rule.enabled = True

    def disable_update(self):
        """Disables update rules of all parameters under the link hierarchy.

        This method sets the :attr:`~chainer.UpdateRule.enabled` flag of the
        update rule of each parameter variable to ``False``.

        """
        for param in self.params():
            rule = param.update_rule
            if rule is not None:
                rule.enabled = False

    @property
    def update_enabled(self):
        """``True`` if at least one parameter has an update rule enabled."""
        for param in self.params():
            rule = param.update_rule
            if rule is not None and rule.enabled:
                return True
        return False

    def serialize(self, serializer):
        """Serializes the link object.

        Args:
            serializer (~chainer.AbstractSerializer): Serializer object.

        """
        d = self.__dict__
        for name in self._params:
            param = d[name]
            data = serializer(name, param.data)
            if param.data is None and data is not None:
                # Initialize the parameter here
                param.initialize(data.shape)
                if isinstance(param.data, numpy.ndarray):
                    numpy.copyto(param.data, data)
                else:
                    param.data.set(numpy.asarray(data))
        for name in self._persistent:
            d[name] = serializer(name, d[name])

    def repeat(self, n_repeat, mode='init'):
        """Repeats this link multiple times to make a :class:`~chainer.Sequential`.

        This method returns a :class:`~chainer.Sequential` object which has
        the same :class:`~chainer.Link` multiple times repeatedly. The ``mode``
        argument means how to copy this link to repeat.

        .. admonition:: Example

            You can repeat the same link multiple times to create a longer
            :class:`~chainer.Sequential` block like this:

            .. testcode::

                class ConvBNReLU(chainer.Chain):

                    def __init__(self):
                        super(ConvBNReLU, self).__init__()
                        with self.init_scope():
                            self.conv = L.Convolution2D(
                                None, 64, 3, 1, 1, nobias=True)
                            self.bn = L.BatchNormalization(64)

                    def forward(self, x):
                        return F.relu(self.bn(self.conv(x)))

                net = ConvBNReLU().repeat(16, mode='init')

            The ``net`` object contains 16 blocks, each of which is
            ``ConvBNReLU``. And the ``mode`` was ``init``, so each block
            is re-initialized with different parameters. If you give
            ``copy`` to this argument, each block has same values for its
            parameters but its object ID is different from others. If it is
            ``share``, each block is same to others in terms of not only
            parameters but also the object IDs because they are shallow-copied,
            so that when the parameter of one block is changed, all the
            parameters in the others also change.

        Args:
            n_repeat (int): Number of times to repeat.
            mode (str): It should be either ``init``, ``copy``, or ``share``.
                ``init`` means parameters of each repeated element in the
                returned :class:`~chainer.Sequential` will be re-initialized,
                so that all elements have different initial parameters.
                ``copy`` means that the parameters will not be re-initialized
                but object itself will be deep-copied, so that all elements
                have same initial parameters but can be changed independently.
                ``share`` means all the elements which consist the resulting
                :class:`~chainer.Sequential` object are same object because
                they are shallow-copied, so that all parameters of elements
                are shared with each other.

        """
        ret = chainer.Sequential()
        if n_repeat <= 0:
            return ret
        if mode not in ['init', 'copy', 'share']:
            raise ValueError(
                'The \'mode\' argument should be either \'init\','
                '\'copy\', or \'share\'. But {} was given.'.format(mode))
        link = self
        for _ in range(n_repeat):
            ret.append(link.copy(mode))
        return ret

    def count_params(self):
        """Counts the total number of parameters.

        This method counts the total number of scalar values included in all
        the :class:`~chainer.Parameter`\\ s held by this link and its
        descendants.

        If the link containts uninitialized parameters, this method raises a
        warning.

        Returns:
            The total size of parameters (int)

        """

        size = 0
        for name, param in self.namedparams():
            if param.array is None:
                warnings.warn(
                    'Parameter \'{}\' has not been initialized, so the '
                    'resulting count will not include the number of parameters'
                    ' in it.'.format(name))
                continue
            size += param.size
        return size

class Chain(Link):

    """Composable link with object-like interface.

    Composability is one of the most important features of neural nets. Neural
    net models consist of many reusable fragments, and each model itself might
    be embedded into a larger learnable system. Chain enables us to write a
    neural net based on composition, without bothering about routine works like
    collecting parameters, serialization, copying the structure with parameters
    shared, etc.

    This class actually provides a way to compose one or more links into one
    structure. A chain can contain one or more *child links*. Child link is a
    link registered to the chain with its own name. The child link is stored to
    an attribute of the chain with the name. User can write a whole model or a
    fragment of neural nets as a child class of Chain.

    Each chain itself is also a link. Therefore, one can combine chains into
    higher-level chains. In this way, links and chains construct a *link
    hierarchy*. Link hierarchy forms a tree structure, where each node is
    identified by the path from the root. The path is represented by a string
    like a file path in UNIX, consisting of names of nodes on the path, joined
    by slashes ``/``.

    A child link can be added just by assigning it to an attribute of the
    chain within :meth:`~chainer.Chain.init_scope`.

    The registered child link is saved and loaded on serialization and
    deserialization, and involved in the optimization. The registered link
    is called a child. The child link is accessible via :meth:`children`
    generator, which returns a generator running through the children in
    registered order.

    On registration of a child link, its :attr:`~Link.name` attribute is also
    set (or overwritten if the link has already been registered to another
    chain).

    .. admonition:: Example

       This is a simple example of custom chain definition. Chainer itself also
       provides some chains defined under the :mod:`~chainer.links` module.
       They might serve as examples, too.

       Consider we want to define a multi-layer perceptron consisting of two
       hidden layers with rectifiers as activation functions. We can use the
       :class:`~chainer.links.Linear` link as a building block::

          import chainer
          import chainer.functions as F
          import chainer.links as L

          class MultiLayerPerceptron(chainer.Chain):

              def __init__(self, n_in, n_hidden, n_out):
                  super(MultilayerPerceptron, self).__init__()
                  with self.init_scope():
                      self.layer1 = L.Linear(n_in, n_hidden)
                      self.layer2 = L.Linear(n_hidden, n_hidden)
                      self.layer3 = L.Linear(n_hidden, n_out)

              def forward(self, x):
                  # Forward propagation
                  h1 = F.relu(self.layer1(x))
                  h2 = F.relu(self.layer2(h1))
                  return self.layer3(h2)

       Child links are registered via the assignment within a
       ``with self.init_scope():`` block. The forward propagation is often
       implemented as the ``forward`` operator as the above example, though
       it is not mandatory.

    Args:
        links: Child links. The keywords are used as their names. The names are
            also set to the links.

            .. deprecated:: v2.0.0

               Assign child links directly to attributes instead.

    """

    def __init__(self, **links):
        super(Chain, self).__init__()
        self._children = set()

        for name, link in six.iteritems(links):
            self.add_link(name, link)

    def __getitem__(self, name):
        """Equivalent to getattr."""
        return getattr(self, name)

    def __setattr__(self, name, value):
        if self.within_init_scope and isinstance(value, Link):
            if hasattr(self, name):
                raise AttributeError(
                    'cannot register a new link %s: attribute exists' % name)
            value.name = name
            self._children.add(name)
        super(Chain, self).__setattr__(name, value)

    def __delattr__(self, name):
        self._children.discard(name)
        super(Chain, self).__delattr__(name)

    def add_link(self, name, link):
        """Registers a child link to this chain.

        .. deprecated:: v2.0.0

           Assign the child link directly to an attribute within
           :meth:`~chainer.Chain.init_scope` instead.
           For example, the following code

           .. code-block:: python

              chain.add_link('l1', L.Linear(3, 5))

           can be replaced by the following line.

           .. code-block:: python

              with chain.init_scope():
                  chain.l1 = L.Linear(3, 5)

           The latter is easier for IDEs to keep track of the attribute's
           type.

        Args:
            name (str): Name of the child link. This name is also used as the
                attribute name.
            link (Link): The link object to be registered.

        """
        warnings.warn('''\
Child link registeration via Chain.__init__ and Chain.add_link are deprecated.
Assign a Link object directly to an attribute within a \
"with link.init_scope():" block instead.
        ''', DeprecationWarning)
        if name in self.__dict__:
            raise AttributeError(
                'cannot register a new link %s: attribute exists' % name)
        if not isinstance(link, Link):
            raise TypeError('cannot register a non-link object as a child')
        with self.init_scope():
            setattr(self, name, link)

    def copy(self, mode='share'):
        ret = super(Chain, self).copy()
        ret._children = set(ret._children)
        d = ret.__dict__
        for name in ret._children:
            # copy child links recursively
            copied = d[name].copy(mode)
            copied.name = name
            d[name] = copied
        return ret

    def to_cpu(self):
        super(Chain, self).to_cpu()
        d = self.__dict__
        for name in self._children:
            d[name].to_cpu()
        return self

    def to_gpu(self, device=None):
        with cuda._get_device(device):
            super(Chain, self).to_gpu()
            d = self.__dict__
            for name in self._children:
                d[name].to_gpu()
        return self

    def to_intel64(self):
        super(Chain, self).to_intel64()
        d = self.__dict__
        for name in self._children:
            d[name].to_intel64()
        return self

    def params(self, include_uninit=True):
        for param in super(Chain, self).params(include_uninit):
            yield param
        d = self.__dict__
        for name in self._children:
            for param in d[name].params(include_uninit):
                yield param

    def namedparams(self, include_uninit=True):
        for ret in super(Chain, self).namedparams(include_uninit):
            yield ret
        d = self.__dict__
        for name in self._children:
            prefix = '/' + name
            for path, param in d[name].namedparams(include_uninit):
                yield prefix + path, param

    def links(self, skipself=False):
        if not skipself:
            yield self
        d = self.__dict__
        for name in self._children:
            for link in d[name].links():
                yield link

    def namedlinks(self, skipself=False):
        if not skipself:
            yield '/', self
        d = self.__dict__
        for name in self._children:
            child = d[name]
            prefix = '/' + name
            yield prefix, child
            for path, link in d[name].namedlinks(True):
                yield prefix + path, link

    def children(self):
        d = self.__dict__
        for name in self._children:
            yield d[name]

    def copyparams(self, link, copy_persistent=True):
        super(Chain, self).copyparams(link, copy_persistent)
        src = link.__dict__
        dst = self.__dict__
        for name in self._children:
            dst[name].copyparams(src[name], copy_persistent)

    def addgrads(self, link):
        super(Chain, self).addgrads(link)
        src = link.__dict__
        dst = self.__dict__
        for name in self._children:
            dst[name].addgrads(src[name])

    def serialize(self, serializer):
        super(Chain, self).serialize(serializer)
        d = self.__dict__
        for name in self._children:
            d[name].serialize(serializer[name])

class ChainList(Link, collections.MutableSequence):

    """Composable link with list-like interface.

    This is another example of compositional link. Unlike :class:`Chain`, this
    class can be used like a list of child links. Each child link is indexed by
    a non-negative integer, and it maintains the current number of registered
    child links. The :meth:`add_link` method inserts a new link at the end of
    the list. It is useful to write a chain with arbitrary number of child
    links, e.g. an arbitrarily deep multi-layer perceptron.

    This class inherits the methods `index`, `count`, `append`, `reverse`,
    `extend`, `pop`, `remove` from `collections.abc.MutableSequence` and
    can be accessed and assigned by index or slice.

    Args:
        links: Initial child links.

    """

    def __init__(self, *links):
        super(ChainList, self).__init__()
        self._children = []

        for link in links:
            self.add_link(link)

    def __setattr__(self, name, value):
        if self.within_init_scope and isinstance(value, Link):
            raise TypeError(
                'cannot register a new link'
                ' within a "with chainlist.init_scope():" block.')
        super(ChainList, self).__setattr__(name, value)

    def __setitem__(self, index, value):
        if isinstance(index, int):
            value.name = str(index)
            self._children[index] = value
        elif isinstance(index, slice):
            self._children[index] = value
            for i, c in enumerate(self._children):
                c.name = str(i)
        else:
            raise TypeError(
                'ChainList indices must be integers or slices, not %s' %
                type(index).__name__)

    def __getitem__(self, index):
        """Returns the child at given index.

        Args:
            index (int): Index of the child in the list.

        Returns:
            Link: The ``index``-th child link.

        """
        return self._children[index]

    def __delitem__(self, index):
        del self._children[index]
        for i, c in enumerate(self._children):
            c.name = str(i)

    def insert(self, index, link):
        """Insert a child link at the given index.

        Args:
            index (int): The position of the list where the new
            link is inserted.
            link (Link): The link to be inserted.

        """
        if index == len(self._children):
            self._children.append(link)
            link.name = str(index)
        else:
            self._children.insert(index, link)
            for i, c in enumerate(self._children):
                c.name = str(i)

    def __iter__(self):
        return iter(self._children)

    def __len__(self):
        """Returns the number of children."""
        return len(self._children)

    def add_link(self, link):
        """Registers a child link and adds it to the tail of the list.

        Args:
            link (Link): The link object to be registered.

        """
        self.append(link)

    def copy(self, mode='share'):
        """Returns a deep copy of the chainlist."""
        ret = super(ChainList, self).copy()
        ret._children = list(ret._children)  # copy
        children = ret._children
        for i, child in enumerate(children):
            child = child.copy(mode)
            child.name = str(i)
            children[i] = child
        return ret

    def to_cpu(self):
        super(ChainList, self).to_cpu()
        for link in self._children:
            link.to_cpu()
        return self

    def to_gpu(self, device=None):
        with cuda._get_device(device):
            super(ChainList, self).to_gpu()
            for link in self._children:
                link.to_gpu()
        return self

    def to_intel64(self):
        super(ChainList, self).to_intel64()
        for link in self._children:
            link.to_intel64()
        return self

    def params(self, include_uninit=True):
        for param in super(ChainList, self).params(include_uninit):
            yield param
        for link in self._children:
            for param in link.params(include_uninit):
                yield param

    def namedparams(self, include_uninit=True):
        for ret in super(ChainList, self).namedparams(include_uninit):
            yield ret
        for idx, link in enumerate(self._children):
            prefix = '/%d' % idx
            for path, param in link.namedparams(include_uninit):
                yield prefix + path, param

    def links(self, skipself=False):
        if not skipself:
            yield self
        for child in self._children:
            for link in child.links():
                yield link

    def namedlinks(self, skipself=False):
        if not skipself:
            yield '/', self
        for idx, child in enumerate(self._children):
            prefix = '/%d' % idx
            yield prefix, child
            for path, link in child.namedlinks(True):
                yield prefix + path, link

    def children(self):
        for child in self._children:
            yield child

    def copyparams(self, link, copy_persistent=True):
        super(ChainList, self).copyparams(link, copy_persistent)
        for idx, child in enumerate(self._children):
            child.copyparams(link[idx], copy_persistent)

    def addgrads(self, link):
        super(ChainList, self).addgrads(link)
        for idx, child in enumerate(self._children):
            child.addgrads(link[idx])

    def serialize(self, serializer):
        super(ChainList, self).serialize(serializer)
        for idx, child in enumerate(self._children):
            child.serialize(serializer['%d' % idx])


text:
<?php

/* GestorDeProjecteBundle:Default:index.html.twig */
class __TwigTemplate_a27ec43ad75768991f184d6d039f8aa4e3cecdf337717f9f3f6b13e85f538788 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = false;

        $this->blocks = array(
            'title' => array($this, 'block_title'),
            'stylesheets' => array($this, 'block_stylesheets'),
            'body' => array($this, 'block_body'),
            'javascripts' => array($this, 'block_javascripts'),
        );
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        // line 1
        echo "<!DOCTYPE html>

    <meta charset=\"utf-8\">
    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">
    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
    <title>";
        // line 7
        $this->displayBlock('title', $context, $blocks);
        echo "</title>
    ";
        // line 8
        $this->displayBlock('stylesheets', $context, $blocks);
        // line 9
        echo "

    ";
        // line 12
        $this->displayBlock('body', $context, $blocks);
        // line 13
        echo "
    ";
        // line 14
        $this->displayBlock('javascripts', $context, $blocks);
        // line 15
        echo "

";
    }

    // line 7
    public function block_title($context, array $blocks = array())
    {
    }

    // line 8
    public function block_stylesheets($context, array $blocks = array())
    {
    }

    // line 12
    public function block_body($context, array $blocks = array())
    {
        echo "Hello Alba";
    }

    // line 14
    public function block_javascripts($context, array $blocks = array())
    {
    }

    public function getTemplateName()
    {
        return "GestorDeProjecteBundle:Default:index.html.twig";
    }

    public function getDebugInfo()
    {
        return array (  73 => 14,  67 => 12,  62 => 8,  57 => 7,  49 => 15,  47 => 14,  44 => 13,  42 => 12,  37 => 9,  35 => 8,  31 => 7,  23 => 1,);
    }

    /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
    public function getSource()
    {
        @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);

        return $this->getSourceContext()->getCode();
    }

    public function getSourceContext()
    {
        return new Twig_Source("", "GestorDeProjecteBundle:Default:index.html.twig", "C:\\xampp\\htdocs\\acCompany\\src\\GestorDeProjecteBundle/Resources/views/Default/index.html.twig");
    }
}


text:
html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    background-color: #EDEDED;
}

#wrapper {
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

#header {
    font-size: 3em;
}

#currentAttendance {
    font-size: 13em;
    font-weight: bold;
    margin-bottom: 0;
}

#buttons {
    display: flex;
    flex-direction: row;
    align-content: space-around;
}

#increment, #decrement {
    margin: 5px;
    margin-top: 0;
    font-size: 7em;
    cursor: pointer;
    border-radius: 5px;
}

#increment:hover, #decrement:hover {
    background-color: orange;
}

#increment:active, #decrement:active {
    background-color: #EE7600;
}

.unselectable {
   -moz-user-select: -moz-none;
   -khtml-user-select: none;
   -webkit-user-select: none;

   /*
     Introduced in IE 10.
     See http://ie.microsoft.com/testdrive/HTML5/msUserSelect/
   */
   -ms-user-select: none;
   user-select: none;
}


text:
//
//
//package org.apache.airavata.xbaya.interpretor;
//
//import java.util.List;
//
//public class ExperimentTemplate {
//	private List<WorkflowExecutionTemplate> workflowExecutionTemplates;
//
//	public List<WorkflowExecutionTemplate> getWorkflowExecutionTemplates() {
//		return workflowExecutionTemplates;
//	}
//
//	public void setWorkflowExecutionTemplates(
//			List<WorkflowExecutionTemplate> workflowExecutionTemplates) {
//		this.workflowExecutionTemplates = workflowExecutionTemplates;
//	}
//}