text:
<!DOCTYPE html>

        <title>Virtual Human App - Compare Groups</title>

        <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
        <meta name="mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-touch-fullscreen" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style"  content="black-translucent" >
        <meta name="format-detection" content="telephone=no">

        <link href="../bower_components/core-icons/core-icons.html" rel="import">
        <link href="../bower_components/paper-elements/paper-elements.html" rel="import">

        <link href="../bower_components/core-collapse/core-collapse.html" rel="import">
        <link href="../bower_components/core-menu/core-menu.html" rel="import">
        <link href="../bower_components/paper-icon-button/paper-icon-button.html" rel="import">
        <link href="../bower_components/paper-item/paper-item.html" rel="import">
        <link href="../bower_components/paper-dropdown/paper-dropdown.html" rel="import">
        <link href="../bower_components/paper-dropdown-menu/paper-dropdown-menu.html" rel="import">

        <link rel="stylesheet" href="../styles/comparegroups.css">
        <meta name="application-name" content="Virtual Human App">

Compare with interest group

            <form>

                <paper-dropdown-menu label="Sex">
                    <paper-dropdown class="dropdown">
                        <core-menu class="menu">
                            <paper-item>Male</paper-item>
                            <paper-item>Female</paper-item>
                        </core-menu>
                    </paper-dropdown>
                </paper-dropdown-menu>

                <paper-input-decorator floatinglabel style="text-align: left" label="Age">
                    <input id="age" is="core-input" name="age"/>
                </paper-input-decorator>

                <paper-dropdown-menu label="Ethnicity">
                    <paper-dropdown class="dropdown">
                        <core-menu class="menu">
                            <paper-item style="text-align: start;">Hispanic or Latino</paper-item>
                            <paper-item style="text-align: start;">American Indian or Alaska Native</paper-item>
                            <paper-item style="text-align: start;">Asian</paper-item>
                            <paper-item style="text-align: start;">Black or African American</paper-item>
                            <paper-item style="text-align: start;">Native Hawaiian or Other Pacific Islander</paper-item>
                            <paper-item style="text-align: start;">White</paper-item>
                            <paper-item style="text-align: start;">Not Hispanic or Latino</paper-item>
                            <paper-item style="text-align: start;">Unknown</paper-item>
                        </core-menu>
                    </paper-dropdown>
                </paper-dropdown-menu>

<paper-button raised>Compare</paper-button>
            </form>


text: hello spark sql

redpajama_set_name: RedPajamaGithub


text:
namespace ntp_snippets {

class FakeContentSuggestionsProviderObserver final
    : public ContentSuggestionsProvider::Observer {
 public:
  FakeContentSuggestionsProviderObserver();
  ~FakeContentSuggestionsProviderObserver();

  void OnNewSuggestions(ContentSuggestionsProvider* provider,
                        Category category,
                        std::vector<ContentSuggestion> suggestions) override;

  void OnCategoryStatusChanged(ContentSuggestionsProvider* provider,
                               Category category,
                               CategoryStatus new_status) override;

  void OnSuggestionInvalidated(
      ContentSuggestionsProvider* provider,
      const ContentSuggestion::ID& suggestion_id) override;

  const std::map<Category, CategoryStatus, Category::CompareByID>& statuses()
      const;

  CategoryStatus StatusForCategory(Category category) const;

  const std::vector<ContentSuggestion>& SuggestionsForCategory(
      Category category);

 private:
  std::map<Category, CategoryStatus, Category::CompareByID> statuses_;
  std::map<Category, std::vector<ContentSuggestion>, Category::CompareByID>
      suggestions_;

  DISALLOW_COPY_AND_ASSIGN(FakeContentSuggestionsProviderObserver);
};

}  // namespace ntp_snippets

#endif  // COMPONENTS_NTP_SNIPPETS_FAKE_CONTENT_SUGGESTIONS_PROVIDER_OBSERVER_H_


text:
package org.frameworkset.util.encoder;

public class DecoderException
    extends IllegalStateException
{
    public DecoderException() {
		super();
		// TODO Auto-generated constructor stub
	}

	public DecoderException(String s) {
		super(s);
		// TODO Auto-generated constructor stub
	}

	public DecoderException(Throwable cause) {
		super(cause);
		// TODO Auto-generated constructor stub
	}

	private Throwable cause;

    DecoderException(String msg, Throwable cause)
    {
        super(msg);

        this.cause = cause;
    }

    public Throwable getCause()
    {
        return cause;
    }
}


text:
<?php

// $Id$

require_once(DIR_INC.'modules/admin_panel/site_admin_web_page_wed_ua.class.php');
require_once(DIR_INC.'modules/admin_panel/classes/admin_user/admin_user_dbc.class.php');

class Admin_User_Delete_WP extends Site_Admin_Web_Page_WED_UA {
	public function init() {
		parent::init();

		$v = $this->create_view();
		$this->add_view($v);

		$this->wed->add_wed_event_action_pair(new Web_Event_Simple_Int('delete', Tangra_Parameter_Method::GET, 'del'), 'delete_event');
		$this->wed->add_wed_event_action_pair(new Web_Event_Simple_Int('delete_confirmed', Tangra_Parameter_Method::GET, 'delete_confirmed'), 'delete_confirmed_event');

	}

	protected function delete_event($id) {
		$user = new Admin_User_DBC();
		$dbc = $this->get_dbc();
		if ($user->load_by_id($dbc, $id)) {

			$this->export('username', $user->get_username());
			$this->export('admin_user_id', $user->get_id());

			$view = $this->get_view('default');

		} else {
			$this->export('admin_user_id', $id);
			$view = $this->get_view('not_exists');

		}

		return $view;
	}

//TODO - confirm that it is working
	protected function delete_confirmed_event($id) {
		$dbc = $this->get_dbc();

		try {
			$dbc->start_trans();
			Admin_User_DBC::delete($dbc, $id);
			$dbc->complete_trans();
		} catch (Exception $e) {
			$dbc->fail_trans();
			$dbc->complete_trans();
			throw $e;
		}

		$context = $this->get__context();
		$rc = new Redirect_Composer_Local($this->get__context(), 'admin/admin_user/admin_users.php');
		$redir_view = new Just_Headers_View();
		$redir_view->add_http_header($rc->get_location($context));

		return $redir_view;
	}

	protected function default_event() {
		throw new Tangra_User_Exception('Unexpected parameters.');
	}
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">

	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Guía del usuario de CKFinder</title>
	<link href="other/help.css" type="text/css" rel="stylesheet">

Panel de Carpetas

		El panel de carpetas contiene la "vista de árbol
" de las carpetas por las que se puede navegar. Las carpetas son una manera de organizar mejor los ficheros.

		Se le llama "vista de árbol
", por que se tienen las carpetas representadas jerárquicamente como las ramas de un árbol. Usa la misma representación gráfica que muchos sistemas operativos modernos.

	Operaciones Básicas

		Abrir una carpeta

		Para abrir una carpeta y revelar sus carpetas "hijas", simplemente haga click en el signo "más" () en frente de la misma. Si el signo "más" no está presente, la carpeta no tiene carpetas hijas que puedan desplegarse.

		Vea "Cargado bajo demanda " al final de la pagina para un mejor entendimiento de cómo son cargadas las carpetas.

		Cerrar una carpeta

		Para cerrar una carpeta, y por ende esconder sus carpetas "hijas", simplemente haga click en el signo "menos" () en frente de la misma.

		Seleccionar una carpeta

		Para seleccionar una carpeta y por ende convertirla a "la carpeta actual" para CKFinder, simplemente haga click en el nombre de la carpeta o en su icono. La carpeta seleccionada tendrá un color de fondo diferente.

		Operaciones Avanzadas

		Es posible utilizar operaciones avanzadas en una carpeta, haciendo uso de su "Menú contextual", las siguientes opciones están disponibles:

		Nota: Algunas opciones del menú contextuales podrían estar deshabilitados dependiendo de los ajustes asignados por el administrador del sistema, vea "Control de Acceso" para más información.

		Crear Carpetas

		Para crear una carpeta "hija" dentro de una carpeta ya existente, solamente haga click sobre la opción "Nueva Carpeta" del menú contextual. Una ventana de diálogo aparecerá en donde deberá escribir el nombre de la nueva Carpeta, luego confirme la operación.

		No todos los caracteres pueden ser usados para establecer un nombre de carpeta, debido a limitaciones en los sistemas donde CKFinder se ejecuta. Por ejemplo, los siguientes caracteres no pueden usarse para dar nombre a carpetas ni ficheros:  \ / :
		* ? " <
		> |

		Renombrar Carpetas

		Para renombrar una carpeta, solo haga click en la opción "Renombrar" del menú contextual. Una ventana de dialogo aparecerá conteniendo el nombre actual de la carpeta, ahí deberá escribir el nuevo nombre que desea asignar a la carpeta, luego confirme la operación.

		No todos los caracteres pueden ser usados para establecer un nombre de carpeta, debido a limitaciones en los sistemas donde CKFinder se ejecuta. Por ejemplo, los siguientes caracteres, no pueden usarse para dar nombre a carpetas ni ficheros:  \ / : * ? " < > |

Atención: Al renombrar una carpeta, los enlaces o inserciones de medios disponibles en otras páginas que apunten a ficheros o carpetas dentro de aquella que fue renombrada podrían quedar "rotas" y por lo tanto no funcionarán. Así que sea cauteloso cuando use esta característica.

		Borrar Carpetas

		Para borrar una carpeta, incluyendo su contenido, solo haga click sobre la opción "Borrar" del menú contextual. Un mensaje de confirmación aparecerá para asegurarse de que realmente desea eliminar dicha carpeta.

Atención: Al borrar una carpeta, los enlaces o inserciones de medios disponibles en otras páginas que apunten a ficheros o carpetas dentro de aquella que fue borrada podrían quedar "rotas" y por lo tanto no funcionarán. Así que sea cauteloso cuando use esta característica.

		Cargado "Bajo demanda "

		La diferencia más importante entre CKFinder y la "vista de árbol " que se encuentra en los sistemas operativos modernos, es que las carpetas se cargan "bajo demanda", esto significa que CKFinder no carga todo el árbol al inicio, sino que solo carga un pequeño subconjunto de él cuando se abre la carpeta, este es un requerimiento de aplicaciones avanzadas para web como lo es CKFinder.

		Para indicar que las carpetas se están cargando, la etiqueta "Cargando..." podría aparecer cuando se intente abrir una carpeta.

