text:
<?php

/**
* <auto-generated>
*     This code was generated by Codezu.
*
*     Changes to this file may cause incorrect behavior and will be lost if
*     the code is regenerated.
* </auto-generated>
*/

namespace Mozu\Api\Clients\Commerce\Catalog\Admin\Products;

use Mozu\Api\MozuClient;
use Mozu\Api\Urls\Commerce\Catalog\Admin\Products\ProductOptionUrl;

use Mozu\Api\Headers;

/**
* Use the Options resource to configure the option attributes and vocabulary values for an individual product associated with the product type that uses the option attribute. Options are used to generate variations of a product.
*/
class ProductOptionClient {

	/**
	* Retrieves a list of all option attributes configured for the product specified in the request.
	*
	* @param string $productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only.
	* @return MozuClient
	*/
	public static function getOptionsClient($dataViewMode, $productCode)
	{
		$url = ProductOptionUrl::getOptionsUrl($productCode);
		$mozuClient = new MozuClient();
		$mozuClient->withResourceUrl($url)->withHeader(Headers::X_VOL_DATAVIEW_MODE ,$dataViewMode);
		return $mozuClient;

	}

	/**
	* Retrieves the details of an option attribute configuration for the specified product.
	*
	* @param string $attributeFQN The fully qualified name of the attribute, which is a user defined attribute identifier.
	* @param string $productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only.
	* @param string $responseFields Use this field to include those fields which are not included by default.
	* @return MozuClient
	*/
	public static function getOptionClient($dataViewMode, $productCode, $attributeFQN, $responseFields =  null)
	{
		$url = ProductOptionUrl::getOptionUrl($attributeFQN, $productCode, $responseFields);
		$mozuClient = new MozuClient();
		$mozuClient->withResourceUrl($url)->withHeader(Headers::X_VOL_DATAVIEW_MODE ,$dataViewMode);
		return $mozuClient;

	}

	/**
	* Configures an option attribute for the product specified in the request.
	*
	* @param string $productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only.
	* @param string $responseFields Use this field to include those fields which are not included by default.
	* @param ProductOption $productOption Properties of the product option to create such as attribute detail, fully qualified name, and list of product option values.
	* @return MozuClient
	*/
	public static function addOptionClient($dataViewMode, $productOption, $productCode, $responseFields =  null)
	{
		$url = ProductOptionUrl::addOptionUrl($productCode, $responseFields);
		$mozuClient = new MozuClient();
		$mozuClient->withResourceUrl($url)->withBody($productOption)->withHeader(Headers::X_VOL_DATAVIEW_MODE ,$dataViewMode);
		return $mozuClient;

	}

	/**
	* Updates one or more properties of an option attribute configured for a product.
	*
	* @param string $attributeFQN The fully qualified name of the attribute, which is a user defined attribute identifier.
	* @param string $productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only.
	* @param string $responseFields Use this field to include those fields which are not included by default.
	* @param ProductOption $productOption Properties of the product option to create such as attribute detail, fully qualified name, and list of product option values.
	* @return MozuClient
	*/
	public static function updateOptionClient($dataViewMode, $productOption, $productCode, $attributeFQN, $responseFields =  null)
	{
		$url = ProductOptionUrl::updateOptionUrl($attributeFQN, $productCode, $responseFields);
		$mozuClient = new MozuClient();
		$mozuClient->withResourceUrl($url)->withBody($productOption)->withHeader(Headers::X_VOL_DATAVIEW_MODE ,$dataViewMode);
		return $mozuClient;

	}

	/**
	* Deletes the configuration of an option attribute for the product specified in the request.
	*
	* @param string $attributeFQN The fully qualified name of the attribute, which is a user defined attribute identifier.
	* @param string $productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only.
	*/
	public static function deleteOptionClient($dataViewMode, $productCode, $attributeFQN)
	{
		$url = ProductOptionUrl::deleteOptionUrl($attributeFQN, $productCode);
		$mozuClient = new MozuClient();
		$mozuClient->withResourceUrl($url)->withHeader(Headers::X_VOL_DATAVIEW_MODE ,$dataViewMode);
		return $mozuClient;

	}

}

?>


text:
declare function require(path: string): string;
declare module App {

    interface IStringArray {
        [index: number]: string;
    }

    interface ILocale {
        numberFormat?: string;
    }

    interface IConfig {
        locale?: string;
        localisation?: ILocale;
        baseUrl?: string;
        basePath?: string;
        staticPath?: string
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.android.server.tv;

import android.os.Binder;
import android.os.IBinder;

import java.io.IOException;

import dalvik.system.CloseGuard;

/**
 * Sends the input event to the linux driver.
 */
public final class UinputBridge {
    private final CloseGuard mCloseGuard = CloseGuard.get();
    private long mPtr;
    private IBinder mToken = null;

    private static native long nativeOpen(String name, String uniqueId, int width, int height,
                                          int maxPointers);
    private static native void nativeClose(long ptr);
    private static native void nativeClear(long ptr);
    private static native void nativeSendTimestamp(long ptr, long timestamp);
    private static native void nativeSendKey(long ptr, int keyCode, boolean down);
    private static native void nativeSendPointerDown(long ptr, int pointerId, int x, int y);
    private static native void nativeSendPointerUp(long ptr, int pointerId);
    private static native void nativeSendPointerSync(long ptr);

    public UinputBridge(IBinder token, String name, int width, int height, int maxPointers)
                        throws IOException {
        if (width < 1 || height < 1) {
            throw new IllegalArgumentException("Touchpad must be at least 1x1.");
        }
        if (maxPointers < 1 || maxPointers > 32) {
            throw new IllegalArgumentException("Touchpad must support between 1 and 32 pointers.");
        }
        if (token == null) {
            throw new IllegalArgumentException("Token cannot be null");
        }
        mPtr = nativeOpen(name, token.toString(), width, height, maxPointers);
        if (mPtr == 0) {
            throw new IOException("Could not open uinput device " + name);
        }
        mToken = token;
        mCloseGuard.open("close");
    }

    @Override
    protected void finalize() throws Throwable {
        try {
            if (mPtr != 0) {
                mCloseGuard.warnIfOpen();
            }
            close(mToken);
        } finally {
            mToken = null;
            super.finalize();
        }
    }

    public void close(IBinder token) {
        if (isTokenValid(token)) {
            if (mPtr != 0) {
                clear(token);
                nativeClose(mPtr);

                mPtr = 0;
                mCloseGuard.close();
            }
        }
    }

    public IBinder getToken() {
        return mToken;
    }

    protected boolean isTokenValid(IBinder token) {
        return mToken.equals(token);
    }

    public void sendTimestamp(IBinder token, long timestamp) {
        if (isTokenValid(token)) {
            nativeSendTimestamp(mPtr, timestamp);
        }
    }

    public void sendKeyDown(IBinder token, int keyCode) {
        if (isTokenValid(token)) {
            nativeSendKey(mPtr, keyCode, true /*down*/);
        }
    }

    public void sendKeyUp(IBinder token, int keyCode) {
        if (isTokenValid(token)) {
            nativeSendKey(mPtr, keyCode, false /*down*/);
        }
    }

    public void sendPointerDown(IBinder token, int pointerId, int x, int y) {
        if (isTokenValid(token)) {
            nativeSendPointerDown(mPtr, pointerId, x, y);
        }
    }

    public void sendPointerUp(IBinder token, int pointerId) {
        if (isTokenValid(token)) {
            nativeSendPointerUp(mPtr, pointerId);
        }
    }

    public void sendPointerSync(IBinder token) {
        if (isTokenValid(token)) {
            nativeSendPointerSync(mPtr);
        }

    }

    public void clear(IBinder token) {
        if (isTokenValid(token)) {
            nativeClear(mPtr);
        }
    }

}


text:
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System.IO;

namespace Semmle.Extraction.CSharp.Entities
{
    internal abstract class Expression<TExpressionSyntax> : Expression
        where TExpressionSyntax : ExpressionSyntax
    {
        public TExpressionSyntax Syntax { get; }

        protected Expression(ExpressionNodeInfo info)
            : base(info)
        {
            Syntax = (TExpressionSyntax)info.Node;
        }

        ///
        /// Populates expression-type specific relations in the trap file. The general relations
        /// expressions and expr_location are populated by the constructor
        /// (should not fail), so even if expression-type specific population fails (e.g., in
        /// standalone extraction), the expression created via
        /// <see cref="Expression.Create(Context, ExpressionSyntax, IEntity, int, ITypeSymbol)"/> will
        /// still be valid.
        ///
        protected abstract void PopulateExpression(TextWriter trapFile);

        protected new Expression TryPopulate()
        {
            Context.Try(Syntax, null, () => PopulateExpression(Context.TrapWriter.Writer));
            return this;
        }
    }
}


text:
from __future__ import absolute_import

# Base class for objects, building on GMOC code

from .gmoc import GMOCObject, validateText

class GENIObject(GMOCObject):
    def __init__(self):
        pass
        # Could do this but really don't want anything but id
        # return super(GENIObject, self).__init__(id)
#        self.id = id

    def __str__(self):
        retVal = ""+str(self.__class__.__name__)
        if self.__dict__.has_key('__id'):
            retVal +="( "+str(self.__dict__['__id'])+" )"
        for key, value in self.__dict__.items():
            if key == "__id":
                continue
            retVal += "\n  "+str(key)+" : "+str(value)+""
        return retVal

# overwriting
def validateTextLike(urn):
    return str(urn)


text:
package dao;

import java.util.List;
import java.util.Map;

import dao.GenericJPADAO.QueryType;

public interface GenericDAO {

	public Object save(Object entity);

	public void delete(Object entity);