		La etiqueta desaparecerá automaticamente una vez que la carga de las carpetas haya terminado. Una vez cargada, la etiqueta no aparecerá más para esa carpeta.


text:
using System;
using System.Threading;
using System.Threading.Tasks;
using Object = Google.Apis.Storage.v1.Data.Object;

namespace Google.Cloud.Storage.V1
{
    public abstract partial class StorageClient
    {
        /// <summary>
        /// Fetches the information about an object synchronously.
        /// </summary>
        /// <remarks>This does not retrieve the content of the object itself. Use <see cref="DownloadObject(string, string, System.IO.Stream, DownloadObjectOptions, System.IProgress{Apis.Download.IDownloadProgress})"/>
        /// to download the content.</remarks>
        /// <param name="bucket">The name of the bucket containing the object. Must not be null.</param>
        /// <param name="objectName">The name of the object within the bucket. Must not be null.</param>
        /// <param name="options">Additional options for the fetch operation. May be null, in which case appropriate
        /// defaults will be used.</param>
        /// <returns>The <see cref="Object"/> representation of the storage object.</returns>
        public virtual Object GetObject(string bucket, string objectName, GetObjectOptions options = null)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Fetches the information about an object asynchronously.
        /// </summary>
        /// <remarks>This does not retrieve the content of the object itself. Use <see cref="DownloadObjectAsync(string, string, System.IO.Stream, DownloadObjectOptions, CancellationToken, System.IProgress{Apis.Download.IDownloadProgress})"/>
        /// to download the content.</remarks>
        /// <param name="bucket">The name of the bucket containing the object. Must not be null.</param>
        /// <param name="objectName">The name of the object within the bucket. Must not be null.</param>
        /// <param name="options">Additional options for the fetch operation. May be null, in which case appropriate
        /// defaults will be used.</param>
        /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
        /// <returns>A task representing the asynchronous operation, with a result returning the
        /// <see cref="Object"/> representation of the storage object.</returns>
        public virtual Task<Object> GetObjectAsync(
            string bucket,
            string objectName,
            GetObjectOptions options = null,
            CancellationToken cancellationToken = default)
        {
            throw new NotImplementedException();
        }
    }
}


text:
package com.jwdroid.export;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;

public class XMLParser {

	public static List<Map<String,String>> parse(String elementName, InputStream is) throws ParserConfigurationException, SAXException, IOException {
		List<Map<String,String>> list = null;

        XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
        XMLHandler saxHandler = new XMLHandler(elementName);
        xmlReader.setContentHandler(saxHandler);
        xmlReader.parse(new InputSource(is));
        list = saxHandler.getItems();

        return list;
	}

}


text:
using Foundation;
using UIKit;

using $ext_projectname$.Shared;

namespace $safeprojectname$
{
	[Register ("AppDelegate")]
	public partial class AppDelegate :
	global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
	{
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			global::Xamarin.Forms.Forms.Init ();

			LoadApplication (new App ());

			return base.FinishedLaunching (app, options);
		}
	}
}


text:
<?php