	public Object find(Class entityClass, Object id);

	public List find(Class entityClass);

	public List find(Class entityClass, int firstResult, int maxResults);

	public List find(String queryName);

	public List find(String queryName, Map<String, Object> namedParams);

	public List find(String queryName, Map<String, Object> namedParams,
						int firstResult, int maxResults);

	public List find(QueryType type, String query,
						Map<String,Object> namedParams,
							int firstResult, int maxResults);

	public int execute(String comando);
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
in Duss, Enum. Champ. Guadeloupe (Lons-le-Saunier) (1903)

#### Original name
Erinella subcorticalis Pat.

### Remarks
null


text:
package com.lieverandiver.thesisproject;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.ToggleButton;

import com.lieverandiver.thesisproject.adapter.ClassAdapter;
import com.lieverandiver.thesisproject.fragment.Home_Student_Slidebar_Fragment;
import com.lieverandiver.thesisproject.fragment.SliderClassFragment;
import com.lieverandiver.thesisproject.fragment.SliderScheduleFragment;
import com.lieverandiver.thesisproject.fragment.SliderSettingFragment;
import com.remswork.project.alice.model.Teacher;

import java.util.ArrayList;
import java.util.List;

public class MainActivity2 extends AppCompatActivity implements ClassAdapter.ClassAdapterListener,
        SliderSettingFragment.OnProfileClickListener, CompoundButton.OnCheckedChangeListener {

    private static final String TAG = MainActivity2.class.getSimpleName();

    private Button btnBack;
    private ToggleButton btnSearch;
    private Button btnSearchOk;
    private Button btnSearchCancel;
    private EditText editTextSearch;
    private FrameLayout frameLayoutSearch;

    private TabLayout tabLayout;
    private ViewPager viewPager;
    private int[] tabIcons = {
            R.drawable.small_schedule,
            R.drawable.small_class,
            R.drawable.small_home,
            R.drawable.small_home
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Log.i(TAG, "onCreate");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        btnSearch = (ToggleButton) findViewById(R.id.btn_search_class);
        btnSearchOk = (Button) findViewById(R.id._btn_search_ok_class);
        btnBack = (Button) findViewById(R.id.btn_back_student);

        editTextSearch = (EditText) findViewById(R.id.etxt_search_class);
        frameLayoutSearch = (FrameLayout) findViewById(R.id.frame_search_class);
        tabLayout = (TabLayout) findViewById(R.id.tabs);
        viewPager = (ViewPager) findViewById(R.id.viewpager);
        setupViewPager(viewPager);
        tabLayout.setupWithViewPager(viewPager);
        setupTabIcons();

        frameLayoutSearch.setVisibility(View.GONE);
        btnSearch.setOnCheckedChangeListener(this);

    }

    @Override
    protected void onDestroy() {
        Log.i(TAG, "onDestroy");
        super.onDestroy();

        btnSearch = null;
        btnSearchOk = null;
        btnBack = null;

        editTextSearch = null;
        frameLayoutSearch = null;
        tabLayout = null;
        viewPager = null;

    }

    private void setupTabIcons() {

        TextView tabOne = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
        tabOne.setText("Schedule");
        tabOne.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.small_schedule, 0, 0);
        tabLayout.getTabAt(0).setCustomView(tabOne);

        TextView tabTwo = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
        tabTwo.setText("Class");
        tabTwo.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.small_class, 0, 0);
        tabLayout.getTabAt(1).setCustomView(tabTwo);

        TextView tabThree = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
        tabThree.setText("Student");
        tabThree.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.small_home, 0, 0);
        tabLayout.getTabAt(2).setCustomView(tabThree);

        TextView tabFour = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
        tabFour.setText("Setting");
        tabFour.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.small_home, 0, 0);
        tabLayout.getTabAt(3).setCustomView(tabFour);
    }

    private void setupViewPager(ViewPager viewPager) {
        ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
        adapter.addFragment(new SliderScheduleFragment(), "Shedule");
        adapter.addFragment(new SliderClassFragment(), "Class");
        adapter.addFragment(new Home_Student_Slidebar_Fragment(), "Student");
        adapter.addFragment(new SliderSettingFragment(), "Setting");
        viewPager.setAdapter(adapter);
    }

    @Override
    public void showClassView(final long classId) {
        final Intent intent = new Intent(this, ClassViewActivity.class);
        intent.putExtra("classId", classId);
        startActivity(intent);
    }

    @Override
    public void viewProfile(final Teacher teacher) {
        final Intent intent = new Intent(this, TeacherViewActivity.class);
        intent.putExtra("teacherId", teacher.getId());
        startActivity(intent);
    }

    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        if (isChecked) {
            frameLayoutSearch.setVisibility(View.VISIBLE);
            tabLayout.setVisibility(View.GONE);
        } else {
            frameLayoutSearch.setVisibility(View.GONE);
            tabLayout.setVisibility(View.VISIBLE);
        }
    }

    class ViewPagerAdapter extends FragmentPagerAdapter {
        private final List<Fragment> mFragmentList = new ArrayList<>();
        private final List<String> mFragmentTitleList = new ArrayList<>();

        ViewPagerAdapter(FragmentManager manager) {
            super(manager);
        }

        @Override
        public Fragment getItem(int position) {
            return mFragmentList.get(position);
        }

        @Override
        public int getCount() {
            return mFragmentList.size();
        }

        void addFragment(Fragment fragment, String title) {
            mFragmentList.add(fragment);
            mFragmentTitleList.add(title);
        }

        @Override
        public CharSequence getPageTitle(int position) {
            return mFragmentTitleList.get(position);
        }
    }

}