/* SonataUserBundle:Admin/Field:impersonating.html.twig */
class __TwigTemplate_b8a1980717a751c7bcc318203097fb6f50881ee01dc37dec4451c0c08d3c5328 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        // line 12
        try {
            $this->parent = $this->env->loadTemplate("SonataAdminBundle:CRUD:base_list_field.html.twig");
        } catch (Twig_Error_Loader $e) {
            $e->setTemplateFile($this->getTemplateName());
            $e->setTemplateLine(12);

            throw $e;
        }

        $this->blocks = array(
            'field' => array($this, 'block_field'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "SonataAdminBundle:CRUD:base_list_field.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    // line 14
    public function block_field($context, array $blocks = array())
    {
        // line 15
        echo "    ";
        if ((($this->getAttribute((isset($context["app"]) ? $context["app"] : null), "user", array()) && ($this->getAttribute((isset($context["object"]) ? $context["object"] : null), "username", array()) != $this->getAttribute($this->getAttribute((isset($context["app"]) ? $context["app"] : null), "user", array()), "username", array()))) && $this->getAttribute((isset($context["sonata_user"]) ? $context["sonata_user"] : null), "impersonating", array()))) {
            // line 16
            echo "        env, $this->env->getExtension('routing')->getUrl($this->getAttribute($this->getAttribute((isset($context["sonata_user"]) ? $context["sonata_user"] : null), "impersonating", array()), "route", array()), twig_array_merge($this->getAttribute($this->getAttribute((isset($context["sonata_user"]) ? $context["sonata_user"] : null), "impersonating", array()), "parameters", array()), array("_switch_user" => $this->getAttribute((isset($context["object"]) ? $context["object"] : null), "username", array())))), "html", null, true);
            echo "\" title=\"";
            echo twig_escape_filter($this->env, $this->env->getExtension('translator')->trans("switch_user", array(), "SonataUserBundle"), "html", null, true);
            echo "\">

    ";
        } else {
            // line 20
            echo "        -
    ";
        }
    }

    public function getTemplateName()
    {
        return "SonataUserBundle:Admin/Field:impersonating.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  52 => 20,  42 => 16,  39 => 15,  36 => 14,  11 => 12,);
    }
}


text:
import warnings

from wagtail.core.blocks import *  # noqa

warnings.warn("wagtail.admin.blocks has moved to wagtail.core.blocks", UserWarning, stacklevel=2)


text:
namespace ck {

// GemmM = K
// GemmN = N * Ho * Wo
// GemmK = C * Y * X
template <typename... Wei,
          typename... In,
          typename... Out,
          typename ConvStrides,
          typename ConvDilations,
          typename InLeftPads,
          typename InRightPads>
__host__ __device__ constexpr auto transform_forward_convolution_into_gemm_v4r4_nchw_kcyx_nkhw_pad(
    const TensorDescriptor<Wei...>& wei_k_c_y_x_global_desc,
    const TensorDescriptor<In...>& in_n_c_hi_wi_global_desc,
    const TensorDescriptor<Out...>& out_n_k_ho_wo_global_desc,
    const ConvStrides& conv_strides,
    const ConvDilations& conv_dilations,
    const InLeftPads& in_left_pads,
    const InRightPads& in_right_pads)
{
    constexpr auto I0 = Number<0>{};
    constexpr auto I1 = Number<1>{};
    constexpr auto I2 = Number<2>{};
    constexpr auto I3 = Number<3>{};

    const auto N = in_n_c_hi_wi_global_desc.GetLength(I0);
    const auto C = in_n_c_hi_wi_global_desc.GetLength(I1);
    const auto K = out_n_k_ho_wo_global_desc.GetLength(I1);

    const auto Hi = in_n_c_hi_wi_global_desc.GetLength(I2);
    const auto Wi = in_n_c_hi_wi_global_desc.GetLength(I3);

    const auto Ho = out_n_k_ho_wo_global_desc.GetLength(I2);
    const auto Wo = out_n_k_ho_wo_global_desc.GetLength(I3);

    const auto Y = wei_k_c_y_x_global_desc.GetLength(I2);
    const auto X = wei_k_c_y_x_global_desc.GetLength(I3);

    const auto ConvStrideH = conv_strides[I0];
    const auto ConvStrideW = conv_strides[I1];

    const auto ConvDilationH = conv_dilations[I0];
    const auto ConvDilationW = conv_dilations[I1];

    const auto InLeftPadH = in_left_pads[I0];
    const auto InLeftPadW = in_left_pads[I1];

    const auto InRightPadH = in_right_pads[I0];
    const auto InRightPadW = in_right_pads[I1];

    // weight tensor
    const auto wei_gemmk_gemmm_global_desc = transform_tensor_descriptor(
        make_naive_tensor_descriptor_packed(make_tuple(K, C * Y * X)),
        make_tuple(make_pass_through_transform(K), make_pass_through_transform(C * Y * X)),
        make_tuple(Sequence<0>{}, Sequence<1>{}),
        make_tuple(Sequence<1>{}, Sequence<0>{}));

    // input tensor
    const auto in_n_c_hip_wip_global_desc = transform_tensor_descriptor(
        in_n_c_hi_wi_global_desc,
        make_tuple(make_pass_through_transform(N),
                   make_pass_through_transform(C),
                   make_pad_transform(Hi, InLeftPadH, InRightPadH),
                   make_pad_transform(Wi, InLeftPadW, InRightPadW)),
        make_tuple(Sequence<0>{}, Sequence<1>{}, Sequence<2>{}, Sequence<3>{}),
        make_tuple(Sequence<0>{}, Sequence<1>{}, Sequence<2>{}, Sequence<3>{}));

    const auto in_n_c_y_ho_x_wo_global_desc = transform_tensor_descriptor(
        in_n_c_hip_wip_global_desc,
        make_tuple(make_pass_through_transform(N),
                   make_pass_through_transform(C),
                   make_embed_transform(make_tuple(Y, Ho), make_tuple(ConvDilationH, ConvStrideH)),
                   make_embed_transform(make_tuple(X, Wo), make_tuple(ConvDilationW, ConvStrideW))),
        make_tuple(Sequence<0>{}, Sequence<1>{}, Sequence<2>{}, Sequence<3>{}),
        make_tuple(Sequence<0>{}, Sequence<1>{}, Sequence<2, 3>{}, Sequence<4, 5>{}));

    const auto in_gemmk_gemmn_global_desc =
        transform_tensor_descriptor(in_n_c_y_ho_x_wo_global_desc,
                                    make_tuple(make_merge_transform(make_tuple(C, Y, X)),
                                               make_merge_transform(make_tuple(N, Ho, Wo))),
                                    make_tuple(Sequence<1, 2, 4>{}, Sequence<0, 3, 5>{}),
                                    make_tuple(Sequence<0>{}, Sequence<1>{}));

    // output tensor
    const auto out_gemmm_gemmn_global_desc = transform_tensor_descriptor(
        make_naive_tensor_descriptor_packed(make_tuple(N, K, Ho * Wo)),
        make_tuple(make_pass_through_transform(K), make_merge_transform(make_tuple(N, Ho * Wo))),
        make_tuple(Sequence<1>{}, Sequence<0, 2>{}),
        make_tuple(Sequence<0>{}, Sequence<1>{}));

    return make_tuple(
        wei_gemmk_gemmm_global_desc, in_gemmk_gemmn_global_desc, out_gemmm_gemmn_global_desc);
}

template <typename... Wei,
          typename... In,
          typename... Out,
          typename ConvStrides,
          typename ConvDilations,
          typename InLeftPads,
          typename InRightPads>
__host__ __device__ constexpr auto
transform_forward_convolution_into_gemm_v4r4_nchw_kcyx_nkhw_no_pad(
    const TensorDescriptor<Wei...>& wei_k_c_y_x_global_desc,
    const TensorDescriptor<In...>& in_n_c_hi_wi_global_desc,
    const TensorDescriptor<Out...>& out_n_k_ho_wo_global_desc,
    const ConvStrides& conv_strides,
    const ConvDilations& conv_dilations,
    const InLeftPads& in_left_pads,
    const InRightPads& in_right_pads)
{
    constexpr auto I0 = Number<0>{};
    constexpr auto I1 = Number<1>{};
    constexpr auto I2 = Number<2>{};
    constexpr auto I3 = Number<3>{};

    const auto N = in_n_c_hi_wi_global_desc.GetLength(I0);
    const auto C = in_n_c_hi_wi_global_desc.GetLength(I1);
    const auto K = out_n_k_ho_wo_global_desc.GetLength(I1);

    const auto Ho = out_n_k_ho_wo_global_desc.GetLength(I2);
    const auto Wo = out_n_k_ho_wo_global_desc.GetLength(I3);

    const auto Y = wei_k_c_y_x_global_desc.GetLength(I2);
    const auto X = wei_k_c_y_x_global_desc.GetLength(I3);

    const auto ConvStrideH = conv_strides[I0];
    const auto ConvStrideW = conv_strides[I1];

    const auto ConvDilationH = conv_dilations[I0];
    const auto ConvDilationW = conv_dilations[I1];

    const auto InLeftPadH = in_left_pads[I0];
    const auto InLeftPadW = in_left_pads[I1];

    const auto InRightPadH = in_right_pads[I0];
    const auto InRightPadW = in_right_pads[I1];

    assert(InLeftPadH == 0 && InLeftPadW == 0 && InRightPadH == 0 && InRightPadW == 0);

    // weight tensor
    const auto wei_gemmk_gemmm_global_desc = transform_tensor_descriptor(
        make_naive_tensor_descriptor_packed(make_tuple(K, C * Y * X)),
        make_tuple(make_pass_through_transform(K), make_pass_through_transform(C * Y * X)),
        make_tuple(Sequence<0>{}, Sequence<1>{}),
        make_tuple(Sequence<1>{}, Sequence<0>{}));

    // input tensor
    const auto in_n_c_y_ho_x_wo_global_desc = transform_tensor_descriptor(
        in_n_c_hi_wi_global_desc,
        make_tuple(make_pass_through_transform(N),
                   make_pass_through_transform(C),
                   make_embed_transform(make_tuple(Y, Ho), make_tuple(ConvDilationH, ConvStrideH)),
                   make_embed_transform(make_tuple(X, Wo), make_tuple(ConvDilationW, ConvStrideW))),
        make_tuple(Sequence<0>{}, Sequence<1>{}, Sequence<2>{}, Sequence<3>{}),
        make_tuple(Sequence<0>{}, Sequence<1>{}, Sequence<2, 3>{}, Sequence<4, 5>{}));

    const auto in_gemmk_gemmn_global_desc =
        transform_tensor_descriptor(in_n_c_y_ho_x_wo_global_desc,
                                    make_tuple(make_merge_transform(make_tuple(C, Y, X)),
                                               make_merge_transform(make_tuple(N, Ho, Wo))),
                                    make_tuple(Sequence<1, 2, 4>{}, Sequence<0, 3, 5>{}),
                                    make_tuple(Sequence<0>{}, Sequence<1>{}));

    // output tensor
    const auto out_gemmm_gemmn_global_desc = transform_tensor_descriptor(
        make_naive_tensor_descriptor_packed(make_tuple(N, K, Ho * Wo)),
        make_tuple(make_pass_through_transform(K), make_merge_transform(make_tuple(N, Ho * Wo))),
        make_tuple(Sequence<1>{}, Sequence<0, 2>{}),
        make_tuple(Sequence<0>{}, Sequence<1>{}));

    return make_tuple(
        wei_gemmk_gemmm_global_desc, in_gemmk_gemmn_global_desc, out_gemmm_gemmn_global_desc);
}

template <typename... Wei,
          typename... In,
          typename... Out,
          typename ConvStrides,
          typename ConvDilations,
          typename InLeftPads,
          typename InRightPads>
__host__ __device__ constexpr auto transform_forward_convolution_into_gemm_v4r4_nchw_kcyx_nkhw_1x1(
    const TensorDescriptor<Wei...>& wei_k_c_y_x_global_desc,
    const TensorDescriptor<In...>& in_n_c_hi_wi_global_desc,
    const TensorDescriptor<Out...>& out_n_k_ho_wo_global_desc,
    const ConvStrides& conv_strides,
    const ConvDilations& conv_dilations,
    const InLeftPads& in_left_pads,
    const InRightPads& in_right_pads)
{
    constexpr auto I0 = Number<0>{};
    constexpr auto I1 = Number<1>{};
    constexpr auto I2 = Number<2>{};
    constexpr auto I3 = Number<3>{};

    const auto N = in_n_c_hi_wi_global_desc.GetLength(I0);
    const auto C = in_n_c_hi_wi_global_desc.GetLength(I1);
    const auto K = out_n_k_ho_wo_global_desc.GetLength(I1);

    const auto Ho = out_n_k_ho_wo_global_desc.GetLength(I2);
    const auto Wo = out_n_k_ho_wo_global_desc.GetLength(I3);

    const auto Y = wei_k_c_y_x_global_desc.GetLength(I2);
    const auto X = wei_k_c_y_x_global_desc.GetLength(I3);

    const auto ConvStrideH = conv_strides[I0];
    const auto ConvStrideW = conv_strides[I1];

    const auto ConvDilationH = conv_dilations[I0];
    const auto ConvDilationW = conv_dilations[I1];

    const auto InLeftPadH = in_left_pads[I0];
    const auto InLeftPadW = in_left_pads[I1];

    const auto InRightPadH = in_right_pads[I0];
    const auto InRightPadW = in_right_pads[I1];

    assert(Y == 1 && X == 1 && ConvStrideH == 1 && ConvStrideW == 1 && ConvDilationH == 1 &&
           ConvDilationW == 1 && InLeftPadH == 0 && InLeftPadW == 0 && InRightPadH == 0 &&
           InRightPadW == 0);

    // weight tensor
    const auto wei_gemmk_gemmm_global_desc = transform_tensor_descriptor(
        make_naive_tensor_descriptor_packed(make_tuple(K, C)),
        make_tuple(make_pass_through_transform(K), make_pass_through_transform(C)),
        make_tuple(Sequence<0>{}, Sequence<1>{}),
        make_tuple(Sequence<1>{}, Sequence<0>{}));

    // input tensor
    const auto in_gemmk_gemmn_global_desc = transform_tensor_descriptor(
        in_n_c_hi_wi_global_desc,
        make_tuple(make_pass_through_transform(C), make_merge_transform(make_tuple(N, Ho, Wo))),
        make_tuple(Sequence<1>{}, Sequence<0, 2, 3>{}),
        make_tuple(Sequence<0>{}, Sequence<1>{}));

    // output tensor
    const auto out_gemmm_gemmn_global_desc = transform_tensor_descriptor(
        make_naive_tensor_descriptor_packed(make_tuple(N, K, Ho * Wo)),
        make_tuple(make_pass_through_transform(K), make_merge_transform(make_tuple(N, Ho * Wo))),
        make_tuple(Sequence<1>{}, Sequence<0, 2>{}),
        make_tuple(Sequence<0>{}, Sequence<1>{}));

    return make_tuple(
        wei_gemmk_gemmm_global_desc, in_gemmk_gemmn_global_desc, out_gemmm_gemmn_global_desc);
}

} // namespace ck
#endif


text:
import ast
import io
import operator
import os
import sys
import token
import tokenize

class Visitor(ast.NodeVisitor):
    def __init__(self, lines):
        self._lines = lines
        self.line_numbers_with_nodes = set()
        self.line_numbers_with_statements = []

    def generic_visit(self, node):
        if hasattr(node, 'col_offset') and hasattr(node, 'lineno') and node.col_offset == 0:
            self.line_numbers_with_nodes.add(node.lineno)
            if isinstance(node, ast.stmt):
                self.line_numbers_with_statements.append(node.lineno)

        ast.NodeVisitor.generic_visit(self, node)

def _tokenize(source):
    """Tokenize Python source code."""
    # Using an undocumented API as the documented one in Python 2.7 does not work as needed
    # cross-version.
    return tokenize.generate_tokens(io.StringIO(source).readline)

def _indent_size(line):
    for index, char in enumerate(line):
        if not char.isspace():
            return index

def _get_global_statement_blocks(source, lines):
    """Return a list of all global statement blocks.

    The list comprises of 3-item tuples that contain the starting line number,
    ending line number and whether the statement is a single line.

    """
    tree = ast.parse(source)
    visitor = Visitor(lines)
    visitor.visit(tree)

    statement_ranges = []
    for index, line_number in enumerate(visitor.line_numbers_with_statements):
        remaining_line_numbers = visitor.line_numbers_with_statements[index+1:]
        end_line_number = len(lines) if len(remaining_line_numbers) == 0 else min(remaining_line_numbers) - 1
        current_statement_is_oneline = line_number == end_line_number

        if len(statement_ranges) == 0:
            statement_ranges.append((line_number, end_line_number, current_statement_is_oneline))
            continue

        previous_statement = statement_ranges[-1]
        previous_statement_is_oneline = previous_statement[2]
        if previous_statement_is_oneline and current_statement_is_oneline:
            statement_ranges[-1] = previous_statement[0], end_line_number, True
        else:
            statement_ranges.append((line_number, end_line_number, current_statement_is_oneline))

    return statement_ranges

def normalize_lines(source):
    """Normalize blank lines for sending to the terminal.

    Blank lines within a statement block are removed to prevent the REPL
    from thinking the block is finished. Newlines are added to separate
    top-level statements so that the REPL does not think there is a syntax
    error.

    """
    lines = source.splitlines(False)
    # If we have two blank lines, then add two blank lines.
    # Do not trim the spaces, if we have blank lines with spaces, its possible
    # we have indented code.
    if (len(lines) > 1 and len(''.join(lines[-2:])) == 0) \
        or source.endswith(('\n\n', '\r\n\r\n')):
        trailing_newline = '\n' * 2
    # Find out if we have any trailing blank lines
    elif len(lines[-1].strip()) == 0 or source.endswith(('\n', '\r\n')):
        trailing_newline = '\n'
    else:
        trailing_newline = ''

    # Step 1: Remove empty lines.
    tokens = _tokenize(source)
    newlines_indexes_to_remove = (spos[0] for (toknum, tokval, spos, epos, line) in tokens
                                  if len(line.strip()) == 0
                                     and token.tok_name[toknum] == 'NL'
                                     and spos[0] == epos[0])

    for line_number in reversed(list(newlines_indexes_to_remove)):
        del lines[line_number-1]

    # Step 2: Add blank lines between each global statement block.
    # A consequtive single lines blocks of code will be treated as a single statement,
    # just to ensure we do not unnecessarily add too many blank lines.
    source = '\n'.join(lines)
    tokens = _tokenize(source)
    dedent_indexes = (spos[0] for (toknum, tokval, spos, epos, line) in tokens
                                if toknum == token.DEDENT and _indent_size(line) == 0)

    global_statement_ranges = _get_global_statement_blocks(source, lines)
    start_positions = map(operator.itemgetter(0), reversed(global_statement_ranges))
    for line_number in filter(lambda x: x > 1, start_positions):
        lines.insert(line_number-1, '')

    sys.stdout.write('\n'.join(lines) + trailing_newline)
    sys.stdout.flush()

if __name__ == '__main__':
    contents = sys.argv[1]
    try:
        default_encoding = sys.getdefaultencoding()
        encoded_contents = contents.encode(default_encoding, 'surrogateescape')
        contents = encoded_contents.decode(default_encoding, 'replace')
    except (UnicodeError, LookupError):
        pass
    if isinstance(contents, bytes):
        contents = contents.decode('utf8')
    normalize_lines(contents)


text:
package org.springframework.boot.test.autoconfigure.web.servlet;

import java.util.HashMap;
import java.util.Map;

import org.openqa.selenium.WebDriver;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.Scope;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.util.ClassUtils;

/**
 * A special scope used for {@link WebDriver} beans. Usually registered by a
 * {@link WebDriverContextCustomizerFactory} and reset by a
 * {@link WebDriverTestExecutionListener}.
 *
 * @author Phillip Webb
 * @see WebDriverContextCustomizerFactory
 * @see WebDriverTestExecutionListener
 */
class WebDriverScope implements Scope {

	public static final String NAME = "webDriver";

	private static final String WEB_DRIVER_CLASS = "org.openqa.selenium.WebDriver";

	private static final String[] BEAN_CLASSES = { WEB_DRIVER_CLASS,
			"org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder" };

	private final Map<String, Object> instances = new HashMap<String, Object>();

	@Override
	public Object get(String name, ObjectFactory<?> objectFactory) {
		synchronized (this.instances) {
			Object instance = this.instances.get(name);
			if (instance == null) {
				instance = objectFactory.getObject();
				this.instances.put(name, instance);
			}
			return instance;
		}
	}

	@Override
	public Object remove(String name) {
		synchronized (this.instances) {
			return this.instances.remove(name);
		}
	}

	@Override
	public void registerDestructionCallback(String name, Runnable callback) {
	}

	@Override
	public Object resolveContextualObject(String key) {
		return null;
	}

	@Override
	public String getConversationId() {
		return null;
	}

	/**
	 * Reset all instances in the scope.
	 * @return {@code true} if items were reset
	 */
	public boolean reset() {
		boolean reset = false;
		synchronized (this.instances) {
			for (Object instance : this.instances.values()) {
				reset = true;
				if (instance instanceof WebDriver) {
					((WebDriver) instance).quit();
				}
			}
			this.instances.clear();
		}
		return reset;
	}

	/**
	 * Register this scope with the specified context and reassign appropriate bean
	 * definitions to used it.
	 * @param context the application context
	 */
	public static void registerWith(ConfigurableApplicationContext context) {
		if (!ClassUtils.isPresent(WEB_DRIVER_CLASS, null)) {
			return;
		}
		ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
		if (beanFactory.getRegisteredScope(NAME) == null) {
			beanFactory.registerScope(NAME, new WebDriverScope());
		}
		context.addBeanFactoryPostProcessor(new BeanFactoryPostProcessor() {

			@Override
			public void postProcessBeanFactory(
					ConfigurableListableBeanFactory beanFactory) throws BeansException {
				for (String beanClass : BEAN_CLASSES) {
					for (String beanName : beanFactory.getBeanNamesForType(
							ClassUtils.resolveClassName(beanClass, null))) {
						beanFactory.getBeanDefinition(beanName).setScope(NAME);

					}
				}
			}

		});
	}

	/**
	 * Return the {@link WebDriverScope} being used by the specified context (if any).
	 * @param context the application context
	 * @return the web driver scope or {@code null}
	 */
	public static WebDriverScope getFrom(ApplicationContext context) {
		if (context instanceof ConfigurableApplicationContext) {
			Scope scope = ((ConfigurableApplicationContext) context).getBeanFactory()
					.getRegisteredScope(NAME);
			return (scope instanceof WebDriverScope ? (WebDriverScope) scope : null);
		}
		return null;
	}

}


text:
package org.apache.ivy.plugins.resolver;

import java.io.File;

import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.plugins.repository.ssh.AbstractSshBasedRepository;

/**
 * Abstract base class for all resolvers using SSH All necessary connection parameters can be set
 * here via attributes. However all attributes defined in the pattern url of the resolver will have
 * higher priority and will overwrite the values given here. To specify connection parameters in the
 * pattern, you have to specify a full url and not just a path as pattern. e.g.
 * pattern="/path/to/my/repos/[artifact].[ext]" will use all connection parameters from this class
 * e.g. pattern="ssh://myserver.com/path/to/my/repos/[artifact].[ext]" will use all parameters from
 * this class with the exception of the host, which will be "myserver.com" e.g.
 * pattern="sftp://user:geheim@myserver.com:8022/path/to/my/repos/[artifact].[ext]" will use only
 * the keyFile and keyFilePassword from this class (if needed). Rest will come from the url.
 */
public abstract class AbstractSshBasedResolver extends RepositoryResolver {

    private boolean passfileSet = false;

    public AbstractSshBasedResolver() {
        super();
    }

    private AbstractSshBasedRepository getSshBasedRepository() {
        return ((AbstractSshBasedRepository) getRepository());
    }

    /**
     * Sets the location of the Public Key file to use for authentication
     *
     * @param filePath
     *            full file path name
     */
    public void setKeyFile(File filePath) {
        getSshBasedRepository().setKeyFile(filePath);
    }

    /**
     * Determines whether a local SSH agent may be used for authentication
     *
     * @param allowedAgentUse
     *            true if an agent may be used if available
     */
    public void setAllowedAgentUse(boolean allowedAgentUse) {
        getSshBasedRepository().setAllowedAgentUse(allowedAgentUse);
    }

    /**
     * Optional password file. If set the repository will use it as an encrypted property file, to
     * load username and passwd entries, and to store them if the user choose to do so. Defaults to
     * user.dir/.ivy/[host].sftp.passwd, set it to null to disable this feature.
     *
     * @param passfile File
     */
    public void setPassfile(File passfile) {
        getSshBasedRepository().setPassFile(passfile);
        passfileSet = true;
    }

    public void setSettings(IvySettings settings) {
        super.setSettings(settings);
        if (!passfileSet) {
            getSshBasedRepository().setPassFile(
                new File(settings.getDefaultIvyUserDir(), getSshBasedRepository().getHost()
                        + ".ssh.passwd"));
        }
    }

    /**
     * Sets the password to authenticate the user if password based login is used if no password is
     * set and password based login is used, user will be prompted for it the password can also be
     * set by using a full url for the pattern, like
     * "sftp://user:password@myserver.com/path/to/repos/[artifact].[ext]"
     *
     * @param password
     *            to use
     */
    public void setUserPassword(String password) {
        getSshBasedRepository().setUserPassword(password);
    }

    /**
     * Sets the password to use for decrypting key file (if it is encrypted) if no password is set
     * and the keyfile is encrypted, the user will be prompted for the password if the keyfile is
     * passwordless, this parameter will be ignored if given
     *
     * @param password
     *            to use
     */
    public void setKeyFilePassword(String password) {
        getSshBasedRepository().setKeyFilePassword(password);
    }

    /**
     * sets the user to use for the ssh communication the user can also be set by using a full url
     * for the pattern, like "ssh://user@myserver.com/path/to/repos/[artifact].[ext]"
     *
     * @param user
     *            on the target system
     */
    public void setUser(String user) {
        getSshBasedRepository().setUser(user);
    }

    /**
     * sets the host to use for the ssh communication the host can also be set by using a full url
     * for the pattern, like "ssh://myserver.com/path/to/repos/[artifact].[ext]"
     *
     * @param host
     *            of the target system
     */
    public void setHost(String host) {
        getSshBasedRepository().setHost(host);
    }

    /**
     * sets the port to use for the ssh communication port 22 is default the port can also be set by
     * using a full url for the pattern, like
     * "sftp://myserver.com:8022/path/to/repos/[artifact].[ext]"
     *
     * @param port
     *            of the target system
     */
    public void setPort(int port) {
        getSshBasedRepository().setPort(port);
    }

    /**
     * sets the path to an OpenSSH-style config file to be used for reading configuration values for
     * an ssh repository, such as a username
     *
     * @param sshConfig
     *            path of the config file
     */
    public void setSshConfig(String sshConfig) {
        getSshBasedRepository().setSshConfig(sshConfig);
    }

    @Override
    public abstract String getTypeName();
}


text:
echo "# ================================== #"
# application process name
PROCESS_NAME="uniHelp"

# if exist a pid for the looked for application
# then do nothing it, otherwise start the application
if [ -n "`pgrep $PROCESS_NAME`" ]
then
  # notify user that application is already running
  echo "Application is already running."
else
  # clear logs content and recreate folder
  rm -rf logs/*
  mkdir -p logs

  # start node application in a separate process
  node app.js &

  # check bootstrap result
  START_RESULT=$?
  # if the bootstrap process produce an error,
  # report it to user and exit with a error status
  if [ "$START_RESULT" = "0" ]
  then
    echo "Application bootstrap completed without errors."
  else
    echo "Something went wrong during application bootstrap!"
    exit 1
  fi
fi
echo "# ================================== #"


text:
// Copyright (c) %%year%% Code Computerlove and other contributors
// Licensed under the MIT license
// version: %%version%%

// carousel.class.animation.js
(function(window, klass, Util, TouchElement){

	Util.registerNamespace('Code.PhotoSwipe.Carousel');
	var PhotoSwipe = window.Code.PhotoSwipe;

	PhotoSwipe.Carousel.CarouselClass = PhotoSwipe.Carousel.CarouselClass.extend({

		/*
		 * Function: getStartingPos
		 */
		getStartingPos: function(){

			var startingPos = this.touchStartPosition;

			if (Util.isNothing(startingPos)){
				startingPos = {
					x: window.parseInt(Util.DOM.getStyle(this.contentEl, 'left'), 0),
					y: window.parseInt(Util.DOM.getStyle(this.contentEl, 'top'), 0)
				};
			}

			return startingPos;

		},

		/*
		 * Function: doMoveCarousel
		 */
		doMoveCarousel: function(xVal){

			var style;

			if (Util.Browser.isCSSTransitionSupported){

				style = {};

				style[Util.Animation._transitionPrefix + 'Property'] = 'all';
				style[Util.Animation._transitionPrefix + 'Duration'] = '';
				style[Util.Animation._transitionPrefix + 'TimingFunction'] = '';
				style[Util.Animation._transitionPrefix + 'Delay'] = '0';
				style[Util.Animation._transformLabel] = (Util.Browser.is3dSupported) ? 'translate3d(' + xVal + 'px, 0px, 0px)' : 'translate(' + xVal + 'px, 0px)';

				if (Util.Browser.isRequestAnimationFrameSupported){
					Util.Animation.requestAnimationFrame(Util.DOM.setStyle(this.contentEl, style));
				}
				else {
					Util.DOM.setStyle(this.contentEl, style);
				}

			}
			else if (!Util.isNothing(window.jQuery)){

				if (Util.Browser.isRequestAnimationFrameSupported){
					Util.Animation.requestAnimationFrame(window.jQuery(this.contentEl).stop().css('left', this.getStartingPos().x + xVal + 'px'));
				}
				else {
					window.jQuery(this.contentEl).stop().css('left', this.getStartingPos().x + xVal + 'px');
				}

			}

		},

		/*
		 * Function: doSlideCarousel
		 */
		doSlideCarousel: function(xVal, speed){

			var
				animateProps,
				transform,
				slideTimingFunction = this.settings.slideTimingFunction;

			if (speed <= 0){

				this.slideByEndHandler();
				return;

			}

			if (speed < 150){
				slideTimingFunction = 'linear';
			}

			if (Util.Browser.isCSSTransitionSupported){

				transform = Util.Animation.getTransform(this.contentEl.style, '');

				if (transform.indexOf('translate3d(' + xVal) === 0){
					this.slideByEndHandler();
					return;
				}

				if (transform.indexOf('translate(' + xVal) === 0){
					this.slideByEndHandler();
					return;
				}

				Util.Animation.slideBy(this.contentEl, xVal, 0, speed, this.slideByEndHandler, slideTimingFunction);

			}
			else if (!Util.isNothing(window.jQuery)){

				animateProps = {
					left: this.getStartingPos().x + xVal + 'px'
				};

				if (slideTimingFunction === 'ease-out'){
					slideTimingFunction = 'easeOutQuad';
				}

				if ( Util.isNothing(window.jQuery.easing[slideTimingFunction]) ){
					slideTimingFunction = 'linear';
				}

				window.jQuery(this.contentEl).animate(
					animateProps,
					this.settings.slideSpeed,
					slideTimingFunction,
					this.slideByEndHandler
				);

			}

		}

	});

}
(
	window,
	window.klass,
	window.Code.Util,
	window.Code.PhotoSwipe.TouchElement
));


text:
<!DOCTYPE html>

  <title>Module</title>


text:
package com.fabiolee.architecture.mvp.ui.userlist;

import android.databinding.BindingAdapter;
import android.databinding.DataBindingUtil;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.fabiolee.architecture.mvp.BR;
import com.fabiolee.architecture.mvp.R;
import com.fabiolee.architecture.mvp.data.model.User;
import com.fabiolee.architecture.mvp.databinding.ItemUserBinding;
import com.fabiolee.repository.Repository;

import java.util.List;

/**
 * @author fabiolee
 */
public class UserListAdapter extends RecyclerView.Adapter<BindingViewHolder> {
    private static final String TAG = UserListAdapter.class.getSimpleName();

    private final UserListPresenter presenter;
    private List<User> userList;

    public UserListAdapter(UserListPresenter presenter, List<User> userList) {
        this.presenter = presenter;
        this.userList = userList;
    }

    @Override
    public BindingViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        LayoutInflater inflater = LayoutInflater.from(parent.getContext());
        ItemUserBinding binding = DataBindingUtil.inflate(inflater, R.layout.item_user, parent, false);
        return new BindingViewHolder(binding);
    }

    @Override
    public void onBindViewHolder(BindingViewHolder holder, int position) {
        User user = userList.get(position);
        holder.getBinding().setVariable(BR.presenter, presenter);
        holder.getBinding().setVariable(BR.user, user);
        holder.getBinding().executePendingBindings();
    }

    @Override
    public int getItemCount() {
        return userList.size();
    }

    public void setUserList(List<User> userList) {
        this.userList = userList;
        notifyDataSetChanged();
    }

    @BindingAdapter({"bind:loadImage"})
    public static void loadImage(ImageView view, String url) {
        Repository.with(view.getContext()).loadImage(url, view);
    }
}