text:
"""Ops and modules related to proto.

@@decode_proto
@@encode_proto
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.contrib.proto.python.ops.decode_proto_op import decode_proto
from tensorflow.contrib.proto.python.ops.encode_proto_op import encode_proto

from tensorflow.python.util.all_util import remove_undocumented
remove_undocumented(__name__)


text: export { default } from './wp2_enc';


text:
package org.jkiss.dbeaver.ui.dialogs;

import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.jkiss.dbeaver.core.CoreMessages;
import org.jkiss.dbeaver.model.data.DBDDataFormatterProfile;
import org.jkiss.dbeaver.registry.formatter.DataFormatterRegistry;
import org.jkiss.dbeaver.ui.UIUtils;

import java.util.List;

/**
* DataFormatProfilesEditDialog
*/
public class DataFormatProfilesEditDialog extends org.eclipse.jface.dialogs.Dialog {
    private static final int NEW_ID = IDialogConstants.CLIENT_ID + 1;
    private static final int DELETE_ID = IDialogConstants.CLIENT_ID + 2;
    private org.eclipse.swt.widgets.List profileList;

    public DataFormatProfilesEditDialog(Shell parentShell)
    {
        super(parentShell);
    }

    @Override
    protected boolean isResizable()
    {
        return true;
    }

    @Override
    protected Control createDialogArea(Composite parent)
    {
        getShell().setText(CoreMessages.dialog_data_format_profiles_title);

        Composite group = new Composite(parent, SWT.NONE);
        group.setLayout(new GridLayout(1, false));
        group.setLayoutData(new GridData(GridData.FILL_BOTH));

        profileList = new org.eclipse.swt.widgets.List(group, SWT.SINGLE | SWT.BORDER);
        GridData gd = new GridData(GridData.FILL_BOTH);
        gd.widthHint = 300;
        gd.heightHint = 200;
        profileList.setLayoutData(gd);

        profileList.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e)
            {
                getButton(DELETE_ID).setEnabled(profileList.getSelectionIndex() >= 0);
            }
        });

        loadProfiles();
        return parent;
    }

    @Override
    protected void createButtonsForButtonBar(Composite parent)
    {
        createButton(parent, NEW_ID, CoreMessages.dialog_data_format_profiles_button_new_profile, false);
        createButton(parent, DELETE_ID, CoreMessages.dialog_data_format_profiles_button_delete_profile, false);
        createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);

        getButton(DELETE_ID).setEnabled(false);
    }

    @Override
    protected void buttonPressed(int buttonId)
    {
        DataFormatterRegistry registry = DataFormatterRegistry.getInstance();
        if (buttonId == NEW_ID) {
            String profileName = EnterNameDialog.chooseName(getShell(), CoreMessages.dialog_data_format_profiles_dialog_name_chooser_title);
            if (registry.getCustomProfile(profileName) != null) {
                UIUtils.showMessageBox(
                        getShell(),
                        CoreMessages.dialog_data_format_profiles_error_title,
                        NLS.bind(CoreMessages.dialog_data_format_profiles_error_message, profileName), SWT.ICON_ERROR);
            } else {
                registry.createCustomProfile(profileName);
                loadProfiles();
            }
        } else if (buttonId == DELETE_ID) {
            int selectionIndex = profileList.getSelectionIndex();
            if (selectionIndex >= 0) {
                DBDDataFormatterProfile profile = registry.getCustomProfile(profileList.getItem(selectionIndex));
                if (profile != null) {
                    if (UIUtils.confirmAction(
                            getShell(),
                            CoreMessages.dialog_data_format_profiles_confirm_delete_title,
                            CoreMessages.dialog_data_format_profiles_confirm_delete_message)) {
                        registry.deleteCustomProfile(profile);
                        loadProfiles();
                    }
                }
            }
        } else {
            super.buttonPressed(buttonId);
        }
    }

    private void loadProfiles()
    {
        profileList.removeAll();
        List<DBDDataFormatterProfile> profiles = DataFormatterRegistry.getInstance().getCustomProfiles();
        for (DBDDataFormatterProfile profile : profiles) {
            profileList.add(profile.getProfileName());
        }
        Button deleteButton = getButton(DELETE_ID);
        if (deleteButton != null) {
            deleteButton.setEnabled(false);
        }
    }
}


text:
<!--
Copyright (C) 2007 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<strings>
<PLUGIN_ABOUT>Calculator gadget
Copyright 2007 Google Inc. All Rights Reserved.
A nice new calculator never far from your desktop. Use it with a standard keyboard layout.
</PLUGIN_ABOUT>
<PLUGIN_DESCRIPTION>Our calculator is never too far from your desktop</PLUGIN_DESCRIPTION>
<PLUGIN_NAME>Calculator gadget</PLUGIN_NAME>
<SQRT_ERROR>SQRT cannot run for negative numbers</SQRT_ERROR>
<E_DZERO>Cannot divide by Zero</E_DZERO>
<E_RLARGE>Result too large.</E_RLARGE>
<E_DOMAIN>Invalid domain for function</E_DOMAIN>

<E_EXP_DOMAIN>Cannot take the log of a negative or zero value.</E_EXP_DOMAIN>
<E_SINCOS_DOMAIN>Sin/Cos inverse requires the value to be between -1 and +1</E_SINCOS_DOMAIN>
<E_FACT_DOMAIN>Cannot find factorial of a negative number.</E_FACT_DOMAIN>
<E_SQRT_DOMAIN>Cannot find square root of a negative number.</E_SQRT_DOMAIN>
<E_INV_DOMAIN>Cannot find 1/0.</E_INV_DOMAIN>

<E_SYSTEM>Internal System Error has occurred</E_SYSTEM>
<E_NLARGE>Number too large. Changing base and display to scientific notation.</E_NLARGE>
<E_RORANGE>Result out of range</E_RORANGE>

<TT_CE>Clears current calculations</TT_CE>
<TT_C>Clears current calculations and clears the memory</TT_C>
<TT_DEL>Removes the last inserted digit</TT_DEL>
<TT_MC>Clears the memory</TT_MC>
<TT_PLUSMINUS>Changes the sign of the displayed value</TT_PLUSMINUS>
<TT_MR>Read from memory into display</TT_MR>
<TT_MS>Stores the display into memory</TT_MS>
<TT_PERCENT>Calculates the percent of the previous value. eg: 5+20% prints 1.</TT_PERCENT>
<TT_MPLUS>Adds the displayed value to memory</TT_MPLUS>
<TT_DMS>Converts the given number into deg-min-secs format. If the inverse flag is set, it assumes the input to be in that format and converts it into decimal.</TT_DMS>
<TT_EXPONENT>Lets you specify the exponent part of the number. eg: 3E2 will be 300.</TT_EXPONENT>
<TT_FE>Toggles the display system to/from scientific mode. eg: 300 is displayed as 3E2.</TT_FE>
<TT_LN>Finds the natural logarithm (euler's base) of the given number(x). If the inverse flag is set, finds e^x.</TT_LN>
<TT_LOG>Finds the base-10 logarithm of the given number(x). If the inverse flag is set, finds 10^x.</TT_LOG>

<TT_AND>Finds the bitwise AND of two given numbers. Does rounding off before the operation.</TT_AND>
<TT_OR>Finds the bitwise OR of two given numbers. Does rounding off before the operation.</TT_OR>
<TT_XOR>Finds the bitwise XOR of two given numbers. Does rounding off before the operation.</TT_XOR>
<TT_LSH>Shifts the former number to the latter number bits left.</TT_LSH>
<TT_NOT>Finds the bitwise complement of the given number. Before the operation rounds the number and chooses minimal number of bits to represent it.</TT_NOT>
<TT_PI>Inserts the value of PI into the display.</TT_PI>
<TT_INT>Truncates the given number.</TT_INT>
<TT_MOD>Takes the remainder of the division operation.</TT_MOD>

<EXPR_RULES>Type in  the expression and press enter. You can store variable values from A to Z.
In addition u can use math function like sin, cos etc.</EXPR_RULES>
</strings>


text:
require "choice"

Hash.class_eval do
  # Fix deprecation warning in Choice.
  alias_method :index, :key if method_defined? :key
end

Choice.options do
  separator ""
  separator "Diagram options:"

  option :title do
    long "--title=TITLE"
    desc "Replace default diagram title with a custom one."
  end

  option :notation do
    long "--notation=STYLE"
    desc "Diagram notation style, one of simple, bachman, uml or crowsfoot."
    default "simple"
  end

  separator ""
  separator "Output options:"

  option :filename do
    long "--filename=FILENAME"
    desc "Basename of the output diagram."
    default "erd"
  end

  option :filetype do
    long "--filetype=TYPE"
    desc "Output file type. Available types depend on the diagram renderer."
    default "pdf"
  end

  option :open do
    long "--open"
    desc "Open the output file after it has been saved."
  end

  separator ""
  separator "Common options:"

  option :help do
    long "--help"
    desc "Display this help message."
  end

  option :version do
    short "-v"
    long "--version"
    desc "Show version and quit."
    action do
      require "rails_erd/version"
      $stderr.puts RailsERD::BANNER
      exit
    end
  end

  # Remaining options:
  # :attributes, :content,
  # :disconnected, true,
  ## :filename, "erd",
  ## :filetype, :pdf,
  # :indirect, true,
  # :inheritance, false,
  # :markup, true,
  ## :notation, :simple,
  # :orientation, :horizontal,
  # :polymorphism, false,
  # :warn, true,
  ## :title, true
end

module RailsERD
  class CLI
    attr_reader :path, :options

    class << self
      def start
        path = Choice.rest.first || Dir.pwd
        options = Choice.choices.each_with_object({}) { |(k, v), o| o[k.to_sym] = v }
        new(path, options).start
      end
    end

    def initialize(path, options)
      @path, @options = path, options
      require "rails_erd/diagram/graphviz"
    end

    def start
      load_application
      load_models
      create_diagram
    end

    private

    def load_application
      $stderr.puts "Loading application in '#{File.basename(path)}'..."
      require "#{path}/config/environment"
    end

    def load_models
      $stderr.puts "Loading code in search of models..."
      Rails.application.eager_load!
    end

    def create_diagram
      file = RailsERD::Diagram::Graphviz.create(options)
      $stderr.puts "Diagram saved to '#{file}'."
      `open #{file}` if options[:open]
    end
  end
end


text:
using UnityEngine;
using System.Collections.Generic;

namespace HutongGames.PlayMaker.Actions
{
	[ActionCategory(ActionCategory.GUILayout)]
	[Tooltip("Close a group started with BeginVertical.")]
	public class GUILayoutEndVertical : FsmStateAction
	{
		public override void Reset()
		{
		}

		public override void OnGUI()
		{
			GUILayout.EndVertical();
		}
	}
}


text:
@interface WDAsyncImageThumbnail ()

- (void)WD_cacheImage:(CGImageRef)aImage self:(WDAsyncImageThumbnail *)aSelf;

- (CGImageRef)WD_getImageFromCacheSelf:(WDAsyncImageThumbnail *)aSelf;

- (void)WD_scheduleAsyncLoadWithCompletionBlock:(void (^)(CGImageRef aImageRef, NSError *aError))aBlock;

- (void)WD_runCallbackBlock:(void (^)(CGImageRef aImageRef, NSError *aError))aBlock
                 syncObject:(id)aSyncObj
                    picture:(CGImageRef)aPic
                      error:(NSError *)aErr;

- (BOOL)WD_handleLoadCancellation:(id)syncObj;
@end

@implementation WDAsyncImageThumbnail{
    BOOL isCancelled;
}

#pragma mark - Initialization and backend

+ (void)initialize{

    if( self == [WDAsyncImageThumbnail class] ){
        [[self class] setDispatchGroup:[[self class] defaultDispatchGroup]];
        [[self class] initDispatchSemaphore];
    }
}

static dispatch_group_t dispatchGroup;
static dispatch_semaphore_t loadSemaphore;

+ (void)initDispatchSemaphore{

    @synchronized(self){
        static dispatch_once_t dOnceTok;
        dispatch_once(&dOnceTok, ^{
            loadSemaphore = dispatch_semaphore_create(wdCollectionLoadingThreads);
        });
    }
}

+ (dispatch_semaphore_t)dispatchSemaphore{

    @synchronized(self){
        return loadSemaphore;
    }
}

+ (dispatch_group_t)defaultDispatchGroup{

    static dispatch_once_t dOnceToken;
    static dispatch_group_t defaultGroup;
    dispatch_once(&dOnceToken, ^{
        defaultGroup = dispatch_group_create();
    });

    return defaultGroup;
}

+ (void)setDispatchGroup:(dispatch_group_t)aDispatchGroup{

    @synchronized(self){
        dispatchGroup = aDispatchGroup;
    }
}

+ (dispatch_group_t)dispatchGroup{

    @synchronized(self){
        return dispatchGroup;
    }
}

- (instancetype)initWithImageCache:(NSCache *)imageCache imageURL:(NSURL *)imageURL{

    self = [super init];
    if( self ){
        _imageCache = imageCache;
        _imageURL = imageURL;
        _imageState = WD_TLI_IDLE;
        isCancelled = NO;
    }

    return self;
}

+ (instancetype)imageWithImageCache:(NSCache *)imageCache imageURL:(NSURL *)imageURL{

    return [[self alloc] initWithImageCache:imageCache imageURL:imageURL];
}

#pragma mark - Interface

- (void)cancelLoad{

    WDThreadLoadedImageState state;
    @synchronized(self){
        state = _imageState;
        isCancelled = YES;
    }
    NSLog(@"Image order to cancell. Image state during cancel was: %lu", state);
}

- (void)releaseImage{

    @synchronized(self){
        CGImageRef im;
        if( (im = [self WD_getImageFromCacheSelf:self]) ){
            [self.imageCache removeObjectForKey:[self.imageURL absoluteString]];
            CGImageRelease(im);
        }
    }
}

- (void)loadImageWithCallbackBlock:(void (^)(CGImageRef aImageRef, NSError *aError))aBlock{

    @synchronized(self){
        switch(_imageState){
            case WD_TLI_IDLE:{
                isCancelled = NO;
                CGImageRef pCGImage = [self WD_getImageFromCacheSelf:self];
                if( pCGImage ){
                    NSLog(@"Image already in cache. No need to load.url=%@", [self.imageURL lastPathComponent]);
                    _imageState = WD_TLI_LOAD_COMPLETED;
                    aBlock(pCGImage, nil);
                    return;
                }

                NSLog(@"scheduling a load.pic=%@", [self.imageURL lastPathComponent]);
                _imageState = WD_TLI_LOAD_SCHEDULED;
                [self WD_scheduleAsyncLoadWithCompletionBlock:aBlock];
                break;
            }
            case WD_TLI_LOAD_COMPLETED:{
                NSLog(@"Load complete. Getting image from cache and calling back.");
                CGImageRef pImage = [self WD_getImageFromCacheSelf:self];
                aBlock(pImage, nil);
                break;
            }
            case WD_TLI_LOAD_SCHEDULED:{
                NSLog(@"Load is already scheduled. Leaving.");
                break;
            }
            default:{
                NSLog(@"Unknown state. Will raise an exception.");
                [NSException raise:@"unknown state" format:@"unknown state"];
            }
        }
    }
}

#pragma mark - Private methods

- (void)WD_cacheImage:(CGImageRef)aImage self:(WDAsyncImageThumbnail *)aSelf{

//    [aSelf.imageCache setObject:CFBridgingRelease(aImage) forKey:[aSelf.imageURL absoluteString]];
    [aSelf.imageCache setObject:(__bridge id) aImage forKey:[aSelf.imageURL absoluteString]];
}

- (CGImageRef)WD_getImageFromCacheSelf:(WDAsyncImageThumbnail *)aSelf{

    return (__bridge CGImageRef) [aSelf.imageCache objectForKey:[aSelf.imageURL absoluteString]];
}

static int64_t testC = 0;

- (void)WD_scheduleAsyncLoadWithCompletionBlock:(void (^)(CGImageRef aImageRef, NSError *aError))aBlock{

    __weak WDAsyncImageThumbnail *weakSelf = self;
    dispatch_group_async([[self class] dispatchGroup], dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0)
            , ^{

                if( !weakSelf ){
                    NSLog(@"Seems that the photo object has been deallocated before load started. Leaving..");
                    //fuck the status, object already dead
                    return;
                }

                WDAsyncImageThumbnail *strongSelf = weakSelf;
                if( [strongSelf WD_handleLoadCancellation:strongSelf] ){return;}

                CGImageRef pic = NULL;
                NSError *error;
                dispatch_semaphore_t dSema = [[strongSelf class] dispatchSemaphore];
                dispatch_semaphore_wait(dSema, DISPATCH_TIME_FOREVER);
                OSAtomicIncrement64Barrier(&testC);
                NSLog(@"load counter start=%lld", testC);
                @try{
                    if( [strongSelf WD_handleLoadCancellation:strongSelf] ){return;}

                    __block BOOL continueLoad = YES;
                    if( strongSelf.delegate
                        && [strongSelf.delegate respondsToSelector:@selector(imageWillLoad:)] ){
                        dispatch_sync(dispatch_get_main_queue(), ^{
                            continueLoad = [strongSelf.delegate imageWillLoad:strongSelf];
                        });
                    }
                    @synchronized(strongSelf){
                        if( !continueLoad ){
                            NSLog(@"delagate said to stop the load. Cancelling..");
                            isCancelled = YES;
                            if( [strongSelf WD_handleLoadCancellation:strongSelf] ){return;}
                        }
                    }

                    NSLog(@"actual load will start for pic=%@", [strongSelf.imageURL lastPathComponent]);
                    if( [WDThumbnailDataUtils isFilePhoto:strongSelf.imageURL] ){
                        NSError *imageLoadErr;
                        pic = [WDThumbnailDataUtils newThumbnailForImage:strongSelf.imageURL
                                                    heigth:wdCollectionThumbnailMaxSize
                                                    error:&imageLoadErr];
                        if( imageLoadErr ) error = imageLoadErr;
                    }else if( [WDThumbnailDataUtils isFileVideo:strongSelf.imageURL] ){
                        NSError *videoLoadErr;
                        pic = [WDThumbnailDataUtils newThumbnailForVideo:strongSelf.imageURL error:&videoLoadErr];
                        if( videoLoadErr ) error = videoLoadErr;
                    }else{
                        NSLog(@"File neither photo nor video. File url=%@", strongSelf.imageURL);
                        error = [NSError errorWithDomain:WD_ASYNC_IMAGE_ERROR_DOMAIN code:-1 userInfo:nil];
                    }
                }@finally{
                    dispatch_semaphore_signal(dSema);
                    NSLog(@"actual load did finish for pic=%@", [strongSelf.imageURL lastPathComponent]);
                    OSAtomicDecrement64Barrier(&testC);
                    NSLog(@"load counter finish=%lld", testC);
                }

                if( !pic && !error ){
                    NSAssert(NO, @"Fucked up!");
                }

                if( pic ){
                    [strongSelf WD_cacheImage:pic self:strongSelf];
                    NSLog(@"Image cached");
                }

                if( [strongSelf WD_handleLoadCancellation:strongSelf] ){return;}
                _imageState = WD_TLI_LOAD_COMPLETED;

                [strongSelf WD_runCallbackBlock:aBlock syncObject:strongSelf picture:pic error:error];
            });
}

- (void)WD_runCallbackBlock:(void (^)(CGImageRef aImageRef, NSError *aError))aBlock
                 syncObject:(id)aSyncObj
                    picture:(CGImageRef)aPic
                      error:(NSError *)aErr{

    @synchronized(aSyncObj){
        if( [NSThread isMainThread] ){
            aBlock(aPic, aErr);
        }else{
            dispatch_async(dispatch_get_main_queue(), ^{
                @synchronized(aSyncObj){
                    if( !isCancelled ){
                        aBlock(aPic, aErr);
                    }else{
                        NSLog(@"Image load cancelled when block was waiting to run actual callback.Url=%@"
                                , [((WDAsyncImageThumbnail *) aSyncObj).imageURL lastPathComponent]);
                    }
                }
            });
        }
    }
}

- (BOOL)WD_handleLoadCancellation:(id)syncObj{

    @synchronized(syncObj){
        BOOL initIsCancelled = isCancelled;
        if( isCancelled ){
            NSLog(@"image load cancelled.Url=%@"
                    , [((WDAsyncImageThumbnail *) syncObj).imageURL lastPathComponent]);
            isCancelled = NO;
            _imageState = WD_TLI_IDLE;
        }
        return initIsCancelled;
    }
}

- (void)dealloc{

    NSLog(@"deallocating image: %@", [self.imageURL lastPathComponent]);
}

@end


text:
import Apple2IO from './apple2io';
import {
    HiresPage,
    LoresPage,
    VideoModes,
    VideoModesState,
} from './videomodes';
import {
    HiresPage2D,
    LoresPage2D,
    VideoModes2D,
} from './canvas';
import {
    HiresPageGL,
    LoresPageGL,
    VideoModesGL,
} from './gl';
import ROM from './roms/rom';
import { Apple2IOState } from './apple2io';
import CPU6502, {
    CpuState,
    FLAVOR_6502,
    FLAVOR_ROCKWELL_65C02,
} from './cpu6502';
import MMU, { MMUState } from './mmu';
import RAM, { RAMState } from './ram';

import SYMBOLS from './symbols';
import Debugger, { DebuggerContainer } from './debugger';

import { ReadonlyUint8Array, Restorable, rom } from './types';
import { processGamepad } from './ui/gamepad';

export interface Apple2Options {
    characterRom: string;
    enhanced: boolean;
    e: boolean;
    gl: boolean;
    rom: string;
    canvas: HTMLCanvasElement;
    tick: () => void;
}

export interface Stats {
    cycles: number;
    frames: number;
    renderedFrames: number;
}

export interface State {
    cpu: CpuState;
    vm: VideoModesState;
    io: Apple2IOState;
    mmu: MMUState | undefined;
    ram: RAMState[] | undefined;
}

export class Apple2 implements Restorable<State>, DebuggerContainer {
    private paused = false;

    private theDebugger: Debugger | undefined;

    private runTimer: number | null = null;
    private runAnimationFrame: number | null = null;
    private cpu: CPU6502;

    private gr: LoresPage;
    private gr2: LoresPage;
    private hgr: HiresPage;
    private hgr2: HiresPage;
    private vm: VideoModes;

    private io: Apple2IO;
    private mmu: MMU | undefined;
    private ram: [RAM, RAM, RAM] | undefined;
    private characterRom: rom;
    private rom: ROM;

    private tick: () => void;

    private stats: Stats = {
        cycles: 0,
        frames: 0,
        renderedFrames: 0
    };

    public ready: Promise<void>;

    constructor(options: Apple2Options) {
        this.ready = this.init(options);
    }

    async init(options: Apple2Options) {
        const romImportPromise = import(`./roms/system/${options.rom}`) as Promise<{ default: new () => ROM }>;
        const characterRomImportPromise = import(`./roms/character/${options.characterRom}`) as Promise<{ default: ReadonlyUint8Array }>;

        const LoresPage = options.gl ? LoresPageGL : LoresPage2D;
        const HiresPage = options.gl ? HiresPageGL : HiresPage2D;
        const VideoModes = options.gl ? VideoModesGL : VideoModes2D;

        this.cpu = new CPU6502({
            flavor: options.enhanced ? FLAVOR_ROCKWELL_65C02 : FLAVOR_6502
        });
        this.vm = new VideoModes(options.canvas, options.e);

        const [{ default: Apple2ROM }, { default: characterRom }] = await Promise.all([
            romImportPromise,
            characterRomImportPromise,
            this.vm.ready,
        ]);

        this.rom = new Apple2ROM();
        this.characterRom = characterRom;

        this.gr = new LoresPage(this.vm, 1, this.characterRom, options.e);
        this.gr2 = new LoresPage(this.vm, 2, this.characterRom, options.e);
        this.hgr = new HiresPage(this.vm, 1);
        this.hgr2 = new HiresPage(this.vm, 2);
        this.io = new Apple2IO(this.cpu, this.vm);
        this.tick = options.tick;

        if (options.e) {
            this.mmu = new MMU(this.cpu, this.vm, this.gr, this.gr2, this.hgr, this.hgr2, this.io, this.rom);
            this.cpu.addPageHandler(this.mmu);
        } else {
            this.ram = [
                new RAM(0x00, 0x03),
                new RAM(0x0C, 0x1F),
                new RAM(0x60, 0xBF)
            ];

            this.cpu.addPageHandler(this.ram[0]);
            this.cpu.addPageHandler(this.gr);
            this.cpu.addPageHandler(this.gr2);
            this.cpu.addPageHandler(this.ram[1]);
            this.cpu.addPageHandler(this.hgr);
            this.cpu.addPageHandler(this.hgr2);
            this.cpu.addPageHandler(this.ram[2]);
            this.cpu.addPageHandler(this.io);
            this.cpu.addPageHandler(this.rom);
        }
    }

    /**
     * Runs the emulator. If the emulator is already running, this does
     * nothing. When this function exits either `runTimer` or
     * `runAnimationFrame` will be non-null.
     */
    run() {
        this.paused = false;
        if (this.runTimer || this.runAnimationFrame) {
            return; // already running
        }

        this.theDebugger = new Debugger(this.cpu, this);
        this.theDebugger.addSymbols(SYMBOLS);

        const interval = 30;

        let now, last = Date.now();
        const runFn = () => {
            const kHz = this.io.getKHz();
            now = Date.now();

            const stepMax = kHz * interval;
            let step = (now - last) * kHz;
            last = now;
            if (step > stepMax) {
                step = stepMax;
            }

            if (this.theDebugger) {
                this.theDebugger.stepCycles(step);
            } else {
                this.cpu.stepCycles(step);
            }
            if (this.mmu) {
                this.mmu.resetVB();
            }
            if (this.io.annunciator(0)) {
                const imageData = this.io.blit();
                if (imageData) {
                    this.vm.blit(imageData);
                    this.stats.renderedFrames++;
                }
            } else {
                if (this.vm.blit()) {
                    this.stats.renderedFrames++;
                }
            }
            this.stats.cycles = this.cpu.getCycles();
            this.stats.frames++;
            this.io.tick();
            this.tick();
            processGamepad(this.io);

            if (!this.paused && requestAnimationFrame) {
                this.runAnimationFrame = requestAnimationFrame(runFn);
            }
        };
        if (requestAnimationFrame) {
            this.runAnimationFrame = requestAnimationFrame(runFn);
        } else {
            this.runTimer = window.setInterval(runFn, interval);
        }
    }

    stop() {
        this.paused = true;
        if (this.runTimer) {
            clearInterval(this.runTimer);
        }
        if (this.runAnimationFrame) {
            cancelAnimationFrame(this.runAnimationFrame);
        }
        this.runTimer = null;
        this.runAnimationFrame = null;
    }

    isRunning() {
        return !this.paused;
    }

    getState(): State {
        const state: State = {
            cpu: this.cpu.getState(),
            vm: this.vm.getState(),
            io: this.io.getState(),
            mmu: this.mmu?.getState(),
            ram: this.ram?.map(bank => bank.getState()),
        };

        return state;
    }

    setState(state: State) {
        this.cpu.setState(state.cpu);
        this.vm.setState(state.vm);
        this.io.setState(state.io);
        if (this.mmu && state.mmu) {
            this.mmu.setState(state.mmu);
        }
        if (this.ram) {
            this.ram.forEach((bank, idx) => {
                if (state.ram) {
                    bank.setState(state.ram[idx]);
                }
            });
        }
    }

    reset() {
        this.cpu.reset();
    }

    getStats(): Stats {
        return this.stats;
    }

    getCPU() {
        return this.cpu;
    }

    getIO() {
        return this.io;
    }

    getMMU() {
        return this.mmu;
    }

    getROM() {
        return this.rom;
    }

    getVideoModes() {
        return this.vm;
    }

    getDebugger() {
        return this.theDebugger;
    }
}


text:
using OrangeNBT.Data.Anvil;
using OrangeNBT.Helper;
using OrangeNBT.NBT;
using System;
using System.Diagnostics;

namespace OrangeNBT.Data.Format
{
	public class Schematic : StructureBase, IBlockAccess, ITagProvider<TagCompound>
    {
        private string _materials = "Alpha";
        private byte[] _blocks;
        private byte[] _metadata;
        private TagList _tileEntities;
        private IEntityCollection _entities;

        public Schematic(int width, int height, int length)
            : base(width, height, length)
        {
            _blocks = new byte[width * height * length];
            _metadata = new byte[width * height * length];
            _tileEntities = new TagList("TileEntities", TagType.Compound);
        }

        public Schematic(Cuboid cuboid)
            : this(cuboid.Width, cuboid.Height, cuboid.Length)
        { }

        private int GetBlockId(int x, int y, int z)
        {
            return _blocks[ToIndex(x, y, z)];
        }

		private int GetBlockData(int x, int y, int z)
        {
            return _metadata[ToIndex(x, y, z)];
        }

		public BlockSet GetBlock(int x, int y, int z)
		{
			if(AnvilDataProvider.Instance.GetBlock(GetBlockId(x, y, z))==null)
			{
				Debug.WriteLine("Skipped:" + GetBlockId(x, y, z));
			}
			return new BlockSet(AnvilDataProvider.Instance.GetBlock(GetBlockId(x, y, z)), GetBlockData(x, y, z));
		}

		public bool SetBlock(int x, int y, int z, BlockSet block)
		{
			return SetBlock(x, y, z, block.Block.Id, block.Metadata);
		}

		public TagCompound GetTileEntity(int x, int y, int z)
		{
			foreach (TagCompound comp in _tileEntities)
			{
				if (comp.ContainsKey("x") && comp.ContainsKey("y") && comp.ContainsKey("z"))
				{
					int tx = comp.GetInt("x");
					int ty = comp.GetInt("y");
					int tz = comp.GetInt("z");
					if (tx == x && ty == y && tz == z)
					{
						return comp;
					}
				}
			}
			return null;
		}

        private bool SetBlock(int x, int y, int z, int block, int metadata = 0)
        {
            _blocks[ToIndex(x, y, z)] = (byte)block;
            _metadata[ToIndex(x, y, z)] = (byte)metadata;
            return true;
        }

		public bool SetTileEntity(int x, int y, int z, TagCompound tag)
		{
			TagCompound cp = GetTileEntity(x, y, z);
			if (cp != null && tag != null)
			{
				cp = tag;
				return true;
			}
			else if (cp != null && tag == null)
			{
				_tileEntities.Remove(cp);
				return true;
			}
			else if (cp == null && tag != null)
			{
				_tileEntities.Add(tag);
				return true;
			}
			return false;
		}

        protected int ToIndex(int x, int y, int z)
        {
            return x + z * _width + y * _length * _width;
        }

        private bool SetData(int x, int y, int z, int data)
        {
            _metadata[ToIndex(x, y, z)] = (byte)data;
            return true;
        }

		private bool SetBlockId(int x, int y, int z, int id)
        {
            _blocks[ToIndex(x, y, z)] = (byte)id;
            return true;
        }

        public TagCompound BuildTag()
        {
			TagCompound t = new TagCompound("Schematic")
            {
                new TagShort("Width", (short)_width),
                new TagShort("Height", (short)_height),
                new TagShort("Length", (short)_length),
                new TagString("Materials", _materials),
                new TagByteArray("Blocks", _blocks),
                new TagByteArray("Data", _metadata),
            };

			if (_tileEntities != null)
				t.Add(_tileEntities);
			if (_entities != null)
				t.Add(((EntityCollection)_entities).BuildTag());

			return t;
        }

        public static Schematic FromNBT(TagCompound root)
        {
            if ((!root.ContainsKey("Width")) || (!root.ContainsKey("Height")) || (!root.ContainsKey("Length")) || (!root.ContainsKey("Materials")) || (!root.ContainsKey("Blocks")) || (!root.ContainsKey("Data")))
            {
                throw new ArgumentException("Unknown format");
            }
            if (root.GetString("Materials") != "Alpha")
            {
                throw new ArgumentException("Unknown format");
            }
            int w = root.GetShort("Width");
            int h = root.GetShort("Height");
            int l = root.GetShort("Length");
            Schematic obj = new Schematic(w, h, l);
            byte[] blocks = ((TagByteArray)root["Blocks"]).Value;
            byte[] metadata = ((TagByteArray)root["Data"]).Value;

            for (int z = 0; z < obj.Length; z++)
            {
                for (int y = 0; y < obj.Height; y++)
                {
                    for (int x = 0; x < obj.Width; x++)
                    {
                        obj.SetBlock(x, y, z, blocks[obj.ToIndex(x, y, z)], metadata[obj.ToIndex(x, y, z)]);
                    }
                }
            }

            if (root.ContainsKey("TileEntities", TagType.List))
            {
                obj._tileEntities = ((TagList)root[("TileEntities")]);
            }
            if (root.ContainsKey("Entities", TagType.List))
            {
                obj._entities = new EntityCollection(root["Entities"] as TagList);
            }
            return obj;
        }
    }
}


text:
package org.apache.camel.model;

import java.util.AbstractList;
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;

import org.apache.camel.Predicate;
import org.apache.camel.Processor;
import org.apache.camel.builder.ExpressionClause;
import org.apache.camel.processor.ChoiceProcessor;
import org.apache.camel.processor.FilterProcessor;
import org.apache.camel.spi.RouteContext;
import org.apache.camel.util.CollectionStringBuffer;
import org.apache.camel.util.ObjectHelper;

/**
 * Represents an XML <choice/> element
 *
 * @version
 */
@XmlRootElement(name = "choice")
@XmlAccessorType(XmlAccessType.FIELD)
public class ChoiceDefinition extends ProcessorDefinition<ChoiceDefinition> {
    @XmlElementRef
    private List<WhenDefinition> whenClauses = new ArrayList<WhenDefinition>();
    @XmlElement
    private OtherwiseDefinition otherwise;

    public ChoiceDefinition() {
    }

    @Override
    public List<ProcessorDefinition<?>> getOutputs() {
        // wrap the outputs into a list where we can on the inside control the when/otherwise
        // but make it appear as a list on the outside
        return new AbstractList<ProcessorDefinition<?>>() {

            public ProcessorDefinition<?> get(int index) {
                if (index < whenClauses.size()) {
                    return whenClauses.get(index);
                }
                if (index == whenClauses.size()) {
                    return otherwise;
                }
                throw new IndexOutOfBoundsException("Index " + index + " is out of bounds with size " + size());
            }

            public boolean add(ProcessorDefinition<?> def) {
                if (def instanceof WhenDefinition) {
                    return whenClauses.add((WhenDefinition)def);
                } else if (def instanceof OtherwiseDefinition) {
                    otherwise = (OtherwiseDefinition)def;
                    return true;
                }
                throw new IllegalArgumentException("Expected either a WhenDefinition or OtherwiseDefinition but was "
                        + ObjectHelper.classCanonicalName(def));
            }

            public int size() {
                return whenClauses.size() + (otherwise == null ? 0 : 1);
            }

            public void clear() {
                whenClauses.clear();
                otherwise = null;
            }

            public ProcessorDefinition<?> set(int index, ProcessorDefinition<?> element) {
                if (index < whenClauses.size()) {
                    if (element instanceof WhenDefinition) {
                        return whenClauses.set(index, (WhenDefinition)element);
                    }
                    throw new IllegalArgumentException("Expected WhenDefinition but was "
                            + ObjectHelper.classCanonicalName(element));
                } else if (index == whenClauses.size()) {
                    ProcessorDefinition<?> old = otherwise;
                    otherwise = (OtherwiseDefinition)element;
                    return old;
                }
                throw new IndexOutOfBoundsException("Index " + index + " is out of bounds with size " + size());
            }

            public ProcessorDefinition<?> remove(int index) {
                if (index < whenClauses.size()) {
                    return whenClauses.remove(index);
                } else if (index == whenClauses.size()) {
                    ProcessorDefinition<?> old = otherwise;
                    otherwise = null;
                    return old;
                }
                throw new IndexOutOfBoundsException("Index " + index + " is out of bounds with size " + size());
            }
        };
    }

    @Override
    public boolean isOutputSupported() {
        return true;
    }

    @Override
    public String toString() {
        return "Choice[" + getWhenClauses() + (getOtherwise() != null ? " " + getOtherwise() : "") + "]";
    }

    @Override
    public String getShortName() {
        return "choice";
    }

    @Override
    public Processor createProcessor(RouteContext routeContext) throws Exception {
        List<FilterProcessor> filters = new ArrayList<FilterProcessor>();
        for (WhenDefinition whenClause : whenClauses) {
            filters.add(whenClause.createProcessor(routeContext));
        }
        Processor otherwiseProcessor = null;
        if (otherwise != null) {
            otherwiseProcessor = otherwise.createProcessor(routeContext);
        }
        return new ChoiceProcessor(filters, otherwiseProcessor);
    }

    // Fluent API
    // -------------------------------------------------------------------------

    /**
     * Sets the predicate for the when node
     *
     * @param predicate the predicate
     * @return the builder
     */
    public ChoiceDefinition when(Predicate predicate) {
        addClause(new WhenDefinition(predicate));
        return this;
    }

    /**
     * Creates an expression for the when node
     *
     * @return expression to be used as builder to configure the when node
     */
    public ExpressionClause<ChoiceDefinition> when() {
        ExpressionClause<ChoiceDefinition> clause = new ExpressionClause<ChoiceDefinition>(this);
        addClause(new WhenDefinition(clause));
        return clause;
    }

    private void addClause(ProcessorDefinition<?> when) {
        popBlock();
        addOutput(when);
        pushBlock(when);
    }

    /**
     * Sets the otherwise node
     *
     * @return the builder
     */
    public ChoiceDefinition otherwise() {
        OtherwiseDefinition answer = new OtherwiseDefinition();
        addClause(answer);
        return this;
    }

    @Override
    public void setId(String value) {
        // when setting id, we should set it on the fine grained element, if possible
        if (otherwise != null) {
            otherwise.setId(value);
        } else if (!getWhenClauses().isEmpty()) {
            int size = getWhenClauses().size();
            getWhenClauses().get(size - 1).setId(value);
        } else {
            super.setId(value);
        }
    }

    // Properties
    // -------------------------------------------------------------------------

    @Override
    public String getLabel() {
        CollectionStringBuffer buffer = new CollectionStringBuffer("choice[");
        List<WhenDefinition> list = getWhenClauses();
        for (WhenDefinition whenType : list) {
            buffer.append(whenType.getLabel());
        }
        buffer.append("]");
        return buffer.toString();
    }

    public List<WhenDefinition> getWhenClauses() {
        return whenClauses;
    }

    public void setWhenClauses(List<WhenDefinition> whenClauses) {
        this.whenClauses = whenClauses;
    }

    public OtherwiseDefinition getOtherwise() {
        return otherwise;
    }

    public void setOtherwise(OtherwiseDefinition otherwise) {
        this.otherwise = otherwise;
    }

    @Override
    protected void configureChild(ProcessorDefinition<?> output) {
        if (whenClauses == null || whenClauses.isEmpty()) {
            return;
        }
        for (WhenDefinition when : whenClauses) {
            if (when.getExpression() instanceof ExpressionClause) {
                ExpressionClause<?> clause = (ExpressionClause<?>) when.getExpression();
                if (clause.getExpressionType() != null) {
                    // if using the Java DSL then the expression may have been set using the
                    // ExpressionClause which is a fancy builder to define expressions and predicates
                    // using fluent builders in the DSL. However we need afterwards a callback to
                    // reset the expression to the expression type the ExpressionClause did build for us
                    when.setExpression(clause.getExpressionType());
                }
            }
        }
    }
}


text:
from grequests import get, map, imap
from nose.tools import ok_
from nose.plugins.skip import SkipTest
########### Constants ############
urls = [
        'http://github.com',
        'http://www.google.com',
        'http://www.psf.org'
        ]
############# tests ##############
def test_get():
    global urls
    to_fetch = (get(url) for url in urls)
    map(to_fetch)
    for fetched in to_fetch:
        ok_(fetched.ok, True)

def test_imap_with_size():
    global urls
    to_fetch = (get(url) for url in urls)
    imap(to_fetch, size = len(urls) - 1)
    for fetching in to_fetch:
        ok_(fetching.send(), True)

import os
import time
import unittest

import requests
from requests.exceptions import Timeout
import grequests

HTTPBIN_URL = os.environ.get('HTTPBIN_URL', 'http://httpbin.org/')

def httpbin(*suffix):
    """Returns url for HTTPBIN resource."""
    return HTTPBIN_URL + '/'.join(suffix)

N = 5
URLS = [httpbin('get?p=%s' % i) for i in range(N)]

class GrequestsCase(unittest.TestCase):

    def test_map(self):
        reqs = [grequests.get(url) for url in URLS]
        resp = grequests.map(reqs, size=N)
        self.assertEqual([r.url for r in resp], URLS)

    def test_imap(self):
        reqs = (grequests.get(url) for url in URLS)
        i = 0
        for i, r in enumerate(grequests.imap(reqs, size=N)):
            self.assertTrue(r.url in URLS)
        self.assertEqual(i, N - 1)

    def test_hooks(self):
        result = {}

        def hook(r, **kwargs):
            result[r.url] = True
            return r

        reqs = [grequests.get(url, hooks={'response': [hook]}) for url in URLS]
        grequests.map(reqs, size=N)
        self.assertEqual(sorted(result.keys()), sorted(URLS))

    def test_callback_kwarg(self):
        result = {'ok': False}

        def callback(r, **kwargs):
            result['ok'] = True
            return r

        self.get(URLS[0], callback=callback)
        self.assertTrue(result['ok'])

    def test_session_and_cookies(self):
        c1 = {'k1': 'v1'}
        r = self.get(httpbin('cookies/set'), params=c1).json()
        self.assertEqual(r['cookies'], c1)
        s = requests.Session()
        r = self.get(httpbin('cookies/set'), session=s, params=c1).json()
        self.assertEqual(dict(s.cookies), c1)

        # ensure all cookies saved
        c2 = {'k2': 'v2'}
        c1.update(c2)
        r = self.get(httpbin('cookies/set'), session=s, params=c2).json()
        self.assertEqual(dict(s.cookies), c1)

        # ensure new session is created
        r = self.get(httpbin('cookies')).json()
        self.assertEqual(r['cookies'], {})

        # cookies as param
        c3 = {'p1': '42'}
        r = self.get(httpbin('cookies'), cookies=c3).json()
        self.assertEqual(r['cookies'], c3)

    def test_calling_request(self):
        reqs = [grequests.request('POST', httpbin('post'), data={'p': i})
                for i in range(N)]
        resp = grequests.map(reqs, size=N)
        self.assertEqual([int(r.json()['form']['p']) for r in resp], list(range(N)))

    def test_stream_enabled(self):
        r = grequests.map([grequests.get(httpbin('stream/10'))],
                          size=2, stream=True)[0]
        self.assertFalse(r._content_consumed)

    def test_concurrency_with_delayed_url(self):
        t = time.time()
        n = 10
        reqs = [grequests.get(httpbin('delay/1')) for _ in range(n)]
        grequests.map(reqs, size=n)
        self.assertLess((time.time() - t), n)

    def test_map_timeout_no_exception_handler(self):
        """
        compliance with existing 0.2.0 behaviour
        """
        reqs = [grequests.get(httpbin('delay/1'), timeout=0.001), grequests.get(httpbin('/'))]
        responses = grequests.map(reqs)
        self.assertIsNone(responses[0])
        self.assertTrue(responses[1].ok)
        self.assertEqual(len(responses), 2)

    def test_map_timeout_exception_handler_returns_false(self):
        """
        if you don't want your exceptions to show up in the map result
        """
        def exception_handler(request, exception):
            return False
        reqs = [grequests.get(httpbin('delay/1'), timeout=0.001), grequests.get(httpbin('/'))]
        responses = grequests.map(reqs, exception_handler=exception_handler)
        self.assertFalse(responses[0])
        self.assertTrue(responses[1].ok)
        self.assertEqual(len(responses), 2)

    def test_map_timeout_exception_handler_no_return(self):
        """
        ensure default behaviour for a handler that returns None
        """
        def exception_handler(request, exception):
            pass
        reqs = [grequests.get(httpbin('delay/1'), timeout=0.001), grequests.get(httpbin('/'))]
        responses = grequests.map(reqs, exception_handler=exception_handler)
        self.assertIsNone(responses[0])
        self.assertTrue(responses[1].ok)
        self.assertEqual(len(responses), 2)

    def test_map_timeout_exception_handler_returns_exception(self):
        """
        ensure returned value from exception handler is stuffed in the map result
        """
        def exception_handler(request, exception):
            return exception
        reqs = [grequests.get(httpbin('delay/1'), timeout=0.001), grequests.get(httpbin('/'))]
        responses = grequests.map(reqs, exception_handler=exception_handler)
        self.assertIsInstance(responses[0], Timeout)
        self.assertTrue(responses[1].ok)
        self.assertEqual(len(responses), 2)

    def test_imap_timeout_no_exception_handler(self):
        """
        compliance with existing 0.2.0 behaviour
        """
        reqs = [grequests.get(httpbin('delay/1'), timeout=0.001)]
        out = []
        try:
            for r in grequests.imap(reqs):
                out.append(r)
        except Timeout:
            pass
        self.assertEquals(out, [])

    def test_imap_timeout_exception_handler_no_return(self):
        """
        ensure imap-default behaviour for a handler that returns None
        """
        def exception_handler(request, exception):
            pass
        reqs = [grequests.get(httpbin('delay/1'), timeout=0.001)]
        out = []
        for r in grequests.imap(reqs, exception_handler=exception_handler):
            out.append(r)
        self.assertEquals(out, [])

    def test_imap_timeout_exception_handler_returns_false(self):
        """
        ensure map-compatible behaviour for a handler that returns False
        """
        def exception_handler(request, exception):
            return False
        reqs = [grequests.get(httpbin('delay/1'), timeout=0.001)]
        out = []
        for r in grequests.imap(reqs, exception_handler=exception_handler):
            out.append(r)
        self.assertEquals(out, [])

    def test_imap_timeout_exception_handler_returns_value(self):
        """
        ensure behaviour for a handler that returns a value
        """
        def exception_handler(request, exception):
            return request
        reqs = [grequests.get(httpbin('delay/1'), timeout=0.001)]
        out = []
        for r in grequests.imap(reqs, exception_handler=exception_handler):
            out.append(r)
        self.assertEquals(out, [])

    def test_map_timeout_exception(self):
        class ExceptionHandler:
            def __init__(self):
                self.counter = 0

            def callback(self, request, exception):
                 self.counter += 1
        eh = ExceptionHandler()
        reqs = [grequests.get(httpbin('delay/1'), timeout=0.001)]
        list(grequests.map(reqs, exception_handler=eh.callback))
        self.assertEqual(eh.counter, 1)

    def test_imap_timeout_exception(self):
        class ExceptionHandler:
            def __init__(self):
                self.counter = 0

            def callback(self, request, exception):
                 self.counter += 1
        eh = ExceptionHandler()
        reqs = [grequests.get(httpbin('delay/1'), timeout=0.001)]
        list(grequests.imap(reqs, exception_handler=eh.callback))
        self.assertEqual(eh.counter, 1)

    def get(self, url, **kwargs):
        return grequests.map([grequests.get(url, **kwargs)])[0]

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


text:
require 'spec_helper'

describe GeoWorks::Delivery::Geoserver do
  let(:id) { 'abc123' }
  let(:file_set) { instance_double("FileSet") }
  let(:visibility) { 'open' }
  let(:path) { 'spec/fixtures/files/tufts-cambridgegrid100-04.zip' }

  subject { described_class.new file_set, path }

  before do
    allow(file_set).to receive(:visibility).and_return(visibility)
    allow(file_set).to receive(:id).and_return(id)
  end

  context 'with an authenticated file set visibility' do
    let(:visibility) { 'authenticated' }
    it 'does not raise error' do
      expect { subject }.not_to raise_error
    end
  end

  context 'with a private file set visibility' do
    let(:visibility) { 'private' }
    it 'raises an error' do
      expect { subject }.to raise_error(ArgumentError, /FileSet visibility/)
    end
  end

  describe '#publish' do
    context 'when type is vector' do
      let(:path) { 'spec/fixtures/files/tufts-cambridgegrid100-04.zip' }
      it 'routes to publish_vector' do
        expect(subject).to receive(:publish_vector)
        subject.publish
      end

      it 'logs a message if there is an error' do
        expect(subject).to receive(:publish_vector).and_raise(StandardError, 'error')
        expect(Rails.logger).to receive(:error).with("GeoServer delivery job failed with: error")
        subject.publish
      end
    end

    context 'when type is raster' do
      let(:path) { 'spec/fixtures/files/S_566_1914_clip.tif' }
      it 'routes to publish_raster' do
        expect(subject).to receive(:publish_raster)
        subject.publish
      end
    end

    context 'when type is not a raster or vector' do
      let(:path) { 'not-a-zip-or-tif' }
      it 'raises an error' do
        expect(Rails.logger).to receive(:error).with(/Not a ZIPed Shapefile/)
        subject.publish
      end
    end
  end

  describe '#publish_vector' do
    context 'with a path to a zipped shapefile' do
      let(:shapefile_path) { ['/spec/fixtures/files/shapefile/tufts-cambridgegrid100-04/tufts-cambridgegrid100-04.shp'] }
      let(:url) { "file:////opt/geoserver/data_dir/derivatives#{shapefile_path.first}" }
      let(:ws) { double }
      let(:ds) { double }

      before do
        allow(Dir).to receive(:glob).and_return(shapefile_path)
        allow(subject).to receive(:system).and_return(true)
      end

      it 'dispatches to RGeoServer' do
        expect(RGeoServer::Workspace).to receive(:new).with(subject.catalog, hash_including(name: 'public')).and_return(ws)
        expect(ws).to receive(:'new?').and_return(true)
        expect(ws).to receive(:save)
        expect(RGeoServer::DataStore).to receive(:new).with(subject.catalog, hash_including(workspace: ws, name: id)).and_return(ds)
        expect(ds).to receive(:upload_external).with(url, hash_including(publish: true))
        subject.send(:publish_vector)
      end
    end
  end

  describe '#publish_raster' do
    let(:path) { 'spec/fixtures/files/S_566_1914_clip.tif' }
    let(:url) { 'file:////opt/geoserver/data_dir/derivativesspec/fixtures/files/S_566_1914_clip.tif' }
    let(:ws) { double }
    let(:cs) { double }
    let(:cov) { double }

    it 'dispatches to RGeoServer' do
      expect(RGeoServer::Workspace).to receive(:new).with(subject.catalog, hash_including(name: 'public')).and_return(ws).twice
      expect(ws).to receive(:'new?').and_return(true).twice
      expect(ws).to receive(:save).twice
      expect(RGeoServer::CoverageStore).to receive(:new).with(subject.catalog, hash_including(workspace: ws, name: id)).and_return(cs)
      expect(cs).to receive(:name).and_return('abcdefg').at_least(:once)
      expect(cs).to receive(:url=).with(url)
      expect(cs).to receive(:enabled=).with('true')
      expect(cs).to receive(:data_type=).with('GeoTIFF')
      expect(cs).to receive(:save)
      expect(RGeoServer::Coverage).to receive(:new).with(subject.catalog, hash_including(workspace: ws, coverage_store: cs, name: cs.name)).and_return(cov)
      expect(cov).to receive(:title=).with(cs.name)
      expect(cov).to receive(:metadata_links=).with([])
      expect(cov).to receive(:save)
      subject.send(:publish_raster)
    end
  end

  describe '#catalog' do
    it 'connects to a RGeoServer catalog' do
      expect(RGeoServer).to receive(:catalog).with(hash_including(:url, :user, :password)).and_return(double).once
      subject.catalog
      subject.catalog # should cache result
    end
  end
end


text:
<!--
  ~ Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~ WSO2 Inc. licenses this file to you under the Apache License,
  ~ Version 2.0 (the "License"); you may not use this file except
  ~ in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->
<ServiceProvider>
    <ApplicationID>1</ApplicationID>
    <ApplicationName>default</ApplicationName>
    <Description>Default Service Provider</Description>
    <InboundAuthenticationConfig>
        <InboundAuthenticationRequestConfigs>
            <InboundAuthenticationRequestConfig>
                <InboundAuthKey>default</InboundAuthKey>
                <InboundAuthType></InboundAuthType>
                <Properties></Properties>
            </InboundAuthenticationRequestConfig>
        </InboundAuthenticationRequestConfigs>
    </InboundAuthenticationConfig>
    <LocalAndOutBoundAuthenticationConfig>
        <AuthenticationSteps>
            <AuthenticationStep>
                <StepOrder>1</StepOrder>
                <LocalAuthenticatorConfigs>
                    <LocalAuthenticatorConfig>
                        <Name>BasicMockAuthenticator</Name>
                        <DisplayName>basicauth</DisplayName>
                        <IsEnabled>true</IsEnabled>
                    </LocalAuthenticatorConfig>
                </LocalAuthenticatorConfigs>
                <SubjectStep>true</SubjectStep>
                <AttributeStep>true</AttributeStep>
            </AuthenticationStep>
            <AuthenticationStep>
                <StepOrder>2</StepOrder>
                <FederatedIdentityProviders>
                    <IdentityProvider>
                        <IdentityProviderName>HwkMockAuthenticator</IdentityProviderName>
                        <IsEnabled>true</IsEnabled>
                        <DefaultAuthenticatorConfig>HwkMockAuthenticator</DefaultAuthenticatorConfig>
                        <FederatedAuthenticatorConfigs>
                            <FederatedAuthenticatorConfig>
                                <Name>HwkMockAuthenticator</Name>
                                <IsEnabled>true</IsEnabled>
                            </FederatedAuthenticatorConfig>
                        </FederatedAuthenticatorConfigs>
                    </IdentityProvider>
                </FederatedIdentityProviders>
                <SubjectStep>false</SubjectStep>
                <AttributeStep>false</AttributeStep>
            </AuthenticationStep>
            <AuthenticationStep>
                <StepOrder>3</StepOrder>
                <FederatedIdentityProviders>
                    <IdentityProvider>
                        <IdentityProviderName>FptMockAuthenticator</IdentityProviderName>
                        <IsEnabled>true</IsEnabled>
                        <DefaultAuthenticatorConfig>FptMockAuthenticator</DefaultAuthenticatorConfig>
                        <FederatedAuthenticatorConfigs>
                            <FederatedAuthenticatorConfig>
                                <Name>FptMockAuthenticator</Name>
                                <IsEnabled>true</IsEnabled>
                            </FederatedAuthenticatorConfig>
                        </FederatedAuthenticatorConfigs>
                    </IdentityProvider>
                </FederatedIdentityProviders>
                <SubjectStep>false</SubjectStep>
                <AttributeStep>false</AttributeStep>
            </AuthenticationStep>
        </AuthenticationSteps>
    </LocalAndOutBoundAuthenticationConfig>
    <RequestPathAuthenticatorConfigs></RequestPathAuthenticatorConfigs>
    <InboundProvisioningConfig></InboundProvisioningConfig>
    <OutboundProvisioningConfig></OutboundProvisioningConfig>
    <ClaimConfig>
        <AlwaysSendMappedLocalSubjectId>true</AlwaysSendMappedLocalSubjectId>
    </ClaimConfig>
    <PermissionAndRoleConfig></PermissionAndRoleConfig>
</ServiceProvider>


text:
body {
    background-color: grey;
    margin-left: 50px;
    width: 400px;
}

#list>ul {
    list-style-type: decimal;
    list-style-position: inside;
}


text:
'use strict';

const BundleBase = require('./BundleBase');
const ModuleTransport = require('../lib/ModuleTransport');

class HMRBundle extends BundleBase {
  constructor({sourceURLFn, sourceMappingURLFn}) {
    super();
    this._sourceURLFn = sourceURLFn
    this._sourceMappingURLFn = sourceMappingURLFn;
    this._sourceURLs = [];
    this._sourceMappingURLs = [];
  }

  addModule(resolver, response, module, moduleTransport) {
    const code = resolver.resolveRequires(
      response,
      module,
      moduleTransport.code,
      moduleTransport.meta.dependencyOffsets,
    );

    super.addModule(new ModuleTransport({...moduleTransport, code}));
    this._sourceMappingURLs.push(this._sourceMappingURLFn(moduleTransport.sourcePath));
    this._sourceURLs.push(this._sourceURLFn(moduleTransport.sourcePath));
    return Promise.resolve();
  }

  getModulesNamesAndCode() {
    return this._modules.map(module => {
      return {
        name: JSON.stringify(module.name),
        code: module.code,
      };
    });
  }

  getSourceURLs() {
    return this._sourceURLs;
  }

  getSourceMappingURLs() {
    return this._sourceMappingURLs;
  }
}

module.exports = HMRBundle;


text:
package com.kun.common.util;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * spring工具类
 *
 * @version 1.0.0
 * @date 2015年10月24日 上午12:57:52
 */
public class SpringContextUtil implements ApplicationContextAware {

	private static ApplicationContext applicationContext; // Spring应用上下文环境

	/**
	 * 实现ApplicationContextAware接口的回调方法,设置上下文环境
	 *
	 * @param applicationContext
	 * @throws BeansException
	 */
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		SpringContextUtil.applicationContext = applicationContext;
	}

	/**
	 * @return ApplicationContext
	 */
	public static ApplicationContext getApplicationContext() {
		return applicationContext;
	}

	/**
	 * 获取对象
	 *
	 * @param name
	 * @return Object 一个以所给名字注册的bean的实例
	 * @throws BeansException
	 */
	public static Object getBean(String name) throws BeansException {
		return applicationContext.getBean(name);
	}

	/**
	 * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true
	 *
	 * @param name
	 * @return boolean
	 */
	public static boolean containsBean(String name) {
		return applicationContext.containsBean(name);
	}

}


text:
package dtc.laws

import java.time.{Duration, LocalDate, LocalTime}

import dtc.Local
import org.scalacheck.{Arbitrary, Gen}
import org.typelevel.discipline.Laws

trait LocalDateTimeTests[A] extends Laws {

  def generalLaws: GeneralLocalDateTimeLaws[A]
  def laws: LocalDateTimeLaws[A]

  def localDateTime(implicit arbA: Arbitrary[A], arbD: Arbitrary[Duration]): RuleSet = {
    new DefaultRuleSet(
      name = "LocalDateTime",
      parent = None,
      "seconds addition laws" -> generalLaws.secondsAddition,
      "minutes addition laws" -> generalLaws.minutesAddition,
      "hours addition laws" -> generalLaws.hoursAddition,
      "constructor consistency" -> laws.constructorConsistency,
      "plain constructor consistency" -> laws.plainConstructorConsistency,
      "withYear laws" -> generalLaws.withYear,
      "withMonth laws" -> generalLaws.withMonth,
      "withDayOfMonth laws" -> generalLaws.withDayOfMonth,
      "withHour laws" -> generalLaws.withHour,
      "withMinute laws" -> generalLaws.withMinute,
      "withSecond laws" -> generalLaws.withSecond,
      "withMillisecond laws" -> generalLaws.withMillisecond,
      "withTime laws" -> generalLaws.withTime,
      "withDate laws" -> generalLaws.withDate,
      "daysUntil is consistent with addition" -> generalLaws.daysUntilIsConsistentWithPlus,
      "monthsUntil is consistent with addition" -> generalLaws.monthsUntilIsConsistentWithPlus,
      "yearsUntil counts only number of full years" -> generalLaws.yearsUntilCountsOnlyFullUnits
    )
  }

  // see: https://github.com/moment/moment/issues/3029
  def monthUntilFractionHandling(implicit arbA: Arbitrary[A], arbD: Arbitrary[Duration]): RuleSet = {
    new DefaultRuleSet(
      name = "LocalDateTime",
      parent = None,
      "monthsUntil counts only number of full months" -> generalLaws.monthsUntilCountsOnlyFullUnits
    )
  }
}

object LocalDateTimeTests {
  def apply[A: Local](
    gDateAndDuration: Gen[(A, Duration)],
    gValidYear: Gen[Int])(
    implicit
    arbA: Arbitrary[A],
    arbLocalTime: Arbitrary[LocalTime],
    arbLocalDate: Arbitrary[LocalDate]): LocalDateTimeTests[A] = new LocalDateTimeTests[A] {

    def laws: LocalDateTimeLaws[A] = LocalDateTimeLaws[A](
      arbLocalTime.arbitrary, arbLocalDate.arbitrary
    )

    def generalLaws: GeneralLocalDateTimeLaws[A] = GeneralLocalDateTimeLaws[A](
      gDateAndDuration, arbLocalTime.arbitrary, arbLocalDate.arbitrary, gValidYear
    )
  }
}