text:
'use strict'

const fs = require('fs')
const { join, relative } = require('path')
const { Readable } = require('stream')
const glob = require('glob')
const loadJSON = require('load-json-file')
const writeJSON = require('write-json-file')

module.exports = createDatabase

const objectPathRegexp = /^\/((?:[^/]+?))\/((?:[^/]+?))\/((?:[^/]+?))(?:\/(?=$))?$/i
const pagePathRegexp = /^\/((?:[^/]+?))(?:\/((?:[^/]+?)))?(?:\/(?=$))?$/i

function createDatabase ({ prefix = 'data' }) {
  const load = path => loadJSON(path).catch(() => null)
  const save = (path, data) => writeJSON(path, data, { indent: 2 })
  return {
    getGlobals ({ language }) {
      language = language || 'not_localized'
      return load(join(prefix, language + '.json'))
    },

    getPage ({ language, name }) {
      language = language || 'not_localized'
      return load(join(prefix, language, name) + '.json')
    },

    getObject ({ language, type, id }) {
      language = language || 'not_localized'
      return load(join(prefix, language, type, id) + '.json')
    },

    saveGlobals (data, { language }) {
      language = language || 'not_localized'
      return save(join(prefix, language + '.json'), data)
    },

    savePage (data, { language, name }) {
      language = language || 'not_localized'
      return save(join(prefix, language, name) + '.json', data)
    },

    saveObject (data, { language, type, id }) {
      language = language || 'not_localized'
      return save(join(prefix, language, type, id) + '.json', data)
    },

    destroyObject ({ type, id }) {
      return Promise.all(
        glob.sync(join(prefix, '*', type, id + '.json'))
          .map(p =>
            new Promise((resolve, reject) => {
              fs.unlink(p, err => err ? reject(err) : resolve())
            })
          )
      )
    },

    getPages ({ language = '*' }) {
      const s = language === null ? 'not_localized' : language
      const pattern = join(prefix, s, '*.json')
      return createReadStream(pattern, {
        transform (o) {
          const match = o.key.match(pagePathRegexp)
          return Object.assign({}, o, {
            language: match[1],
            page: { name: match[2] }
          })
        }
      })
    },

    getObjects ({ language = '*', type = '*' }) {
      const s = language === null ? 'not_localized' : language
      const pattern = join(prefix, s, type, '*.json')
      return createReadStream(pattern, {
        transform (o) {
          const match = o.key.match(objectPathRegexp)
          return Object.assign({}, o, {
            language: match[1],
            object: { type: match[2], id: match[3] }
          })
        }
      })
    }
  }

  function createReadStream (pattern, { transform = f => f }) {
    let i = 0
    let eof = false
    const files = glob.sync(pattern).filter(file => {
      return !(relative(prefix, file).startsWith('not_localized/'))
    })
    return new Readable({
      objectMode: true,
      read (n) {
        const ps = []
        for (let j = 0; j < n && i < files.length; ++i, ++j) {
          const file = files[i]
          const p =
            loadJSON(file)
              .then(o => {
                this.push(transform({
                  key: '/' + relative(prefix, file).replace(/\.json$/, ''),
                  value: o
                }))
              })
              .catch(err => this.emit('error', err))
          ps.push(p)
        }
        if (eof) return
        eof = i === files.length
        Promise.all(ps).then(() => { if (eof) this.push(null) })
      }
    })
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">

    <scale
        android:fromXScale="2.0"
        android:fromYScale="2.0"
        android:toXScale="1.0"
        android:toYScale="1.0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:duration="500"
        android:repeatCount="1"
        android:repeatMode="reverse" />
</set>


text:
require 'spec_helper'
describe NCMB do
  before do
    yaml = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'setting.yml'))
    NCMB.initialize(
      application_key: yaml['application_key'],
      client_key: yaml['client_key']
    )
  end

  it 'Post #1' do
    text = 'Test task'
    queries = {todo: text}
    todo_class = NCMB::DataStore.new 'POST_TODO'
    todo = todo_class.new(queries).save
    todo.todo.should == text
  end

  it 'Post with location #1' do

  end
end


text:
package com.obidea.semantika.database;

import com.obidea.semantika.database.base.Column;
import com.obidea.semantika.database.base.DatabaseObject;
import com.obidea.semantika.database.base.ForeignKey;
import com.obidea.semantika.database.base.PrimaryKey;
import com.obidea.semantika.database.base.Schema;
import com.obidea.semantika.database.base.Table;
import com.obidea.semantika.util.StringUtils;

public class DatabaseObjectUtils
{
   /**
    * Creates a new Schema object. If the name equals to null or
    * empty string, the method gives a default name as "default".
    *
    * @param name
    *           the schema name.
    * @return Returns a new Schema object.
    */
   public static Schema makeSchema(String name)
   {
      if (StringUtils.isEmpty(name)) {
         return new Schema("default"); // $NON-NLS-1$
      }
      return new Schema(name);
   }

   /**
    * Creates a new Table object. If the schema name equals to null
    * or empty string, the method gives a default name as "default".
    *
    * @param schemaName
    *           the schema name, can be null or an empty string.
    * @param name
    *           the table name (mandatory input).
    * @return Returns a new Table object.
    */
   public static Table makeTable(String schemaName, String name)
   {
      return new Table(makeSchema(schemaName), name);
   }

   /**
    * Creates a new Column object. If the schema name equals to
    * null or empty string, the method gives a default name as
    * "default".
    *
    * @param schemaName
    *           the schema name, can be null or an empty string.
    * @param tableName
    *           the table name associated to the column (mandatory input).
    * @param name
    *           the column name (mandatory input).
    * @param datatype
    *           the column datatype, using JDBC Type constants (mandatory
    *           input).
    * @return Returns a new Column object.
    */
   public static Column makeColumn(String schemaName, String tableName, String name, int datatype)
   {
      return new Column(makeTable(schemaName, tableName), name, datatype);
   }

   /**
    * Creates a new Primary Key object. If the schema name equals to
    * null or empty string, the method gives a default name as
    * "default".
    *
    * @param schemaName
    *           the schema name, can be null or an empty string.
    * @param tableName
    *           the table name associated to the PK (mandatory input).
    * @param name
    *           the primary key name (mandatory input).
    * @return Returns a new Primary Key object.
    */
   public static PrimaryKey makePrimaryKey(String schemaName, String tableName, String name)
   {
      return new PrimaryKey(makeTable(schemaName, tableName), name);
   }

   /**
    * Creates a new Foreign Key object. If the schema name equals to
    * null or empty string, the method gives a default name as
    * "default".
    *
    * @param schemaName
    *           the schema name, can be null or an empty string.
    * @param tableName
    *           the table name associated to the FK (mandatory input).
    * @param name
    *           the foreign key name (mandatory input).
    * @return Returns a new Foreign Key object.
    */
   public static ForeignKey makeForeignKey(String schemaName, String tableName, String name)
   {
      return new ForeignKey(makeTable(schemaName, tableName), name);
   }

   public static String toString(DatabaseObject dbo)
   {
      if (dbo == null) {
         return "<null>"; //$NON-NLS-1$
      }
      else {
         StringBuilder sb = new StringBuilder();
         toString(dbo, sb);
         return sb.toString();
      }
   }

   public static void toString(DatabaseObject dbo, StringBuilder sb)
   {
      if (dbo instanceof Schema) {
         Schema schema = (Schema) dbo;
         sb.append(schema.getFullName());
      }
      else if (dbo instanceof Table) {
         Table table = (Table) dbo;
         sb.append(table.getFullName());
      }
      else if (dbo instanceof Column) {
         Column column = (Column) dbo;
         sb.append(column.getFullName());
         sb.append(":"); //$NON-NLS-1$
         sb.append(column.getSqlType());
      }
      else if (dbo instanceof PrimaryKey) {
         PrimaryKey pk = (PrimaryKey) dbo;
         sb.append(pk.getLocalName());
         sb.append(pk.getKeys());
      }
      else if (dbo instanceof ForeignKey) {
         ForeignKey fk = (ForeignKey) dbo;
         sb.append(fk.getLocalName());
         sb.append(fk.getReferences());
      }
   }
}


text:
package org.xwalk.embedding.test;

import org.chromium.base.test.util.Feature;
import org.xwalk.embedding.MainActivity;
import org.xwalk.embedding.base.ExtensionEcho;
import org.xwalk.embedding.base.XWalkViewTestBase;

import android.annotation.SuppressLint;
import android.test.suitebuilder.annotation.SmallTest;

@SuppressLint("NewApi")
public class ExtensionEchoTest extends XWalkViewTestBase {
	private final static String PASS_STRING = "Pass";

    @SmallTest
    @Feature({"ExtensionEcho"})
    public void testOnMessage() throws Throwable {
        ExtensionEcho echo = new ExtensionEcho();

        loadAssetFileAndWaitForTitle("echo.html");
        assertEquals(PASS_STRING, getTitleOnUiThread());
    }

    @SmallTest
    @Feature({"ExtensionEcho"})
    public void testOnSyncMessage() throws Throwable {
        ExtensionEcho echo = new ExtensionEcho();

        loadAssetFile("echoSync.html");
        assertEquals(PASS_STRING, getTitleOnUiThread());
    }

    @SmallTest
    @Feature({"ExtensionEcho"})
    public void testMultiFrames() throws Throwable {
        ExtensionEcho echo = new ExtensionEcho();

        loadAssetFileAndWaitForTitle("framesEcho.html");
        assertEquals(PASS_STRING, getTitleOnUiThread());
    }
}


text:
// Copyright 2018 Google LLC
//
// 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.

#import <XCTest/XCTest.h>
#import <objc/runtime.h>

#import "GoogleUtilities/ISASwizzler/GULObjectSwizzler+Internal.h"
#import "GoogleUtilities/ISASwizzler/Public/GoogleUtilities/GULSwizzledObject.h"
#import "GoogleUtilities/SwizzlerTestHelpers/GULProxy.h"

@interface GULObjectSwizzlerTest : XCTestCase

@end

@implementation GULObjectSwizzlerTest

/** Used as a donor method to add a method that doesn't exist on the superclass. */
- (NSString *)donorDescription {
  return @"SwizzledDonorDescription";
}

/** Used as a donor method to add a method that exists on the superclass. */
- (NSString *)description {
  return @"SwizzledDescription";
}

/** Exists just as a donor method. */
- (void)donorMethod {
}

- (void)testRetainedAssociatedObjects {
  NSObject *object = [[NSObject alloc] init];
  NSObject *associatedObject = [[NSObject alloc] init];
  size_t addressOfAssociatedObject = (size_t)&associatedObject;
  [GULObjectSwizzler setAssociatedObject:object
                                     key:@"test"
                                   value:associatedObject
                             association:GUL_ASSOCIATION_RETAIN];
  associatedObject = nil;
  associatedObject = [GULObjectSwizzler getAssociatedObject:object key:@"test"];
  XCTAssertEqual((size_t)&associatedObject, addressOfAssociatedObject);
  XCTAssertNotNil(associatedObject);
}

/** Tests that creating an object swizzler works. */
- (void)testObjectSwizzlerInit {
  NSObject *object = [[NSObject alloc] init];
  GULObjectSwizzler *objectSwizzler = [[GULObjectSwizzler alloc] initWithObject:object];
  XCTAssertNotNil(objectSwizzler);
}

/** Tests that you're able to swizzle an object. */
- (void)testSwizzle {
  NSObject *object = [[NSObject alloc] init];
  GULObjectSwizzler *objectSwizzler = [[GULObjectSwizzler alloc] initWithObject:object];
  XCTAssertEqual([object class], [NSObject class]);
  [objectSwizzler swizzle];
  XCTAssertNotEqual([object class], [NSObject class]);
  XCTAssertTrue([[object class] isSubclassOfClass:[NSObject class]]);
  XCTAssertTrue([object respondsToSelector:@selector(gul_class)]);
}

/** Tests that swizzling a nil object fails. */
- (void)testSwizzleNil {
  NSObject *object = [[NSObject alloc] init];
  GULObjectSwizzler *objectSwizzler = [[GULObjectSwizzler alloc] initWithObject:object];
  XCTAssertEqual([object class], [NSObject class]);
  object = nil;
  XCTAssertThrows([objectSwizzler swizzle]);
}

/** Tests the ability to copy a selector from one class to the swizzled object's generated class. */
- (void)testCopySelectorFromClassIsClassSelectorAndSwizzle {
  NSObject *object = [[NSObject alloc] init];
  GULObjectSwizzler *objectSwizzler = [[GULObjectSwizzler alloc] initWithObject:object];
  [objectSwizzler copySelector:@selector(donorMethod) fromClass:[self class] isClassSelector:NO];
  XCTAssertFalse([object respondsToSelector:@selector(donorMethod)]);
  XCTAssertFalse([[object class] instancesRespondToSelector:@selector(donorMethod)]);
  [objectSwizzler swizzle];
  XCTAssertTrue([object respondsToSelector:@selector(donorMethod)]);
  // [object class] should return the original class, not the swizzled class.
  XCTAssertTrue(
      [[(GULSwizzledObject *)object gul_class] instancesRespondToSelector:@selector(donorMethod)]);
}

/** Tests that some helper methods are always added to swizzled objects. */
- (void)testCommonSelectorsAddedUponSwizzling {
  NSObject *object = [[NSObject alloc] init];
  GULObjectSwizzler *objectSwizzler = [[GULObjectSwizzler alloc] initWithObject:object];
  XCTAssertFalse([object respondsToSelector:@selector(gul_class)]);
  [objectSwizzler swizzle];
  XCTAssertTrue([object respondsToSelector:@selector(gul_class)]);
}

/** Tests that there's no retain cycle and that -dealloc causes unswizzling. */
- (void)testRetainCycleDoesntExistAndDeallocCausesUnswizzling {
  NSObject *object = [[NSObject alloc] init];
  GULObjectSwizzler *objectSwizzler = [[GULObjectSwizzler alloc] initWithObject:object];
  [objectSwizzler copySelector:@selector(donorMethod) fromClass:[self class] isClassSelector:NO];
  [objectSwizzler swizzle];
  // If objectSwizzler were used, the strong reference would make it live to the end of this test.
  // We want to make sure it dies when the object dies, hence the weak reference.
  __weak GULObjectSwizzler *weakObjectSwizzler = objectSwizzler;
  objectSwizzler = nil;
  XCTAssertNotNil(weakObjectSwizzler);
  object = nil;
  XCTAssertNil(weakObjectSwizzler);
}

/** Tests the class get/set associated object methods. */
- (void)testClassSetAssociatedObjectCopy {
  NSObject *object = [[NSObject alloc] init];
  NSDictionary *objectToBeAssociated = [[NSDictionary alloc] init];
  [GULObjectSwizzler setAssociatedObject:object
                                     key:@"fir_key"
                                   value:objectToBeAssociated
                             association:GUL_ASSOCIATION_COPY];
  NSDictionary *returnedObject = [GULObjectSwizzler getAssociatedObject:object key:@"fir_key"];
  XCTAssertEqualObjects(returnedObject, objectToBeAssociated);
}

/** Tests the class get/set associated object methods. */
- (void)testClassSetAssociatedObjectAssign {
  NSObject *object = [[NSObject alloc] init];
  NSDictionary *objectToBeAssociated = [[NSDictionary alloc] init];
  [GULObjectSwizzler setAssociatedObject:object
                                     key:@"fir_key"
                                   value:objectToBeAssociated
                             association:GUL_ASSOCIATION_ASSIGN];
  NSDictionary *returnedObject = [GULObjectSwizzler getAssociatedObject:object key:@"fir_key"];
  XCTAssertEqualObjects(returnedObject, objectToBeAssociated);
}

/** Tests the class get/set associated object methods. */
- (void)testClassSetAssociatedObjectRetain {
  NSObject *object = [[NSObject alloc] init];
  NSDictionary *objectToBeAssociated = [[NSDictionary alloc] init];
  [GULObjectSwizzler setAssociatedObject:object
                                     key:@"fir_key"
                                   value:objectToBeAssociated
                             association:GUL_ASSOCIATION_RETAIN];
  NSDictionary *returnedObject = [GULObjectSwizzler getAssociatedObject:object key:@"fir_key"];
  XCTAssertEqualObjects(returnedObject, objectToBeAssociated);
}

/** Tests the class get/set associated object methods. */
- (void)testClassSetAssociatedObjectCopyNonatomic {
  NSObject *object = [[NSObject alloc] init];
  NSDictionary *objectToBeAssociated = [[NSDictionary alloc] init];
  [GULObjectSwizzler setAssociatedObject:object
                                     key:@"fir_key"
                                   value:objectToBeAssociated
                             association:GUL_ASSOCIATION_COPY_NONATOMIC];
  NSDictionary *returnedObject = [GULObjectSwizzler getAssociatedObject:object key:@"fir_key"];
  XCTAssertEqualObjects(returnedObject, objectToBeAssociated);
}

/** Tests the class get/set associated object methods. */
- (void)testClassSetAssociatedObjectRetainNonatomic {
  NSObject *object = [[NSObject alloc] init];
  NSDictionary *objectToBeAssociated = [[NSDictionary alloc] init];
  [GULObjectSwizzler setAssociatedObject:object
                                     key:@"fir_key"
                                   value:objectToBeAssociated
                             association:GUL_ASSOCIATION_RETAIN_NONATOMIC];
  NSDictionary *returnedObject = [GULObjectSwizzler getAssociatedObject:object key:@"fir_key"];
  XCTAssertEqualObjects(returnedObject, objectToBeAssociated);
}

/** Tests the swizzler get/set associated object methods. */
- (void)testSetGetAssociatedObjectCopy {
  NSObject *object = [[NSObject alloc] init];
  NSDictionary *associatedObject = [[NSDictionary alloc] init];
  GULObjectSwizzler *swizzler = [[GULObjectSwizzler alloc] initWithObject:object];
  [swizzler setAssociatedObjectWithKey:@"key"
                                 value:associatedObject
                           association:GUL_ASSOCIATION_COPY];
  NSDictionary *returnedObject = [swizzler getAssociatedObjectForKey:@"key"];
  XCTAssertEqualObjects(returnedObject, associatedObject);
}

/** Tests the swizzler get/set associated object methods. */
- (void)testSetGetAssociatedObjectAssign {
  NSObject *object = [[NSObject alloc] init];
  NSDictionary *associatedObject = [[NSDictionary alloc] init];
  GULObjectSwizzler *swizzler = [[GULObjectSwizzler alloc] initWithObject:object];
  [swizzler setAssociatedObjectWithKey:@"key"
                                 value:associatedObject
                           association:GUL_ASSOCIATION_ASSIGN];
  NSDictionary *returnedObject = [swizzler getAssociatedObjectForKey:@"key"];
  XCTAssertEqualObjects(returnedObject, associatedObject);
}

/** Tests the swizzler get/set associated object methods. */
- (void)testSetGetAssociatedObjectRetain {
  NSObject *object = [[NSObject alloc] init];
  NSDictionary *associatedObject = [[NSDictionary alloc] init];
  GULObjectSwizzler *swizzler = [[GULObjectSwizzler alloc] initWithObject:object];
  [swizzler setAssociatedObjectWithKey:@"key"
                                 value:associatedObject
                           association:GUL_ASSOCIATION_RETAIN];
  NSDictionary *returnedObject = [swizzler getAssociatedObjectForKey:@"key"];
  XCTAssertEqualObjects(returnedObject, associatedObject);
}

/** Tests the swizzler get/set associated object methods. */
- (void)testSetGetAssociatedObjectCopyNonatomic {
  NSObject *object = [[NSObject alloc] init];
  NSDictionary *associatedObject = [[NSDictionary alloc] init];
  GULObjectSwizzler *swizzler = [[GULObjectSwizzler alloc] initWithObject:object];
  [swizzler setAssociatedObjectWithKey:@"key"
                                 value:associatedObject
                           association:GUL_ASSOCIATION_COPY_NONATOMIC];
  NSDictionary *returnedObject = [swizzler getAssociatedObjectForKey:@"key"];
  XCTAssertEqualObjects(returnedObject, associatedObject);
}

/** Tests the swizzler get/set associated object methods. */
- (void)testSetGetAssociatedObjectRetainNonatomic {
  NSObject *object = [[NSObject alloc] init];
  NSDictionary *associatedObject = [[NSDictionary alloc] init];
  GULObjectSwizzler *swizzler = [[GULObjectSwizzler alloc] initWithObject:object];
  [swizzler setAssociatedObjectWithKey:@"key"
                                 value:associatedObject
                           association:GUL_ASSOCIATION_RETAIN_NONATOMIC];
  NSDictionary *returnedObject = [swizzler getAssociatedObjectForKey:@"key"];
  XCTAssertEqualObjects(returnedObject, associatedObject);
}

/** Tests getting and setting an associated object with an invalid association type. */
- (void)testSetGetAssociatedObjectWithoutProperAssociation {
  NSObject *object = [[NSObject alloc] init];
  NSDictionary *associatedObject = [[NSDictionary alloc] init];
  GULObjectSwizzler *swizzler = [[GULObjectSwizzler alloc] initWithObject:object];
  [swizzler setAssociatedObjectWithKey:@"key" value:associatedObject association:1337];
  NSDictionary *returnedObject = [swizzler getAssociatedObjectForKey:@"key"];
  XCTAssertEqualObjects(returnedObject, associatedObject);
}

/** Tests using the GULObjectSwizzler to swizzle an object wrapped in an NSProxy. */
- (void)testSwizzleProxiedObject {
  NSObject *object = [[NSObject alloc] init];
  GULProxy *proxyObject = [GULProxy proxyWithDelegate:object];
  GULObjectSwizzler *swizzler = [[GULObjectSwizzler alloc] initWithObject:proxyObject];

  XCTAssertNoThrow([swizzler swizzle]);

  XCTAssertNotEqual(object_getClass(proxyObject), [GULProxy class]);
  XCTAssertTrue([object_getClass(proxyObject) isSubclassOfClass:[GULProxy class]]);

  XCTAssertTrue([proxyObject respondsToSelector:@selector(gul_objectSwizzler)]);
  XCTAssertNoThrow([proxyObject performSelector:@selector(gul_objectSwizzler)]);

  XCTAssertTrue([proxyObject respondsToSelector:@selector(gul_class)]);
  XCTAssertNoThrow([proxyObject performSelector:@selector(gul_class)]);
}

/** Tests overriding a method that already exists on a proxied object works as expected. */
- (void)testSwizzleProxiedObjectInvokesInjectedMethodWhenOverridingMethod {
  NSObject *object = [[NSObject alloc] init];
  GULProxy *proxyObject = [GULProxy proxyWithDelegate:object];

  GULObjectSwizzler *swizzler = [[GULObjectSwizzler alloc] initWithObject:proxyObject];
  [swizzler copySelector:@selector(description)
               fromClass:[GULObjectSwizzlerTest class]
         isClassSelector:NO];
  [swizzler swizzle];

  XCTAssertEqual([proxyObject performSelector:@selector(description)], @"SwizzledDescription");
}

/** Tests adding a method that doesn't exist on a proxied object works as expected. */
- (void)testSwizzleProxiedObjectInvokesInjectedMethodWhenAddingMethod {
  NSObject *object = [[NSObject alloc] init];
  GULProxy *proxyObject = [GULProxy proxyWithDelegate:object];

  GULObjectSwizzler *swizzler = [[GULObjectSwizzler alloc] initWithObject:proxyObject];
  [swizzler copySelector:@selector(donorDescription)
               fromClass:[GULObjectSwizzlerTest class]
         isClassSelector:NO];
  [swizzler swizzle];

  XCTAssertEqual([proxyObject performSelector:@selector(donorDescription)],
                 @"SwizzledDonorDescription");
}

/** Tests KVOing a proxy object that we've ISA Swizzled works as expected. */
- (void)testRespondsToSelectorWorksEvenIfSwizzledProxyIsKVOd {
  NSObject *object = [[NSObject alloc] init];
  GULProxy *proxyObject = [GULProxy proxyWithDelegate:object];

  GULObjectSwizzler *swizzler = [[GULObjectSwizzler alloc] initWithObject:proxyObject];
  [swizzler copySelector:@selector(donorDescription)
               fromClass:[GULObjectSwizzlerTest class]
         isClassSelector:NO];
  [swizzler swizzle];

  [(NSObject *)proxyObject addObserver:self
                            forKeyPath:NSStringFromSelector(@selector(description))
                               options:0
                               context:NULL];

  XCTAssertTrue([proxyObject respondsToSelector:@selector(donorDescription)]);
  XCTAssertEqual([proxyObject performSelector:@selector(donorDescription)],
                 @"SwizzledDonorDescription");

  [(NSObject *)proxyObject removeObserver:self
                               forKeyPath:NSStringFromSelector(@selector(description))];
}

// TODO: Investigate why this test fails in Swift PM build.

/** Tests that -[NSObjectProtocol respondsToSelector:] works as expected after someone else ISA
 *  swizzles a proxy object that we've also ISA Swizzled.
 */
- (void)testRespondsToSelectorWorksEvenIfSwizzledProxyISASwizzledBySomeoneElse {
  Class generatedClass = nil;
  __weak GULObjectSwizzler *weakSwizzler;

  @autoreleasepool {
    NSObject *object = [[NSObject alloc] init];
    GULProxy *proxyObject = [GULProxy proxyWithDelegate:object];

    GULObjectSwizzler *swizzler = [[GULObjectSwizzler alloc] initWithObject:proxyObject];
    weakSwizzler = swizzler;
    [swizzler copySelector:@selector(donorDescription)
                 fromClass:[GULObjectSwizzlerTest class]
           isClassSelector:NO];
    [swizzler swizzle];

    // Someone else ISA Swizzles the same object after GULObjectSwizzler.
    Class originalClass = object_getClass(proxyObject);
    NSString *newClassName = [NSString
        stringWithFormat:@"gul_test_%p_%@", proxyObject, NSStringFromClass(originalClass)];
    generatedClass = objc_allocateClassPair(originalClass, newClassName.UTF8String, 0);
    objc_registerClassPair(generatedClass);
    object_setClass(proxyObject, generatedClass);

    XCTAssertTrue([proxyObject respondsToSelector:@selector(donorDescription)]);
    XCTAssertEqual([proxyObject performSelector:@selector(donorDescription)],
                   @"SwizzledDonorDescription");

    // Release GULObjectSwizzler
    [GULObjectSwizzler setAssociatedObject:proxyObject
                                       key:kGULSwizzlerAssociatedObjectKey
                                     value:nil
                               association:GUL_ASSOCIATION_RETAIN];
  }
  XCTAssertNil(weakSwizzler);

  // Clean up.
  objc_disposeClassPair(generatedClass);
}

#if !TARGET_OS_MACCATALYST
// Test fails on Catalyst due to an interaction with GULSceneDelegateSwizzlerTests.

- (void)testSwizzlerDoesntDisposeGeneratedClassWhenObjectIsISASwizzledBySomeoneElse {
  Class generatedClass = nil;
  __weak GULObjectSwizzler *weakSwizzler;

  XCTestExpectation *swizzlerDeallocatedExpectation =
      [self expectationWithDescription:@"swizzlerDeallocatedExpectation"];

  @autoreleasepool {
    NSObject *object = [[NSObject alloc] init];

    @autoreleasepool {
      GULObjectSwizzler *swizzler = [[GULObjectSwizzler alloc] initWithObject:object];
      weakSwizzler = swizzler;
      [swizzler copySelector:@selector(donorDescription)
                   fromClass:[GULObjectSwizzlerTest class]
             isClassSelector:NO];
      [swizzler swizzle];
    }

    // Someone else ISA Swizzles the same object after GULObjectSwizzler.
    Class originalClass = object_getClass(object);
    NSString *newClassName =
        [NSString stringWithFormat:@"gul_test_%p_%@", object, NSStringFromClass(originalClass)];
    generatedClass = objc_allocateClassPair(originalClass, newClassName.UTF8String, 0);
    objc_registerClassPair(generatedClass);
    object_setClass(object, generatedClass);

    // Release GULObjectSwizzler
    [GULObjectSwizzler setAssociatedObject:object
                                       key:kGULSwizzlerAssociatedObjectKey
                                     value:nil
                               association:GUL_ASSOCIATION_RETAIN];

    // Wait for a while
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)),
                   dispatch_get_main_queue(), ^{
                     [swizzlerDeallocatedExpectation fulfill];
                   });

    [self waitForExpectations:@[ swizzlerDeallocatedExpectation ] timeout:2];

    XCTAssertNil(weakSwizzler);
    // A class generated by GULObjectSwizzler must not be disposed if there is its subclass.
    XCTAssertNoThrow([generatedClass description]);
  }

  // Clean up.
  objc_disposeClassPair(generatedClass);
}
#endif

// The test is disabled because in the case of success it should crash with SIGABRT, so it is not
// suitable for CI.
- (void)disabledForCI_testSwizzlerDisposesGeneratedClass {
  __weak GULObjectSwizzler *weakSwizzler;

  XCTestExpectation *swizzlerDeallocatedExpectation =
      [self expectationWithDescription:@"swizzlerDeallocatedExpectation"];

  @autoreleasepool {
    NSObject *object = [[NSObject alloc] init];

    @autoreleasepool {
      GULObjectSwizzler *swizzler = [[GULObjectSwizzler alloc] initWithObject:object];
      weakSwizzler = swizzler;
      [swizzler copySelector:@selector(donorDescription)
                   fromClass:[GULObjectSwizzlerTest class]
             isClassSelector:NO];
      [swizzler swizzle];
    }

    // Release GULObjectSwizzler
    [GULObjectSwizzler setAssociatedObject:object
                                       key:kGULSwizzlerAssociatedObjectKey
                                     value:nil
                               association:GUL_ASSOCIATION_RETAIN];

    // Wait for a while until GULObjectSwizzler has disposed the generated class.
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)),
                   dispatch_get_main_queue(), ^{
                     [swizzlerDeallocatedExpectation fulfill];
                   });

    [self waitForExpectations:@[ swizzlerDeallocatedExpectation ] timeout:2];

    XCTAssertNil(weakSwizzler);

    // Must crash here with SIGABRT.
    XCTAssertThrows([object description]);
    XCTFail(@"The test must have crashed on the previous line.");
  }
}

- (void)testMultiSwizzling {
  NSObject *object = [[NSObject alloc] init];

  __weak GULObjectSwizzler *existingSwizzler;

  // Use @autoreleasepool to make the memory management in the test more deterministic.
  @autoreleasepool {
    NSInteger swizzleCount = 10;
    for (NSInteger i = 0; i < swizzleCount; i++) {
      GULObjectSwizzler *swizzler = [[GULObjectSwizzler alloc] initWithObject:object];

      if (i > 0) {
        XCTAssertEqualObjects(swizzler, existingSwizzler,
                              @"There must be a single swizzler per object.");
      } else {
        existingSwizzler = swizzler;
      }

      [swizzler copySelector:@selector(donorDescription)
                   fromClass:[GULObjectSwizzlerTest class]
             isClassSelector:NO];
      [swizzler swizzle];
    }

    XCTAssertNoThrow([object performSelector:@selector(donorDescription)]);
    object = nil;
  }

  XCTAssertNil(existingSwizzler,
               @"GULObjectSwizzler must be deallocated after the object deallocation.");
}

@end


text:
using InterfaceTestLibrary.Ext.A;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InterfaceTestLibrary
{
    public class DoNothing
    {
        public void DoSomething(LibA.InterfaceA a)
        {
            //a.cre = new ExtensionLib();
        }

    }
}


text:
"""Unit tests for SerializedDagModel."""

import unittest

from airflow import DAG, example_dags as example_dags_module
from airflow.models import DagBag
from airflow.models.dagcode import DagCode
from airflow.models.serialized_dag import SerializedDagModel as SDM
from airflow.serialization.serialized_objects import SerializedDAG
from airflow.utils.session import create_session
from tests.test_utils.asserts import assert_queries_count

# To move it to a shared module.
def make_example_dags(module):
    """Loads DAGs from a module for test."""
    dagbag = DagBag(module.__path__[0])
    return dagbag.dags

def clear_db_serialized_dags():
    with create_session() as session:
        session.query(SDM).delete()

class SerializedDagModelTest(unittest.TestCase):
    """Unit tests for SerializedDagModel."""

    def setUp(self):
        clear_db_serialized_dags()

    def tearDown(self):
        clear_db_serialized_dags()

    def test_dag_fileloc_hash(self):
        """Verifies the correctness of hashing file path."""
        assert DagCode.dag_fileloc_hash('/airflow/dags/test_dag.py') == 33826252060516589

    def _write_example_dags(self):
        example_dags = make_example_dags(example_dags_module)
        for dag in example_dags.values():
            SDM.write_dag(dag)
        return example_dags

    def test_write_dag(self):
        """DAGs can be written into database."""
        example_dags = self._write_example_dags()

        with create_session() as session:
            for dag in example_dags.values():
                assert SDM.has_dag(dag.dag_id)
                result = session.query(SDM.fileloc, SDM.data).filter(SDM.dag_id == dag.dag_id).one()

                assert result.fileloc == dag.full_filepath
                # Verifies JSON schema.
                SerializedDAG.validate_schema(result.data)

    def test_serialized_dag_is_updated_only_if_dag_is_changed(self):
        """Test Serialized DAG is updated if DAG is changed"""

        example_dags = make_example_dags(example_dags_module)
        example_bash_op_dag = example_dags.get("example_bash_operator")
        dag_updated = SDM.write_dag(dag=example_bash_op_dag)
        assert dag_updated is True

        with create_session() as session:
            s_dag = session.query(SDM).get(example_bash_op_dag.dag_id)

            # Test that if DAG is not changed, Serialized DAG is not re-written and last_updated
            # column is not updated
            dag_updated = SDM.write_dag(dag=example_bash_op_dag)
            s_dag_1 = session.query(SDM).get(example_bash_op_dag.dag_id)

            assert s_dag_1.dag_hash == s_dag.dag_hash
            assert s_dag.last_updated == s_dag_1.last_updated
            assert dag_updated is False

            # Update DAG
            example_bash_op_dag.tags += ["new_tag"]
            assert set(example_bash_op_dag.tags) == {"example", "example2", "new_tag"}

            dag_updated = SDM.write_dag(dag=example_bash_op_dag)
            s_dag_2 = session.query(SDM).get(example_bash_op_dag.dag_id)

            assert s_dag.last_updated != s_dag_2.last_updated
            assert s_dag.dag_hash != s_dag_2.dag_hash
            assert s_dag_2.data["dag"]["tags"] == ["example", "example2", "new_tag"]
            assert dag_updated is True

    def test_read_dags(self):
        """DAGs can be read from database."""
        example_dags = self._write_example_dags()
        serialized_dags = SDM.read_all_dags()
        assert len(example_dags) == len(serialized_dags)
        for dag_id, dag in example_dags.items():
            serialized_dag = serialized_dags[dag_id]

            assert serialized_dag.dag_id == dag.dag_id
            assert set(serialized_dag.task_dict) == set(dag.task_dict)

    def test_remove_dags_by_id(self):
        """DAGs can be removed from database."""
        example_dags_list = list(self._write_example_dags().values())
        # Remove SubDags from the list as they are not stored in DB in a separate row
        # and are directly added in Json blob of the main DAG
        filtered_example_dags_list = [dag for dag in example_dags_list if not dag.is_subdag]
        # Tests removing by dag_id.
        dag_removed_by_id = filtered_example_dags_list[0]
        SDM.remove_dag(dag_removed_by_id.dag_id)
        assert not SDM.has_dag(dag_removed_by_id.dag_id)

    def test_remove_dags_by_filepath(self):
        """DAGs can be removed from database."""
        example_dags_list = list(self._write_example_dags().values())
        # Remove SubDags from the list as they are not stored in DB in a separate row
        # and are directly added in Json blob of the main DAG
        filtered_example_dags_list = [dag for dag in example_dags_list if not dag.is_subdag]
        # Tests removing by file path.
        dag_removed_by_file = filtered_example_dags_list[0]
        # remove repeated files for those DAGs that define multiple dags in the same file (set comprehension)
        example_dag_files = list({dag.full_filepath for dag in filtered_example_dags_list})
        example_dag_files.remove(dag_removed_by_file.full_filepath)
        SDM.remove_deleted_dags(example_dag_files)
        assert not SDM.has_dag(dag_removed_by_file.dag_id)

    def test_bulk_sync_to_db(self):
        dags = [
            DAG("dag_1"),
            DAG("dag_2"),
            DAG("dag_3"),
        ]
        with assert_queries_count(10):
            SDM.bulk_sync_to_db(dags)


text:
module Fog
  module Compute
    class AWS
      class Real
        require 'fog/aws/parsers/compute/basic'

        # Deletes a network ACL entry
        #
        # ==== Parameters
        # * network_acl_id<~String> - The ID of the network ACL
        # * rule_number<~Integer>   - The rule number of the entry to delete.
        # * egress<~Boolean>        - Indicates whether the rule is an egress rule (true) or ingress rule (false)
        #
        # === Returns
        # * response<~Excon::Response>:
        # * body<~Hash>:
        # * 'requestId'<~String> - Id of request
        # * 'return'<~Boolean> - Returns true if the request succeeds.
        #
        # {Amazon API Reference}[http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteNetworkAclEntry.html]
        def delete_network_acl_entry(network_acl_id, rule_number, egress)
          request(
            'Action'       => 'DeleteNetworkAclEntry',
            'NetworkAclId' => network_acl_id,
            'RuleNumber'   => rule_number,
            'Egress'       => egress,
            :parser        => Fog::Parsers::Compute::AWS::Basic.new
          )
        end
      end

      class Mock
        def delete_network_acl_entry(network_acl_id, rule_number, egress)
          response = Excon::Response.new
          if self.data[:network_acls][network_acl_id]
            if self.data[:network_acls][network_acl_id]['entrySet'].detect { |r| r['ruleNumber'] == rule_number && r['egress'] == egress }
              self.data[:network_acls][network_acl_id]['entrySet'].delete_if { |r| r['ruleNumber'] == rule_number && r['egress'] == egress }
            else
              raise Fog::Compute::AWS::Error.new("No rule with that number and egress value")
            end

            response.status = 200
            response.body = {
              'requestId' => Fog::AWS::Mock.request_id,
              'return'    => true
            }
            response
          else
            raise Fog::Compute::AWS::NotFound.new("The network ACL '#{network_acl_id}' does not exist")
          end
        end
      end
    end
  end
end


text:
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/text"
        android:background="#ccc"
        android:textStyle="bold"
        android:text="@string/label_calories_tip"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

    <TextView
        android:id="@+id/text_total"
        android:background="#ccc"
        android:textStyle="bold"
        android:textSize="20sp"
        android:layout_alignParentBottom="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

    <ListView
        android:id="@+id/list"
        android:layout_below="@id/text"
        android:layout_above="@id/text_total"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <RelativeLayout
        android:id="@+id/loading"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ProgressBar
            android:layout_centerInParent="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
    </RelativeLayout>

</RelativeLayout>