text:
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">

  <title>npyscreen.monthbox.DateEntryBase</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />

         Home

         Trees

         Indices

         Help

        Package npyscreen ::
        Module monthbox ::
        Class DateEntryBase

[hide private]

[frames] | no frames]

Class DateEntryBase
source code

         object --+
                  |
widget.InputHandler --+
                      |
          widget.Widget --+
                          |
                         DateEntryBase

        Instance Methods
        [hide private]

          __init__(self,
        screen,
        allowPastDate=True,
        allowTodaysDate=True,
        **keywords)

      The following named arguments may be supplied: name= set the name
      of the widget.

            source code

          _check_date(self)

            source code

          _check_today_validity(self,
        onErrorHigher=True)

      If not allowed to select today's date, and today is selected, move
      either higher or lower depending on the value of onErrorHigher

            source code

          set_up_handlers(self)

      This function should be called somewhere during object
      initialisation (which all library-defined widgets do).

            source code

          _reduce_value_by_delta(self,
        delta)

            source code

          _increase_value_by_delta(self,
        delta)

            source code

          h_day_less(self,
        *args)

            source code

          h_day_more(self,
        *args)

            source code

          h_week_less(self,
        *args)

            source code

          h_week_more(self,
        *args)

            source code

          h_month_less(self,
        *args)

            source code

          h_month_more(self,
        *args)

            source code

          h_year_less(self,
        *args)

            source code

          h_year_more(self,
        *args)

            source code

          h_find_today(self,
        *args)

            source code

Inherited from widget.Widget:
      calculate_area_needed,
      clear,
      destroy,
      display,
      edit,
      get_and_use_key_press,
      get_editable,
      safe_filter,
      safe_string,
      set_editable,
      set_size,
      space_available,
      try_adjust_widgets,
      update

Inherited from widget.InputHandler:
      add_complex_handlers,
      add_handlers,
      h_exit_down,
      h_exit_escape,
      h_exit_left,
      h_exit_right,
      h_exit_up,
      handle_input

Inherited from object:
      __delattr__,
      __getattribute__,
      __hash__,
      __new__,
      __reduce__,
      __reduce_ex__,
      __repr__,
      __setattr__,
      __str__

        Properties
        [hide private]

Inherited from object:
      __class__

        Method Details
        [hide private]

__init__(self,
        screen,
        allowPastDate=True,
        allowTodaysDate=True,
        **keywords)

(Constructor)

  	source code

  The following named arguments may be supplied: name= set the name of
  the widget. width= set the width of the widget. height= set the height.
  max_height= let the widget choose a height up to this maximum. max_width=
  let the widget choose a width up to this maximum. editable=True/False the
  user may change the value of the widget. hidden=True/False The widget is
  hidden.

Overrides:
      widget.Widget.__init__

(inherited documentation)

set_up_handlers(self)

  	source code

  This function should be called somewhere during object initialisation
  (which all library-defined widgets do). You might like to override this
  in your own definition, but in most cases the add_handers or
  add_complex_handlers methods are what you want.

Overrides:
      widget.InputHandler.set_up_handlers

(inherited documentation)

         Home

         Trees

         Indices

         Help

    Generated by Epydoc 3.0beta1 on Thu Mar 29 15:58:54 2007

      http://epydoc.sourceforge.net


text:
export const INPUT_HEIGHT = 45

// Heigth of default result line
export const RESULT_HEIGHT = 45

// Width of main window
export const WINDOW_WIDTH = 650

// Maximum results that would be rendered
export const MAX_RESULTS = 25

// Results view shows this count of resutls without scrollbar
export const MIN_VISIBLE_RESULTS = 10

redpajama_set_name: RedPajamaGithub


text:
#ifndef __NET_FIB_RULES_H
#define __NET_FIB_RULES_H

#include <linux/types.h>
#include <linux/slab.h>
#include <linux/netdevice.h>
#include <linux/fib_rules.h>
#include <net/flow.h>
#include <net/rtnetlink.h>

struct fib_rule {
	struct list_head	list;
	int			iifindex;
	int			oifindex;
	u32			mark;
	u32			mark_mask;
	u32			flags;
	u32			table;
	u8			action;
	/* 3 bytes hole, try to use */
	u32			target;
	struct fib_rule __rcu	*ctarget;
	struct net		*fr_net;

	atomic_t		refcnt;
	u32			pref;
	int			suppress_ifgroup;
	int			suppress_prefixlen;
	char			iifname[IFNAMSIZ];
	char			oifname[IFNAMSIZ];
	struct rcu_head		rcu;
};

struct fib_lookup_arg {
	void			*lookup_ptr;
	void			*result;
	struct fib_rule		*rule;
	int			flags;
#define FIB_LOOKUP_NOREF	1
};

struct fib_rules_ops {
	int			family;
	struct list_head	list;
	int			rule_size;
	int			addr_size;
	int			unresolved_rules;
	int			nr_goto_rules;

	int			(*action)(struct fib_rule *,
					  struct flowi *, int,
					  struct fib_lookup_arg *);
	bool			(*suppress)(struct fib_rule *,
					    struct fib_lookup_arg *);
	int			(*match)(struct fib_rule *,
					 struct flowi *, int);
	int			(*configure)(struct fib_rule *,
					     struct sk_buff *,
					     struct fib_rule_hdr *,
					     struct nlattr **);
	void			(*delete)(struct fib_rule *);
	int			(*compare)(struct fib_rule *,
					   struct fib_rule_hdr *,
					   struct nlattr **);
	int			(*fill)(struct fib_rule *, struct sk_buff *,
					struct fib_rule_hdr *);
	u32			(*default_pref)(struct fib_rules_ops *ops);
	size_t			(*nlmsg_payload)(struct fib_rule *);

	/* Called after modifications to the rules set, must flush
	 * the route cache if one exists. */
	void			(*flush_cache)(struct fib_rules_ops *ops);

	int			nlgroup;
	const struct nla_policy	*policy;
	struct list_head	rules_list;
	struct module		*owner;
	struct net		*fro_net;
	struct rcu_head		rcu;
};

#define FRA_GENERIC_POLICY \
	[FRA_IIFNAME]	= { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
	[FRA_OIFNAME]	= { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
	[FRA_PRIORITY]	= { .type = NLA_U32 }, \
	[FRA_FWMARK]	= { .type = NLA_U32 }, \
	[FRA_FWMASK]	= { .type = NLA_U32 }, \
	[FRA_TABLE]     = { .type = NLA_U32 }, \
	[FRA_SUPPRESS_PREFIXLEN] = { .type = NLA_U32 }, \
	[FRA_SUPPRESS_IFGROUP] = { .type = NLA_U32 }, \
	[FRA_GOTO]	= { .type = NLA_U32 }

static inline void fib_rule_get(struct fib_rule *rule)
{
	atomic_inc(&rule->refcnt);
}

static inline void fib_rule_put_rcu(struct rcu_head *head)
{
	struct fib_rule *rule = container_of(head, struct fib_rule, rcu);
	release_net(rule->fr_net);
	kfree(rule);
}

static inline void fib_rule_put(struct fib_rule *rule)
{
	if (atomic_dec_and_test(&rule->refcnt))
		call_rcu(&rule->rcu, fib_rule_put_rcu);
}

static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla)
{
	if (nla[FRA_TABLE])
		return nla_get_u32(nla[FRA_TABLE]);
	return frh->table;
}

struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *,
					 struct net *);
void fib_rules_unregister(struct fib_rules_ops *);

int fib_rules_lookup(struct fib_rules_ops *, struct flowi *, int flags,
		     struct fib_lookup_arg *);
int fib_default_rule_add(struct fib_rules_ops *, u32 pref, u32 table,
			 u32 flags);
u32 fib_default_rule_pref(struct fib_rules_ops *ops);
#endif


text:
package com.ae.apps.tripmeter.fragments.fuelcalc;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.ae.apps.tripmeter.R;
import com.ae.apps.tripmeter.managers.FuelCalcManager;
import com.ae.apps.tripmeter.models.FuelCalcResult;
import com.ae.apps.tripmeter.utils.AppConstants;

/**
 * A placeholder fragment containing a simple view.
 */
public class FuelCalcFragment extends Fragment {

    private static final String KEY_TRIP_DISTANCE = "key_trip_distance";

    private EditText txtTripDistance;
    private EditText txtFuelPrice;
    private EditText txtMileage;
    private TextView lblTotalCost;
    private TextView lblFuelNeeded;

    private Context mContext;
    private FuelCalcManager fuelCalcManager;

    public FuelCalcFragment() {
    }

    public static FuelCalcFragment newInstance(){
        return new FuelCalcFragment();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        mContext = getActivity().getBaseContext();

        // Create an instance of the Fuel Calc Manager
        fuelCalcManager = new FuelCalcManager(mContext);

        View inflatedView = inflater.inflate(R.layout.fragment_fuel_calc, container, false);

        initializeViews(inflatedView);

        retainPreviousValues(savedInstanceState);

        return inflatedView;
    }

    private void retainPreviousValues(Bundle bundle) {
        // Read last saved mileage and fuel price if exists
        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
        String strFuelPrice = sharedPreferences.getString(AppConstants.PREF_KEY_FUEL_PRICE, null);
        String strMileage = sharedPreferences.getString(AppConstants.PREF_KEY_MILEAGE, null);
        if(null != strFuelPrice && null != strMileage){
            txtFuelPrice.setText(strFuelPrice);
            txtMileage.setText(strMileage);
        }

        // Retain Trip Distance text on orientation changes
        if(null != bundle){
            txtTripDistance.setText(bundle.getString(KEY_TRIP_DISTANCE, ""));
        }
    }

    private void initializeViews(View inflatedView) {
        // Find text inputs and labels to show result
        txtTripDistance = (EditText) inflatedView.findViewById(R.id.txtDistance);
        txtFuelPrice = (EditText) inflatedView.findViewById(R.id.txtFuelPrice);
        txtMileage = (EditText) inflatedView.findViewById(R.id.txtMileage);
        lblFuelNeeded = (TextView) inflatedView.findViewById(R.id.lblFuelNeeded);
        lblTotalCost = (TextView) inflatedView.findViewById(R.id.lblTotalCost);

        // Show result text without placeholders on load
        lblFuelNeeded.setText( getResources().getString(R.string.str_total_fuel_needed, ""));
        lblTotalCost.setText(getResources().getString(R.string.str_total_fuel_price, ""));

        // Find and handle Calculate button clicks
        Button calculate = (Button) inflatedView.findViewById(R.id.btnCalculate);
        calculate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                validateAndCalculateTripCosts();
            }
        });
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        if(!TextUtils.isEmpty(txtTripDistance.getText().toString())){
            outState.putString(KEY_TRIP_DISTANCE, txtTripDistance.getText().toString());
        }
        super.onSaveInstanceState(outState);
    }

    @Override
    public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
        if(null != savedInstanceState){
            txtTripDistance.setText(savedInstanceState.getString(KEY_TRIP_DISTANCE, ""));
        }
        super.onViewStateRestored(savedInstanceState);
    }

    private void validateAndCalculateTripCosts() {
        if(!TextUtils.isEmpty(txtTripDistance.getText().toString())
                && !TextUtils.isEmpty(txtFuelPrice.getText().toString())
                && !TextUtils.isEmpty(txtMileage.getText().toString())){

            // Process data and make the calculations
            float tripDistance = Float.parseFloat(txtTripDistance.getText().toString());
            float fuelPrice = Float.parseFloat(txtFuelPrice.getText().toString());
            float mileage = Float.parseFloat(txtMileage.getText().toString());

            // Calculate the fuel and price needed
            FuelCalcResult calcResult = fuelCalcManager.calculateFuelAndPrice(tripDistance, fuelPrice, mileage);

            // Check for mileage greater than 0
            if(!calcResult.isDataError()){
                // Update labels in result card view
                String strFuelNeeded = String.format(AppConstants.RESULT_FORMAT, calcResult.getFuelQuantityNeeded());
                lblFuelNeeded.setText( getResources().getString(R.string.str_total_fuel_needed, strFuelNeeded));
                String strTotalFuelPrice = String.format(AppConstants.RESULT_FORMAT, calcResult.getFuelPriceTotal());
                lblTotalCost.setText(getResources().getString(R.string.str_total_fuel_price, strTotalFuelPrice));
            } else {
                Toast.makeText(mContext, R.string.str_error_no_mileage, Toast.LENGTH_LONG).show();
            }
        } else {
            Toast.makeText(mContext, R.string.str_error_empty_inputs, Toast.LENGTH_LONG).show();
        }
    }
}


text:
<?php

class Model{

	public $defaults = array(
	);

	public $attributes = array();

	/**
	 * __construct
	 *
	 * Carrega os atributos do model de acordo com as chaves do array $defaults de cada model criado.
	 *
	 * @version 1.0
	 * @param 	string 	$model 	Objeto com os atributos do model.
	 */
	public function __construct($model = array()){
		$this->attributes = $this->defaults;

		foreach ($model as $key => $value) {
			$this->{$key} = $value;
		}
	}

	/**
	 * __get
	 *
	 * ####
	 *
	 * @version 1.0
	 * @param 	string 	$name 	####
	 */
	public function __get($name)
	{

		if(method_exists($this, 'get' . ucfirst ( $name ))){ return call_user_func_array(array($this, 'get' . ucfirst ( $name )),array()); }

		if($name == 'attributes'){
			return $this->attributes;
		}

		if (array_key_exists($name, $this->attributes)) {
			return $this->attributes[$name];
		}

		return null;
	}

	/**
	 * __set
	 *
	 * ####
	 *
	 * @version 1.0
	 * @param 	string 	$name 	####
	 * @param 	string 	$value 	####
	 */
	public function __set($name, $value)
	{

		if($name == 'attributes' || $name == 'defaults'){
			$trace = debug_backtrace();
			trigger_error(
				'You cannot use "'. $name .'" to Model attribute'.
				' in ' . $trace[0]['file'] .
				' on line ' . $trace[0]['line'],
				E_USER_NOTICE);
			return null;
		}

		if(method_exists($this, 'set' . ucfirst ( $name ))){ return call_user_func_array(array($this, 'set' . ucfirst ( $name )), array($value)); }

		if( array_key_exists($name, $this->attributes) || array_key_exists($name, $this->defaults) ){
			$this->attributes[$name] = $value;
		}
	}

	/**
	 * update
	 *
	 * Cria um novo atributo no model, salvando um valor ao atributo.
	 *
	 * @version 1.0
	 * @param 	string 	$name 	(array ou string) Nome do novo atributo.
	 * @param 	string 	$value 	Valor do campo.
	 */
	public function update($name, $value = null){
		if( is_array( $name ) ){
			foreach ($name as $key => $value) {
				if(isset($this->attributes[$key])){
					$this->{$key} = $value;
				}else{
					$this->attributes[$key] = $value;
				}
			}
		}else{
			if(isset($this->attributes[$name])){
				$this->{$name} = $value;
			}else{
				$this->attributes[$name] = $value;
			}
		}
	}

	/**
	 * toJSON
	 *
	 * Executa a função json_enconde nos atributos do model.
	 *
	 * @version 1.0
	 * @return 	array 	$this->attributes 	Array com os atributos do model em JSON.
	 */
	public function toJSON(){
		return json_encode( $this->attributes );
	}

}

/**
 * ModelCRUD extends Model
 *
 * ####
 *
 * @version 1.0
 */
class ModelCRUD extends Model {

	public $table = '!pre!table_name';
	public $status_flag = false;
	public $key_attribute = 'id';

	/**
	 * create
	 *
	 * Cria um novo registro no banco de dados com os atributos informados no model.
	 *
	 * @version 1.0
	 * @return 	string 	$inserir 	Resposta do SQL de inserção no banco de dados.
	 */
	public function create(){

		// valida campos e garante os defaults
		$input = array_merge( $this->defaults, $this->attributes ); // adiciona termos default caso estejam faltando
		$input = array_intersect_key( $input, $this->defaults ); // retira termos não defaults
		$input = array_filter( $input ); // remove os nulos

		$keys = array();
		$values = array();
		$safe = array();

		foreach( $input as $key=>$value ){
			$keys[]=$key;
			$values[]=$value;
			$safe[] = array(":" . $key, $value, gettype($this->defaults[$key]));
		}

		$sql = 'INSERT INTO ' . $this->table . ' ('.join( ',', $keys ).") VALUES(:".join( ",:", $keys ).")";

		$inserir = db::sql( $sql, $safe );

		if( $this->key_attribute ){
			$this->{$this->key_attribute} = $inserir;
		}

		return $inserir;
	}

	/**
	 * save
	 *
	 * Salva as novas informações em um registro no banco de dados de acordo com os atributos salvos no model.
	 *
	 * @version 1.0
	 * @return 	string 	$feedback 	Resposta do SQL da alteração no banco de dados.
	 */
	public function save(){
		/* valida campos e garante os defaults */
		//$input = array_merge( $this->defaults, $this->attributes ); // adiciona termos default caso estejam faltando

		$input = array_intersect_key( $this->attributes, $this->defaults); // retira termos não defaults
		$input = array_filter( $input ); // remove os nulos

		$updates = array();
		$safe = array();

		$include_string = '';

		foreach( $input as $key=>$value ){
			if( $key !== $this->key_attribute ){ $updates[] = $key . ' = :' . $key; };
			$safe[] = array(":" . $key, $value, gettype($this->defaults[$key]));
		}

		//$safe[] = array(":" . $this->key_attribute, $this->key_attribute, gettype($this->defaults[$this->key_attribute]));

		$sql = "UPDATE " . $this->table . " SET " . join( ', ', $updates ) . "  WHERE ". $this->key_attribute . " = :" . $this->key_attribute;

		$feedback = db::sql( $sql, $safe );

		return $feedback;
	}

	/**
	 * delete
	 *
	 * Deleta um registro no banco de dados OU adiciona false/zero ao status_flag do registro no banco de dados.
	 *
	 * @version 1.0
	 * @return 	string 	$removed 	Resposta do SQL de exclusão no banco de dados.
	 */
	public function delete(){

		if( $this->status_flag ){
			$sql = "UPDATE " . $this->table . " SET " . $this->status_flag . " = 0 WHERE " . $this->key_attribute . " = :id";
			$removed = db::sql($sql,array(array(':id',(int)$this->{$this->key_attribute},'int')));
		}else{
			$sql = "DELETE FROM " . $this->table . " WHERE ". $this->key_attribute . " = :id";
			$removed = db::sql($sql,array(array(':id', $this->{$this->key_attribute},'int')));
		}

		return $removed;
	}

	/**
	 * load
	 *
	 * Carrega os registros do model no banco de dados de acordo com os parâmetros informados.
	 *
	 * @version 1.0
	 * @param 	string 	$filter 	Array com informações para filtrar os registros
	 * 								- Índice 0 do array - Nome do campo no banco de dados
	 * 								- Índice 1 do array - Valor do campo para comparação
	 * 								- Índice 2 do array - Operador: =, <, >, <>
	 * 								- Índice 3 do array - Agregador: OR, AND, AND NOT, OR NOT
	 * 								- Índice 4 do array - Tipo de campo (string, integer, etc)
	 * @param 	string 	$sort 		String ou array com o(s) campo(s) que serão utilizados para ordenação
	 *								- Exemplo de string: $sort = "campo_a";
	 *								- Exemplo de array: $sort = array("campo_a", "campo_b", "campo_c");
	 * @param 	string 	$slice 		Array com a linha de início da consulta e com a quantidade de registros por página.
	 *								- Índice 0 do array - (integer) Número da linha para início da consulta
	 *								- Índice 1 do array - (integer) Quantidade de linhas que serão selecionadas na consulta
	 * @return 	integer 			Retorna o número de registros encontrados
	 */
	public function load( $filter = false , $sort = false, $slice = false ){

		$matchs = array();

		// caso não exista o parâmetro $filter, cria array com informações default
		if(!$filter){
			$filter = array(
				$this->table .".". $this->key_attribute,
				$this->{$this->key_attribute},
				'=',
				false,
				gettype($this->defaults[$this->key_attribute])
			);
		// caso o parâmetro $filter informado não seja um array, insere a string no array padrão para ser enviado para a função db::digestWhere()
		}elseif ( gettype($filter) !== "array" ) {
			$filter = array(
				$this->table .".". $this->key_attribute,
				$filter,
				'=',
				false,
				gettype($this->defaults[$this->key_attribute])
			);
		}

		// executa a função digestWhere que prepara o sql que será executado
		$filter = db::digestWhere($filter);
		$condition = $filter['sql'];
		$matchs = array_merge($matchs, $filter['args']);

		// executa a função digestOrder que prepara a string com o sql de ordenação
		$order = db::digestOrder($sort);
		// executa a função digestLimit que prepara a string com o limite de seleção de registros para a consulta sql
		$slice = db::digestLimit($slice);
		$limit = $slice['sql'];
		$matchs = array_merge($matchs, $slice['args']);

		$sql = "SELECT * FROM " . $this->table . $condition . $order . $limit;

		// Executa o sql
		$matchs = db::sql($sql, $matchs);

		foreach($matchs as $key=>$line){
			if( method_exists( $this, 'processLoad' ) ){
				$newItem = call_user_method('processLoad', $this, $newItem, $line );
			}

			foreach ($line as $p_key => $value) {
				$this->update($p_key, $value);
			}

		}

		return (count($matchs)>0);
	}

	/**
	 * exists
	 *
	 * ####
	 *
	 * @version 1.0
	 * @return 	integer 	####
	 */
	public function exists($filter = false, $active = true){

		$filter = (is_array($filter))?$filter:array( $filter, $this->{$filter} );

		//if(!$value){ return false;}
		$matchs = array();
		$filter = db::digestWhere($filter);
		$condition = $filter['sql'];
		$matchs = array_merge($matchs, $filter['args']);

		if( $active && $this->status_flag ){
			$sql = "SELECT * FROM " . $this->table . " WHERE ".$condition." AND " . $this->status_flag;
		}else{
			$sql = "SELECT * FROM " . $this->table . " WHERE ".$condition;
		}

		$matchs = db::sql($sql,
				$matchs
			);

		return ( count($matchs) );

	}

}

class ModelCollection {

	public $table = '!pre!table_name';
	public $model = null;

	public $models = array();

	public function __construct($model = false){
		if($model)$this->model = $model;
	}

	public function load( $filters = false , $sort = false, $slice = false ){

		$matchs = array();
		$condition = "";

		$filter = db::digestWhere($filters);
		$condition = $filter['sql'];
		$matchs = array_merge($matchs, $filter['args']);

		$order = db::digestOrder($sort);
		$slice = db::digestLimit($slice);
		$limit = $slice['sql'];
		$matchs = array_merge($matchs, $slice['args']);

		//print_r("SELECT * FROM " . $this->table . $condition . $order . $limit);
		$sql = "SELECT * FROM " . $this->table . $condition . $order . $limit;
		//print_r($sql);
		//print_r($matchs);
		$matchs = db::sql($sql, $matchs);
		$ret = array();

		foreach($matchs as $key=>$line){
			$newItem = clone $this->model;
			$newItem->update($line);

			if( method_exists( $this, 'processLoad' ) ){
				$newItem = call_user_method('processLoad', $this, $newItem, $line );
			}
			$ret[] = $newItem;

			//$pegar[$key] = (object) $pegar[$key];
		}

		$this->models = $ret;

		return ($ret);
	}

}

?>


text:
Custom Graphs
=============

Sometimes you want parallel computing but your application doesn't fit neatly
into something like dask.array or dask.bag.  In these cases you can interact
with the dask schedulers directly.  These schedulers operate well as standalone
modules.

This separation provides a release valve for complex situations and allows
advanced projects additional opportunities for parallel execution, even if
those projects have an internal representation for their computations.  As dask
schedulers improve or expand to distributed memory, code written to use dask
schedulers will advance as well.

Example
-------

.. figure:: images/pipeline.png
   :alt: "Dask graph for data pipeline"
   :align: right

As discussed in the motivation_ and specification_ sections, the schedulers
take a task graph (a dict of tuples of functions) and a list of desired keys
from that graph

Here is a mocked out example building a graph for a traditional clean and
analyze pipeline.

.. code-block:: python

   def load(filename):
       ...

   def clean(data):
       ...

   def analyze(sequence_of_data):
       ...

   def store(result):
       with open(..., 'w') as f:
           f.write(result)

   dsk = {'load-1': (load, 'myfile.a.data'),
          'load-2': (load, 'myfile.b.data'),
          'load-3': (load, 'myfile.c.data'),
          'clean-1': (clean, 'load-1'),
          'clean-2': (clean, 'load-2'),
          'clean-3': (clean, 'load-3'),
          'analyze': (analyze, ['clean-%d' % i for i in [1, 2, 3]]),
          'store': (store, 'analyze')}

   from dask.multiprocessing import get
   get(dsk, 'store')  # executes in parallel

Related Projects
----------------

The following excellent projects also provide parallel execution:

*  Joblib_
*  Multiprocessing_
*  `IPython Parallel`_
*  `Concurrent.futures`_
*  `Luigi`_

Each library lets you dictate how your tasks relate to each other with various
levels of sophistication.  Each library executes those tasks with some internal
logic.

Dask schedulers differ in the following ways:

1.  You specify the entire graph as a Python dict rather than using a
    specialized API
2.  You get a variety of schedulers ranging from single machine single core, to
    threaded, to multiprocessing, to distributed
3.  The dask single-machine schedulers have logic to execute the graph in a
    way that minimizes memory footprint

But the other projects offer different advantages and different programming
paradigms.  One should inspect all such projects before selecting one.

.. _motivation: graphs.html
.. _specification: graphs.html
.. _Joblib: https://pythonhosted.org/joblib/parallel.html
.. _Multiprocessing: https://docs.python.org/3/library/multiprocessing.html
.. _`IPython Parallel`: http://ipython.org/ipython-doc/dev/parallel/
.. _`Concurrent.futures`: https://docs.python.org/3/library/concurrent.futures.html
.. _Luigi: http://luigi.readthedocs.org


text:
<?php
/**
 * userAjax.php
 *
 * @author Spyros Soldatos <spyros@valor.gr>
 * @link http://code.google.com/p/srbac/
 */

/**
 * The assigning roles to users listboxes
 *
 * @author Spyros Soldatos <spyros@valor.gr>
 * @package srbac.views.authitem.tabViews
 * @since 1.0.0
 */
 ?>

    <?php echo Helper::translate('srbac','Assigned Roles') ?>

    <?php echo Helper::translate('srbac','Not Assigned Roles') ?>

      <?php echo SHtml::activeDropDownList($model,'name[revoke]',
      SHtml::listData(
      $data['userAssignedRoles'], 'name', 'name'),
      array('size'=>$this->module->listBoxNumberOfLines,'multiple'=>'multiple','class'=>'dropdown')) ?>

      <?php
      $ajax =
          array(
          'type'=>'POST',
          'update'=>'#roles',
          'beforeSend' => 'function(){
                      $("#loadMess").addClass("srbacLoading");
                  }',
          'complete' => 'function(){
                      $("#loadMess").removeClass("srbacLoading");
                  }');
      echo  SHtml::ajaxSubmitButton('<<',array('assign','assignRoles'=>1),$ajax,$data['assign']); ?>
      <?php
      $ajax =
          array(
          'type'=>'POST',
          'update'=>'#roles',
          'beforeSend' => 'function(){
                      $("#loadMess").addClass("srbacLoading");
                  }',
          'complete' => 'function(){
                      $("#loadMess").removeClass("srbacLoading");
                  }');
      echo  SHtml::ajaxSubmitButton('>>',array('assign','revokeRoles'=>1),$ajax,$data['revoke']); ?>

      <?php echo SHtml::activeDropDownList($model,'name[assign]',
      SHtml::listData(
      $data['userNotAssignedRoles'], 'name', 'name'),
      array('size'=>$this->module->listBoxNumberOfLines,'multiple'=>'multiple','class'=>'dropdown')); ?>

  <?php echo " ".$message ?>


text:
package com.example.asus.calculator.tools.loader;

import android.content.AsyncTaskLoader;
import android.content.Context;
import android.database.Cursor;

public abstract class AbstractCursorLoader extends AsyncTaskLoader<Cursor> {
    private Cursor cursor;

    public AbstractCursorLoader(Context context) {
        super(context);
    }

    @Override
    public void deliverResult(Cursor data) {
        if (isReset()) {
            if (data != null) {
                data.close();
            }
            return;
        }

        if (isStarted()) {
            super.deliverResult(data);
        }

        if (cursor != null && !cursor.isClosed()) {
            cursor.close();
        }
    }

    @Override
    protected void onStartLoading() {
        if (cursor != null) {
            deliverResult(cursor);
        }
        if (takeContentChanged() || cursor == null) {
            forceLoad();
        }
    }

    @Override
    protected void onStopLoading() {
        cancelLoad();
    }

    @Override
    public void onCanceled(Cursor data) {
        if (data != null && !data.isClosed()) {
            data.close();
        }
    }

    @Override
    protected void onReset() {
        super.onReset();

        onStopLoading();

        if (cursor != null && cursor.isClosed()) {
            cursor.close();
        }
        cursor = null;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">LoadResourceFromApk</string>
    <string name="menu_settings">Settings</string>
    <string name="hello_world">Hello world!</string>
    <string name="res">"res (string) in an apk file."</string>

</resources>


text:
namespace Tn.DeviceManager
{
    using Microsoft.AspNetCore.Builder;

    public static class ApplicationBuilderExtensions
    {
        public static IApplicationBuilder UseHttpException(this IApplicationBuilder app)
        {
            return app.UseMiddleware<HttpExceptionMiddleware>();
        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Buellia trifracta J. Steiner

### Remarks
null


text:
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/shared/has_key'

describe "LookupTable#key?" do
  it_behaves_like :lookuptable_has_key, :key?
end


text:
class FilterTestClass {
public:
  typedef int NestedTypedef;
  enum NestedEnum {
    NestedEnumValue1
  };

  void MemberFunc() {}

private:
  int IntMemberVar;
  double DoubleMemberVar;
};

int IntGlobalVar;
double DoubleGlobalVar;
typedef int GlobalTypedef;
enum GlobalEnum {
  GlobalEnumVal1
} GlobalEnumVar;

int main(int argc, char **argv) {
  FilterTestClass TestClass;
  GlobalTypedef v1;
  return 0;
}


text:
package com.organic.maynard.xml;

import java.util.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;

/**
 * A bare bones implementation of a SAX error handler.
 */
public class SimpleSAXErrorHandler extends DefaultHandler {

	// Constants
	private static final String PADDING_DEFAULT = "";

	// InstanceFields
	private String padding = "";

	// The Constructors
	public SimpleSAXErrorHandler() {
		this(PADDING_DEFAULT);
	}

	public SimpleSAXErrorHandler(String padding) {
		super();
		this.padding = padding;
	}

	// DefaultHandler Overridden Methods
	public void error(SAXParseException e) {
		System.out.println(padding + "XML PARSER ERROR: Line: " + e.getLineNumber() + " Column: " + e.getColumnNumber());
		System.out.println(padding + e.getMessage());
	}

	public void fatalError(SAXParseException e) {
		System.out.println(padding + "XML PARSER FATAL ERROR: Line: " + e.getLineNumber() + " Column: " + e.getColumnNumber());
		System.out.println(padding + e.getMessage());
	}

	public void warning(SAXParseException e) {
		System.out.println(padding + "XML PARSER WARNING: Line: " + e.getLineNumber() + " Column: " + e.getColumnNumber());
		System.out.println(padding + e.getMessage());
	}
}


text:
package pagination

import (
	"bytes"
	"html/template"
	"log"
	"math"

	"github.com/go-kira/kon"

	"github.com/Lafriakh/kira/helpers"
)

const defaultTemplate = "default"

// Pagination ...
type Pagination struct {
	total, perPage, currentPage int
	url                         string

	numPages       int
	maxPagesToShow int
	lastPage       float64
	template       string

	configs *kon.Kon
}

// Page ...
type Page struct {
	Number    int
	URL       string
	IsCurrent bool
}

func New(configs *kon.Kon, total, perPage, currentPage int, url string) *Pagination {
	pagination := &Pagination{
		total:          total,
		perPage:        perPage,
		currentPage:    currentPage,
		url:            url,
		maxPagesToShow: 5,
		lastPage:       math.Max(float64(int(math.Ceil(float64(total)/float64(perPage)))), float64(1)),
		template:       defaultTemplate,
		configs:        configs,
	}

	pagination.updateNumPages()

	return pagination
}

func (p *Pagination) updateNumPages() {
	p.numPages = int(math.Ceil(float64(p.total) / float64(p.perPage)))
}

// SetTemplate - set pagination template.
func (p *Pagination) SetTemplate(name string) {
	p.template = name
}

// Pages - calculate pagination pages.
func (p *Pagination) Pages() []Page {
	var pages []Page
	var slidingStart int
	var slidingEnd int

	if p.numPages <= 1 {
		return make([]Page, 0)
	}

	if p.numPages <= p.maxPagesToShow {
		for i := 1; i <= p.numPages; i++ {
			pages = append(pages, p.createPage(i, i == p.currentPage))
		}
	} else {
		numAdjacents := int(math.Floor(float64((p.maxPagesToShow - 3) / 2)))
		if (p.currentPage + numAdjacents) > p.numPages {
			// $slidingStart = $this->numPages - $this->maxPagesToShow + 2;
			slidingStart = p.numPages - p.maxPagesToShow + 2
		} else {
			slidingStart = p.currentPage - numAdjacents
		}
		if slidingStart < 2 {
			slidingStart = 2
		}

		slidingEnd = slidingStart + p.maxPagesToShow - 3
		if slidingEnd >= p.numPages {
			slidingEnd = p.numPages - 1
		}

		// Build the list of pages.
		pages = append(pages, p.createPage(1, p.currentPage == 1))
		if slidingStart > 2 {
			pages = append(pages, p.createPageEllipsis())
		}

		for i := slidingStart; i <= slidingEnd; i++ {
			pages = append(pages, p.createPage(i, i == p.currentPage))
		}

		if slidingEnd < p.numPages-1 {
			pages = append(pages, p.createPageEllipsis())
		}

		pages = append(pages, p.createPage(p.numPages, p.currentPage == p.numPages))
	}

	return pages
}

func (p *Pagination) createPage(number int, isCurrent bool) Page {
	return Page{
		Number:    number,
		URL:       p.url + helpers.ConvertToString(number),
		IsCurrent: isCurrent,
	}
}

func (p *Pagination) createPageEllipsis() Page {
	return Page{
		Number:    0,
		URL:       "",
		IsCurrent: false,
	}
}

// OnFirstPage - check if we in first page or not.
func (p *Pagination) OnFirstPage() bool {
	return p.currentPage <= 1
}

// HasMorePages - check if we have more pages.
func (p *Pagination) HasMorePages() bool {
	return p.currentPage < int(p.lastPage)
}

// PrevPage - return prev page number.
func (p *Pagination) PrevPage() int {
	if p.currentPage > 1 {
		return p.currentPage - 1
	}
	return 0
}

// PrevURL - return prev page url.
func (p *Pagination) PrevURL() string {
	if p.PrevPage() == 0 {
		return ""
	}

	return p.url + helpers.ConvertToString(p.PrevPage())
}

// NextPage - return nrxt page number.
func (p *Pagination) NextPage() int {
	if p.currentPage < p.numPages {
		return p.currentPage + 1
	}
	return 0
}

// NextURL - return next page url.
func (p *Pagination) NextURL() string {
	if p.NextPage() == 0 {
		return ""
	}

	return p.url + helpers.ConvertToString(p.NextPage())
}

func getTemplate(template string) string {
	if template == "" {
		return defaultTemplate
	}

	return template
}

// Render - render the pagination.
func (p *Pagination) Render() template.HTML {
	var out bytes.Buffer
	tmpl := template.Must(template.ParseFiles("./storage/framework/views/pagination/" + getTemplate(p.configs.GetString("PAGINATION_TEMPLATE")) + ".go.html"))

	err := tmpl.Execute(&out, p)
	if err != nil {
		log.Fatalf("template execution: %s", err)
	}

	return template.HTML(out.String())

}


text:
import * as ts from "../../_namespaces/ts";

describe("unittests:: services:: PreProcessFile:", () => {
    function test(sourceText: string, readImportFile: boolean, detectJavaScriptImports: boolean, expectedPreProcess: ts.PreProcessedFileInfo): void {
        const resultPreProcess = ts.preProcessFile(sourceText, readImportFile, detectJavaScriptImports);

        assert.equal(resultPreProcess.isLibFile, expectedPreProcess.isLibFile, "Pre-processed file has different value for isLibFile. Expected: " + expectedPreProcess.isLibFile + ". Actual: " + resultPreProcess.isLibFile);

        checkFileReferenceList("Imported files", expectedPreProcess.importedFiles, resultPreProcess.importedFiles);
        checkFileReferenceList("Referenced files", expectedPreProcess.referencedFiles, resultPreProcess.referencedFiles);
        checkFileReferenceList("Type reference directives", expectedPreProcess.typeReferenceDirectives, resultPreProcess.typeReferenceDirectives);
        checkFileReferenceList("Lib reference directives", expectedPreProcess.libReferenceDirectives, resultPreProcess.libReferenceDirectives);

        assert.deepEqual(resultPreProcess.ambientExternalModules, expectedPreProcess.ambientExternalModules);
    }

    function checkFileReferenceList(kind: string, expected: ts.FileReference[], actual: ts.FileReference[]) {
        if (expected === actual) {
            return;
        }
        assert.deepEqual(actual, expected, `Expected [${kind}] ${JSON.stringify(expected)}, got ${JSON.stringify(actual)}`);
    }

    describe("Test preProcessFiles,", () => {
        it("Correctly return referenced files from triple slash", () => {
            test("///<reference path = \"refFile1.ts\" />" + "\n" + "///<reference path =\"refFile2.ts\"/>" + "\n" + "///<reference path=\"refFile3.ts\" />" + "\n" + "///<reference path= \"..\\refFile4d.ts\" />",
                /*readImportFile*/ true,
                /*detectJavaScriptImports*/ false,
                {
                    referencedFiles: [{ fileName: "refFile1.ts", pos: 22, end: 33 }, { fileName: "refFile2.ts", pos: 59, end: 70 },
                        { fileName: "refFile3.ts", pos: 94, end: 105 }, { fileName: "..\\refFile4d.ts", pos: 131, end: 146 }],
                    importedFiles: [] as ts.FileReference[],
                    typeReferenceDirectives: [],
                    libReferenceDirectives: [],
                    ambientExternalModules: undefined,
                    isLibFile: false
                });
        });

        it("Do not return reference path because of invalid triple-slash syntax", () => {
            test("///<reference path\"refFile1.ts\" />" + "\n" + "///<reference path =\"refFile2.ts\">" + "\n" + "///<referencepath=\"refFile3.ts\" />" + "\n" + "///<reference pat= \"refFile4d.ts\" />",
                /*readImportFile*/ true,
                /*detectJavaScriptImports*/ false,
                {
                    referencedFiles: [] as ts.FileReference[],
                    importedFiles: [] as ts.FileReference[],
                    typeReferenceDirectives: [],
                    libReferenceDirectives: [],
                    ambientExternalModules: undefined,
                    isLibFile: false
                });
        });

        it("Do not return reference path of non-imports", () => {
            test("Quill.import('delta');",
                /*readImportFile*/ true,
                /*detectJavaScriptImports*/ false,
                {
                    referencedFiles: [] as ts.FileReference[],
                    importedFiles: [] as ts.FileReference[],
                    typeReferenceDirectives: [],
                    libReferenceDirectives: [],
                    ambientExternalModules: undefined,
                    isLibFile: false
                });
        });

        it("Do not return reference path of nested non-imports", () => {
            test("a.b.import('c');",
                /*readImportFile*/ true,
                /*detectJavaScriptImports*/ false,
                {
                    referencedFiles: [] as ts.FileReference[],
                    importedFiles: [] as ts.FileReference[],
                    typeReferenceDirectives: [],
                    libReferenceDirectives: [],
                    ambientExternalModules: undefined,
                    isLibFile: false
                });
        });

        it("Correctly return imported files", () => {
            test("import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\"); import i3= require(\"r3.ts\"); import i4=require(\"r4.ts\"); import i5 = require  (\"r5.ts\");",
                /*readImportFile*/ true,
                /*detectJavaScriptImports*/ false,
                {
                    referencedFiles: [] as ts.FileReference[],
                    typeReferenceDirectives: [],
                    libReferenceDirectives: [],
                    importedFiles: [{ fileName: "r1.ts", pos: 20, end: 25 }, { fileName: "r2.ts", pos: 49, end: 54 }, { fileName: "r3.ts", pos: 78, end: 83 },
                        { fileName: "r4.ts", pos: 106, end: 111 }, { fileName: "r5.ts", pos: 138, end: 143 }],
                    ambientExternalModules: undefined,
                    isLibFile: false
                });
        });

        it("Do not return imported files if readImportFiles argument is false", () => {
            test("import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\"); import i3= require(\"r3.ts\"); import i4=require(\"r4.ts\"); import i5 = require  (\"r5.ts\");",
                /*readImportFile*/ false,
                /*detectJavaScriptImports*/ false,
                {
                    referencedFiles: [] as ts.FileReference[],
                    typeReferenceDirectives: [],
                    libReferenceDirectives: [],
                    importedFiles: [] as ts.FileReference[],
                    ambientExternalModules: undefined,
                    isLibFile: false
                });
        });

        it("Do not return import path because of invalid import syntax", () => {
            test("import i1 require(\"r1.ts\"); import = require(\"r2.ts\") import i3= require(\"r3.ts\"); import i5",
                /*readImportFile*/ true,
                /*detectJavaScriptImports*/ false,
                {
                    referencedFiles: [] as ts.FileReference[],
                    typeReferenceDirectives: [],
                    libReferenceDirectives: [],
                    importedFiles: [{ fileName: "r3.ts", pos: 73, end: 78 }],
                    ambientExternalModules: undefined,
                    isLibFile: false
                });
        });

        it("Correctly return referenced files and import files", () => {
            test("///<reference path=\"refFile1.ts\" />" + "\n" + "///<reference path =\"refFile2.ts\"/>" + "\n" + "import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\");",
                /*readImportFile*/ true,
                /*detectJavaScriptImports*/ false,
                {
                    referencedFiles: [{ fileName: "refFile1.ts", pos: 20, end: 31 }, { fileName: "refFile2.ts", pos: 57, end: 68 }],
                    typeReferenceDirectives: [],
                    libReferenceDirectives: [],
                    importedFiles: [{ fileName: "r1.ts", pos: 92, end: 97 }, { fileName: "r2.ts", pos: 121, end: 126 }],
                    ambientExternalModules: undefined,
                    isLibFile: false
                });
        });

        it("Correctly return referenced files and import files even with some invalid syntax", () => {
            test("///<reference path=\"refFile1.ts\" />" + "\n" + "///<reference path \"refFile2.ts\"/>" + "\n" + "import i1 = require(\"r1.ts\"); import = require(\"r2.ts\"); import i2 = require(\"r3.ts\");",
                /*readImportFile*/ true,
                /*detectJavaScriptImports*/ false,
                {
                    referencedFiles: [{ fileName: "refFile1.ts", pos: 20, end: 31 }],
                    typeReferenceDirectives: [],
                    libReferenceDirectives: [],
                    importedFiles: [{ fileName: "r1.ts", pos: 91, end: 96 }, { fileName: "r3.ts", pos: 148, end: 153 }],
                    ambientExternalModules: undefined,
                    isLibFile: false
                });
        });

        it("Correctly return ES6 imports", () => {
            test("import * as ns from \"m1\";" + "\n" +
                "import def, * as ns from \"m2\";" + "\n" +
                "import def from \"m3\";" + "\n" +
                "import {a} from \"m4\";" + "\n" +
                "import {a as A} from \"m5\";" + "\n" +
                "import {a as A, b, c as C} from \"m6\";" + "\n" +
                "import def , {a, b, c as C} from \"m7\";" + "\n",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "m1", pos: 20, end: 22 },
                    { fileName: "m2", pos: 51, end: 53 },
                    { fileName: "m3", pos: 73, end: 75 },
                    { fileName: "m4", pos: 95, end: 97 },
                    { fileName: "m5", pos: 122, end: 124 },
                    { fileName: "m6", pos: 160, end: 162 },
                    { fileName: "m7", pos: 199, end: 201 }
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });

        it("Correctly ignore commented imports following template expression", () => {
            /* eslint-disable no-template-curly-in-string */
            test("/**" + "\n" +
                " * Before" + "\n" +
                " * ```" + "\n" +
                " * import * as a from \"a\";" + "\n" +
                " * ```" + "\n" +
                " */" + "\n" +
                "type Foo = `${string}`;" + "\n" +
                "/**" + "\n" +
                " * After" + "\n" +
                " * ```" + "\n" +
                " * import { B } from \"b\";" + "\n" +
                " * import * as c from \"c\";" + "\n" +
                " * ```" + "\n" +
                " */",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ true,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [],
                ambientExternalModules: undefined,
                isLibFile: false
            });
            /* eslint-enable no-template-curly-in-string */
        });

        it("Ignores imports in template strings", () => {
            /* eslint-disable no-template-curly-in-string */
            test("a ? `&${a}` : `#${b}`;\n\n `import(\"${moduleSpecifier}\").${id}`;",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ true,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [],
                ambientExternalModules: undefined,
                isLibFile: false
            });
            /* eslint-enable no-template-curly-in-string */
        });

        it("Correctly returns imports after a template expression", () => {
            /* eslint-disable no-template-curly-in-string */
            test("`${foo}`; import \"./foo\";",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ true,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "./foo", pos: 17, end: 22 }
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
            /* eslint-enable no-template-curly-in-string */
        });

        it("Correctly returns dynamic imports from template expression", () => {
            /* eslint-disable no-template-curly-in-string */
            test("`${(<div>Text `` ${} text {} " + "\n" +
                "${import(\"a\")} {import(\"b\")} " + "\n" +
                "${/* A comment */} ${/* import(\"ignored\") */} </div>)}`",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ true,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "a", pos: 39, end: 40 },
                    { fileName: "b", pos: 53, end: 54 }
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
            /* eslint-enable no-template-curly-in-string */
        });

        it("Correctly returns dynamic imports from nested template expression", () => {
            /* eslint-disable no-template-curly-in-string */
            test("`${foo(`${bar(`${import(\"a\")} ${import(\"b\")}`, `${baz(`${import(\"c\") ${import(\"d\")}`)}`)}`)}`",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ true,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "a", pos: 24, end: 25 },
                    { fileName: "b", pos: 39, end: 40 },
                    { fileName: "c", pos: 64, end: 65 },
                    { fileName: "d", pos: 78, end: 79 },
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
            /* eslint-enable no-template-curly-in-string */
        });

        it("Correctly returns dynamic imports from tagged template expression", () => {
            /* eslint-disable no-template-curly-in-string */
            test("foo`${ fn({ a: 100 }, import(\"a\"), `${import(\"b\")}`, import(\"c\"), `${import(\"d\")} foo`, import(\"e\")) }`",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ true,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "a", pos: 29, end: 30 },
                    { fileName: "b", pos: 45, end: 46 },
                    { fileName: "c", pos: 60, end: 61 },
                    { fileName: "d", pos: 76, end: 77 },
                    { fileName: "e", pos: 95, end: 96 },
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
            /* eslint-enable no-template-curly-in-string */
        });

        it("Correctly returns dynamic imports from template expression and imports following it", () => {
            /* eslint-disable no-template-curly-in-string */
            test("const x = `hello ${await import(\"a\").default}`;" + "\n\n" +
                "import { y } from \"b\";",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ true,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "a", pos: 32, end: 33 },
                    { fileName: "b", pos: 67, end: 68 },
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
            /* eslint-enable no-template-curly-in-string */
        });

        it("Correctly returns dynamic imports from template expressions and other imports", () => {
            /* eslint-disable no-template-curly-in-string */
            test("const x = `x ${await import(\"a\").default}`;" + "\n\n" +
                "import { y } from \"b\";" + "\n" +
                "const y = `y ${import(\"c\")}`;" + "\n\n" +
                "import { d } from \"d\";",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ true,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "a", pos: 28, end: 29 },
                    { fileName: "b", pos: 63, end: 64 },
                    { fileName: "c", pos: 90, end: 91 },
                    { fileName: "d", pos: 117, end: 118 },
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
            /* eslint-enable no-template-curly-in-string */
        });

        it("Correctly returns empty importedFiles with incorrect template expression", () => {
            /* eslint-disable no-template-curly-in-string */
            test("const foo = `${",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ true,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [],
                ambientExternalModules: undefined,
                isLibFile: false
            });
            /* eslint-enable no-template-curly-in-string */
        });

        it("Correctly return ES6 exports", () => {
            test("export * from \"m1\";" + "\n" +
                "export {a} from \"m2\";" + "\n" +
                "export {a as A} from \"m3\";" + "\n" +
                "export {a as A, b, c as C} from \"m4\";" + "\n",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "m1", pos: 14, end: 16 },
                    { fileName: "m2", pos: 36, end: 38 },
                    { fileName: "m3", pos: 63, end: 65 },
                    { fileName: "m4", pos: 101, end: 103 },
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });

        it("Correctly handles import types", () => {
            test("import type * as ns from \"m1\";" + "\n" +
                "import type def, * as ns from \"m2\";" + "\n" +
                "import type def from \"m3\";" + "\n" +
                "import type {a} from \"m4\";" + "\n" +
                "import type {a as A} from \"m5\";" + "\n" +
                "import type {a as A, b, c as C} from \"m6\";" + "\n" +
                "import type def , {a, b, c as C} from \"m7\";" + "\n" +
                "import type from \"m8\";" + "\n" +
                "import type T = require(\"m9\");" + "\n" +
                "import type = require(\"m10\");" + "\n" +
                "export import type T = require(\"m11\");" + "\n" +
                "export import type = require(\"m12\");" + "\n",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [] as ts.FileReference[],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "m1", pos: 25, end: 27 },
                    { fileName: "m2", pos: 61, end: 63 },
                    { fileName: "m3", pos: 88, end: 90 },
                    { fileName: "m4", pos: 115, end: 117 },
                    { fileName: "m5", pos: 147, end: 149 },
                    { fileName: "m6", pos: 190, end: 192 },
                    { fileName: "m7", pos: 234, end: 236 },
                    { fileName: "m8", pos: 257, end: 259 },
                    { fileName: "m9", pos: 287, end: 289 },
                    { fileName: "m10", pos: 316, end: 319 },
                    { fileName: "m11", pos: 355, end: 358 },
                    { fileName: "m12", pos: 392, end: 395 },
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });

        it("Correctly handles export types", () => {
            test("export type * from \"m1\";" + "\n" +
                "export type {a} from \"m2\";" + "\n" +
                "export type {a as A} from \"m3\";" + "\n" +
                "export type {a as A, b, c as C} from \"m4\";" + "\n",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [] as ts.FileReference[],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "m1", pos: 19, end: 21 },
                    { fileName: "m2", pos: 46, end: 48 },
                    { fileName: "m3", pos: 78, end: 80 },
                    { fileName: "m4", pos: 121, end: 123 },
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });

        it("Correctly handles import type node", () => {
            test("const x: import(\"m1\") = { x: 0, y: 0 };" + "\n" +
                "let y: import(\"m2\").Bar.I = { a: \"\", b: 0 };" + "\n" +
                "let shim: typeof import(\"m3\") = { Bar: Bar2 };" + "\n",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "m1", pos: 16, end: 18 },
                    { fileName: "m2", pos: 54, end: 56 },
                    { fileName: "m3", pos: 109, end: 111 },
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });

        it("Correctly return ambient external modules", () => {
            test(`
               declare module A {}
               declare module "B" {}
               function foo() {
               }
               `,
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [],
                ambientExternalModules: ["B"],
                isLibFile: false
            });
        });

        it("Correctly handles export import declarations", () => {
            test("export import a = require(\"m1\");",
                /*readImportFile*/ true,
                /*detectJavaScriptImports*/ false,
                {
                    referencedFiles: [],
                    typeReferenceDirectives: [],
                    libReferenceDirectives: [],
                    importedFiles: [
                        { fileName: "m1", pos: 26, end: 28 }
                    ],
                    ambientExternalModules: undefined,
                    isLibFile: false
                });
        });
        it("Correctly handles export require calls in JavaScript files", () => {
            test(`
            export import a = require("m1");
            var x = require('m2');
            foo(require('m3'));
            var z = { f: require('m4') }
            `,
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ true,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "m1", pos: 39, end: 41 },
                    { fileName: "m2", pos: 74, end: 76 },
                    { fileName: "m3", pos: 105, end: 107 },
                    { fileName: "m4", pos: 146, end: 148 },
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });
        it("Correctly handles dependency lists in define([deplist]) calls in JavaScript files", () => {
            test(`
            define(["mod1", "mod2"], (m1, m2) => {
            });
            `,
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ true,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "mod1", pos: 21, end: 25 },
                    { fileName: "mod2", pos: 29, end: 33 },
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });

        it("Correctly handles dependency lists in define(modName, [deplist]) calls in JavaScript files", () => {
            test(`
            define("mod", ["mod1", "mod2"], (m1, m2) => {
            });
            `,
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ true,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "mod1", pos: 28, end: 32 },
                    { fileName: "mod2", pos: 36, end: 40 },
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });

        it("correctly handles augmentations in external modules - 1", () => {
            test(`
            declare module "../Observable" {
                interface I {}
            }

            export {}
            `,
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "../Observable", pos: 28, end: 41 }
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });
        it("correctly handles augmentations in external modules - 2", () => {
            test(`
            declare module "../Observable" {
                interface I {}
            }

            import * as x from "m";
            `,
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "m", pos: 123, end: 124 },
                    { fileName: "../Observable", pos: 28, end: 41 }
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });
        it("correctly handles augmentations in external modules - 3", () => {
            test(`
            declare module "../Observable" {
                interface I {}
            }

            import m = require("m");
            `,
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "m", pos: 123, end: 124 },
                    { fileName: "../Observable", pos: 28, end: 41 }
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });
        it("correctly handles augmentations in external modules - 4", () => {
            test(`
            declare module "../Observable" {
                interface I {}
            }
            namespace N {}
            export = N;
            `,
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "../Observable", pos: 28, end: 41 }
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });
        it("correctly handles augmentations in external modules - 5", () => {
            test(`
            declare module "../Observable" {
                interface I {}
            }
            namespace N {}
            export import IN = N;
            `,
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "../Observable", pos: 28, end: 41 }
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });
        it("correctly handles augmentations in external modules - 6", () => {
            test(`
            declare module "../Observable" {
                interface I {}
            }
            export let x = 1;
            `,
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "../Observable", pos: 28, end: 41 }
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });
        it ("correctly handles augmentations in ambient external modules - 1", () => {
            test(`
            declare module "m1" {
                export * from "m2";
                declare module "augmentation" {
                    interface I {}
                }
            }
            `,
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "m2", pos: 65, end: 67 },
                    { fileName: "augmentation", pos: 102, end: 114 }
                ],
                ambientExternalModules: ["m1"],
                isLibFile: false
            });
        });
        it ("correctly handles augmentations in ambient external modules - 2", () => {
            test(`
            namespace M { var x; }
            import IM = M;
            declare module "m1" {
                export * from "m2";
                declare module "augmentation" {
                    interface I {}
                }
            }
            `,
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "m2", pos: 127, end: 129 },
                    { fileName: "augmentation", pos: 164, end: 176 }
                ],
                ambientExternalModules: ["m1"],
                isLibFile: false
            });
        });
        it ("correctly recognizes type reference directives", () => {
            test(`
            /// <reference path="a"/>
            /// <reference types="a1"/>
            /// <reference path="a2"/>
            /// <reference types="a3"/>
            `,
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [
                    { pos: 34, end: 35, fileName: "a" },
                    { pos: 112, end: 114, fileName: "a2" }
                ],
                typeReferenceDirectives: [
                    { pos: 73, end: 75, fileName: "a1" },
                    { pos: 152, end: 154, fileName: "a3" }
                ],
                libReferenceDirectives: [],
                importedFiles: [],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });
        it ("correctly recognizes lib reference directives", () => {
            test(`
            /// <reference path="a"/>
            /// <reference lib="a1"/>
            /// <reference path="a2"/>
            /// <reference lib="a3"/>
            `,
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [
                    { pos: 34, end: 35, fileName: "a" },
                    { pos: 110, end: 112, fileName: "a2" }
                ],
                typeReferenceDirectives: [
                ],
                libReferenceDirectives: [
                    { pos: 71, end: 73, fileName: "a1" },
                    { pos: 148, end: 150, fileName: "a3" }
                ],
                importedFiles: [],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });

        it("Correctly handles dynamic imports with template literals", () => {
            test("const m1 = import('mod1');" + "\n" +
            "const m2 = import(`mod2`);" + "\n" +
            "Promise.all([import('mod3'), import(`mod4`)]);" + "\n" +
            "import(/* webpackChunkName: 'module5' */ `mod5`);" + "\n",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ false,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "mod1", pos: 18, end: 22 },
                    { fileName: "mod2", pos: 45, end: 49 },
                    { fileName: "mod3", pos: 74, end: 78 },
                    { fileName: "mod4", pos: 90, end: 94 },
                    { fileName: "mod5", pos: 142, end: 146 }
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });

        it("Correctly handles require calls with template literals in JS files", () => {
            test("const m1 = require(`mod1`);" + "\n" +
            "f(require(`mod2`));" + "\n" +
            "const a = { x: require(`mod3`) };" + "\n",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ true,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "mod1", pos: 19, end: 23 },
                    { fileName: "mod2", pos: 38, end: 42 },
                    { fileName: "mod3", pos: 71, end: 75 }
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });

        it("Correctly handles dependency lists in define(modName, [deplist]) calls with template literals in JS files", () => {
            test("define(`mod`, [`mod1`, `mod2`], (m1, m2) => {});",
            /*readImportFile*/ true,
            /*detectJavaScriptImports*/ true,
            {
                referencedFiles: [],
                typeReferenceDirectives: [],
                libReferenceDirectives: [],
                importedFiles: [
                    { fileName: "mod1", pos: 15, end: 19 },
                    { fileName: "mod2", pos: 23, end: 27 },
                ],
                ambientExternalModules: undefined,
                isLibFile: false
            });
        });
    });
});


text:
import isEmpty from 'lodash/isEmpty';
import {
  findUISchema,
  GroupLayout,
  isObjectControl,
  RankedTester,
  rankWith,
  StatePropsOfControlWithDetail
} from '@jsonforms/core';
import { JsonFormsDispatch, withJsonFormsDetailProps } from '@jsonforms/react';
import { Hidden } from '@mui/material';
import React, { useMemo } from 'react';

export const MaterialObjectRenderer = ({
  renderers,
  cells,
  uischemas,
  schema,
  label,
  path,
  visible,
  enabled,
  uischema,
  rootSchema
}: StatePropsOfControlWithDetail) => {
  const detailUiSchema = useMemo(
    () =>
      findUISchema(
        uischemas,
        schema,
        uischema.scope,
        path,
        'Group',
        uischema,
        rootSchema
      ),
    [uischemas, schema, uischema.scope, path, uischema, rootSchema]
  );
  if (isEmpty(path)) {
    detailUiSchema.type = 'VerticalLayout';
  } else {
    (detailUiSchema as GroupLayout).label = label;
  }
  return (
    <Hidden xsUp={!visible}>
      <JsonFormsDispatch
        visible={visible}
        enabled={enabled}
        schema={schema}
        uischema={detailUiSchema}
        path={path}
        renderers={renderers}
        cells={cells}
      />
    </Hidden>
  );
};

export const materialObjectControlTester: RankedTester = rankWith(
  2,
  isObjectControl
);

export default withJsonFormsDetailProps(MaterialObjectRenderer);


text:
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;

namespace MyRainbow
{
	public class ThinHashes
	{
		//[JsonProperty(PropertyName = "Key")]
		[BsonId]
		public string Key { get; set; }

		//[JsonProperty(PropertyName = "HashMD5")]
		public string HashMD5 { get; set; }

		//[JsonProperty(PropertyName = "HashSHA256")]
		public string HashSHA256 { get; set; }
	}

	class MyCartesian
	{
		//private const string _longAlphabet = @"abcdefghijklmnopqrstuvwxyz0123456789";
		private const string _smallAlphabet = @"abcd";

		public string Alphabet { get; private set; }

		public int Length { get; private set; }

		public int AlphabetPower { get { return Alphabet.Length; } }

		public double CombinationCount
		{
			get { return Math.Pow(AlphabetPower, Length); }
		}

		public MyCartesian(int length = 4, string alphabet = null)
		{
			Length = length;

			if (!string.IsNullOrEmpty(alphabet))
				Alphabet = alphabet;
			else
				Alphabet = _smallAlphabet;
			Alphabet = string.Concat(Alphabet.Distinct());

			if (Length > Alphabet.Length)
				throw new IndexOutOfRangeException("alphabet has not enough characters");
		}

		public IEnumerable<IEnumerable<char>> Generate()
		{
			var input = new string[Length];
			for (int i = 0; i < Length; i++)
				input[i] = Alphabet;

			var result = input.CartesianProductAsyncParallel();

			return result;
		}

		public IEnumerable<IEnumerable<char>> Generate2()
		{
			var input = new string[Length];
			for (int i = 0; i < Length; i++)
				input[i] = Alphabet;

			var result = input.CartesianProductAggregate();

			return result;
		}
	}
}


text:
package com.rev.java.math.framework.simplemth;

import com.rev.system.err.RevNotInitalizedException;
import com.rev.system.render.Rev;
import com.rev.system.render.System;

/**
 * Created by Braxton on 10/30/2014.
 */
 class Internals {

    protected static void renderErr() {
        throw new RevNotInitalizedException("RevBuildRender--- <Error:" + Rev.getResponseCode() + "-- Access Denied> Invalid token!  Have you initialized RevManager correctly in the Application file?");
    }

}


text:
import { InternalComponentCapabilities, Option, CompileTimeComponent } from '@glimmer/interfaces';

export const DEFAULT_CAPABILITIES: InternalComponentCapabilities = {
  dynamicLayout: true,
  dynamicTag: true,
  prepareArgs: true,
  createArgs: true,
  attributeHook: false,
  elementHook: false,
  dynamicScope: true,
  createCaller: false,
  updateHook: true,
  createInstance: true,
  wrapped: false,
  willDestroy: false,
  hasSubOwner: false,
};

export const MINIMAL_CAPABILITIES: InternalComponentCapabilities = {
  dynamicLayout: false,
  dynamicTag: false,
  prepareArgs: false,
  createArgs: false,
  attributeHook: false,
  elementHook: false,
  dynamicScope: false,
  createCaller: false,
  updateHook: false,
  createInstance: false,
  wrapped: false,
  willDestroy: false,
  hasSubOwner: false,
};

export interface ResolverDelegate<R = unknown> {
  lookupHelper?(name: string, referrer: R): Option<number> | void;
  lookupModifier?(name: string, referrer: R): Option<number> | void;
  lookupComponent?(name: string, referrer: R): Option<CompileTimeComponent> | void;

  // For debugging
  resolve?(handle: number): R;
}


text:
package com.bbva.kltt.apirest.core.parsed_info.common;

import org.junit.Test;

import com.bbva.kltt.apirest.core.util.APIRestGeneratorException;
import com.bbva.kltt.apirest.core.util.ConstantsTest;

/**
 * ------------------------------------------------
 * @author Francisco Manuel Benitez Chico
 * ------------------------------------------------
 */
public class ItemSimpleBooleanTest
{
	@Test
	public void fullTest() throws APIRestGeneratorException
	{
		final ItemSimpleBoolean itemSimpleBoolean = ItemSimpleBooleanTest.generateDummyItemSimpleBoolean() ;

		itemSimpleBoolean.isRequired() ;
		itemSimpleBoolean.getAlias() ;
		itemSimpleBoolean.getClassName() ;
		itemSimpleBoolean.getDescription() ;
		itemSimpleBoolean.getName() ;
		itemSimpleBoolean.getType() ;

		itemSimpleBoolean.setRequired(true) ;
	}

	/**
	 * @return a dummy item simple boolean
	 * @throws APIRestGeneratorException with an occurred exception
	 */
	public static ItemSimpleBoolean generateDummyItemSimpleBoolean() throws APIRestGeneratorException
	{
		return new ItemSimpleBoolean(ConstantsTest.ITEM_NAME, ConstantsTest.ALIAS, ConstantsTest.DESCRIPTION, ConstantsTest.REQUIRED) ;
	}
}


text:
"""
    Test cases for salt.states.git

    :codeauthor: Erik Johnson <erik@saltstack.com>
"""

import logging

import pytest

import salt.states.git as git_state  # Don't potentially shadow GitPython
from tests.support.mock import DEFAULT, MagicMock, Mock, patch

log = logging.getLogger(__name__)

@pytest.fixture
def configure_loader_modules():
    return {git_state: {"__env__": "base", "__opts__": {"test": False}, "__salt__": {}}}

def test_latest_no_diff_for_bare_repo(tmp_path):
    """
    This test ensures that we don't attempt to diff when cloning a repo
    using either bare=True or mirror=True.
    """
    name = "https://foo.com/bar/baz.git"
    gitdir = str(tmp_path / "refs")
    isdir_mock = MagicMock(side_effect=lambda path: DEFAULT if path != gitdir else True)

    branches = ["foo", "bar", "baz"]
    tags = ["v1.1.0", "v.1.1.1", "v1.2.0"]
    local_head = "b9ef06ab6b7524eb7c27d740dbbd5109c6d75ee4"
    remote_head = "eef672c1ec9b8e613905dbcd22a4612e31162807"

    git_diff = Mock()
    dunder_salt = {
        "git.current_branch": MagicMock(return_value=branches[0]),
        "git.config_get_regexp": MagicMock(return_value={}),
        "git.diff": git_diff,
        "git.fetch": MagicMock(return_value={}),
        "git.is_worktree": MagicMock(return_value=False),
        "git.list_branches": MagicMock(return_value=branches),
        "git.list_tags": MagicMock(return_value=tags),
        "git.remote_refs": MagicMock(return_value={"HEAD": remote_head}),
        "git.remotes": MagicMock(
            return_value={"origin": {"fetch": name, "push": name}}
        ),
        "git.rev_parse": MagicMock(side_effect=git_state.CommandExecutionError()),
        "git.revision": MagicMock(return_value=local_head),
        "git.version": MagicMock(return_value="1.8.3.1"),
    }
    with patch("os.path.isdir", isdir_mock), patch.dict(
        git_state.__salt__, dunder_salt
    ):
        result = git_state.latest(
            name=name,
            target=tmp_path,
            mirror=True,  # mirror=True implies bare=True
        )
        assert result["result"] is True, result
        git_diff.assert_not_called()

def test_latest_without_target():
    """
    Test latest when called without passing target
    """
    name = "https://foo.com/bar/baz.git"
    with pytest.raises(TypeError):
        # pylint: disable=E1120
        git_state.latest(name)
        # pylint: enable=E1120

def test_detached_without_target():
    """
    Test detached when called without passing target
    """
    name = "https://foo.com/bar/baz.git"
    with pytest.raises(TypeError):
        # pylint: disable=E1120
        git_state.detached(name)
        # pylint: enable=E1120

def test_cloned_without_target():
    """
    Test cloned when called without passing target
    """
    name = "https://foo.com/bar/baz.git"
    with pytest.raises(TypeError):
        # pylint: disable=E1120
        git_state.cloned(name)
        # pylint: enable=E1120


text:
package org.apache.directory.api.dsmlv2.request;

import org.apache.directory.api.ldap.codec.api.LdapApiService;
import org.apache.directory.api.ldap.model.message.Control;
import org.apache.directory.api.ldap.model.message.DeleteRequest;
import org.apache.directory.api.ldap.model.message.DeleteRequestImpl;
import org.apache.directory.api.ldap.model.message.DeleteResponse;
import org.apache.directory.api.ldap.model.message.MessageTypeEnum;
import org.apache.directory.api.ldap.model.name.Dn;
import org.dom4j.Element;

/**
 * DSML Decorator for DeleteRequest
 *
 * @author Apache Directory Project
 */
public class DelRequestDsml
    extends AbstractResultResponseRequestDsml<DeleteRequest, DeleteResponse>
    implements DeleteRequest
{
    /**
     * Creates a new getDecoratedMessage() of DelRequestDsml.
     */
    public DelRequestDsml( LdapApiService codec )
    {
        super( codec, new DeleteRequestImpl() );
    }

    /**
     * Creates a new getDecoratedMessage() of DelRequestDsml.
     *
     * @param ldapMessage
     *      the message to decorate
     */
    public DelRequestDsml( LdapApiService codec, DeleteRequest ldapMessage )
    {
        super( codec, ldapMessage );
    }

    /**
     * {@inheritDoc}
     */
    public MessageTypeEnum getType()
    {
        return getDecorated().getType();
    }

    /**
     * {@inheritDoc}
     */
    public Element toDsml( Element root )
    {
        Element element = super.toDsml( root );

        // Dn
        if ( getDecorated().getName() != null )
        {
            element.addAttribute( "dn", getDecorated().getName().getName() );
        }

        return element;
    }

    /**
     * Get the entry to be deleted
     *
     * @return Returns the entry.
     */
    public Dn getEntry()
    {
        return getDecorated().getName();
    }

    /**
     * Set the entry to be deleted
     *
     * @param entry The entry to set.
     */
    public void setEntry( Dn entry )
    {
        getDecorated().setName( entry );
    }

    /**
     * {@inheritDoc}
     */
    public MessageTypeEnum getResponseType()
    {
        return getDecorated().getResponseType();
    }

    /**
     * {@inheritDoc}
     */
    public Dn getName()
    {
        return getDecorated().getName();
    }

    /**
     * {@inheritDoc}
     */
    public DeleteRequest setName( Dn name )
    {
        getDecorated().setName( name );

        return this;
    }

    /**
     * {@inheritDoc}
     */
    public DeleteRequest setMessageId( int messageId )
    {
        super.setMessageId( messageId );

        return this;
    }

    /**
     * {@inheritDoc}
     */
    public DeleteRequest addControl( Control control )
    {
        return ( DeleteRequest ) super.addControl( control );
    }

    /**
     * {@inheritDoc}
     */
    public DeleteRequest addAllControls( Control[] controls )
    {
        return ( DeleteRequest ) super.addAllControls( controls );
    }

    /**
     * {@inheritDoc}
     */
    public DeleteRequest removeControl( Control control )
    {
        return ( DeleteRequest ) super.removeControl( control );
    }
}


text:
let date = new Date
date.setDate(date.getDate()+7)

exports.keys = 'UserName=Cara;expires='+date

exports.view = {
    defaultViewEngine: 'nunjucks',
    mapping: {
        '.tpl': 'nunjucks'
    }
}


text:
/* css Zen Garden submission 174 - 'Simple', by Shawn Chin, http://www.shawnchin.net/ */
/* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/  */
/* All associated graphics copyright 2005, Shawn Chin */
/* Added: July 9th, 2005 */

/* IMPORTANT */
/* This design is not a template. You may not reproduce it elsewhere without the
   designer's written permission. However, feel free to study the CSS and use
   techniques you learn from it elsewhere. */

body {
	text-align:center;
	padding:0;
	margin:1px 0 0;
	font:normal 11px Arial, Helvetica, Sans-serif;
	color:#666;

}

a {
	color:#777;
}

a:hover {
	color:#A77749;
}

#container {
	text-align:left;
	background:#FFF url(container_bg.gif) repeat-y top left;
	width:700px;
	margin:auto;
	position:relative;
	padding:0;
}

#pageHeader {
	width:700px;
	height:80px;
	background:#666 url(main_title.gif) no-repeat;
	margin:0;
	padding:0;
}

#pageHeader h1,h2 {
	padding:0;
	margin:0;
	display:none;

}

#quickSummary{
	margin:0;
	padding:0;
	position:relative;
	border-top:#FFF 1px solid;
	width:700px;
	height:75px;
	background:#FFF;
}

#quickSummary p{
	margin:0;
	padding:0;
}

#quickSummary .p1{
	position:absolute;
	top:0;
	left:0;
	width:700px;
	height:75px;
	background:#FFF url(quickSummary_main.gif) no-repeat 251px 0;

}

#quickSummary .p1 span{
	display:none;
}

#quickSummary .p2{
	position:absolute;
	top:0;
	left:0;
	width:250px;
	height:75px;
	background:url(quickSummary_button.gif) no-repeat top left;
}

#quickSummary .p2 span{
	visibility:hidden;
	white-space:nowrap;
}

#quickSummary .p2 a {
	width:250px;
	height:37px;
	float:right;
	visibility:visible;
	text-indent:-9000px;
	overflow:hidden;
	margin-top:-1.3em;
	margin-bottom:1.4em;
}
#preamble {
	position:relative;
	border-top:#fff 1px solid;
	margin:0;
	padding:0;
	width:524px;
	background:#CCC url(preamble_top.gif) no-repeat top left;
}

#preamble h3{
	display:none;
	margin:0;
	padding:0;
}

#preamble .p1{
	margin:0;
	padding:31px 15px 0px 15px;
}

#supportingText{
	width:524px;
}

#explanation .p1, #participation .p1, #requirements .p1{
	margin:0;
	padding:41px 15px 0px 15px;
}

#preamble p, #explanation p, #participation p, #benefits p, #requirements p{
	margin:0;
	padding:10px 15px 0px 15px;
}

#explanation h3, #participation h3, #benefits h3, #requirements h3, #lselect h3, #larchives h3, #lresources h3{
	display:none;
}

#preamble .p3, #explanation .p2, #participation .p3, #requirements .p5{
	margin:0;
	padding:10px 15px 7px 15px;
}

#benefits .p1{
	margin:0;
	padding:41px 15px 7px 15px;
}

#explanation{
	background:#CCC url(explanation_top.gif) no-repeat top left;
}

#participation{
	background:#CCC url(participation_top.gif) no-repeat top left;
}

#benefits{
	background:#CCC url(benefits_top.gif) no-repeat top left;
}

#requirements{
	background:#CCC url(requirements_top.gif) no-repeat top left;
}

#footer{
	background:#FD9453 url(footer_top.gif) no-repeat top left;
	padding-top:17px;
	padding-left:15px;

}

#linkList {
	position:absolute;
	top:156px;
	left:525px;
	width:175px;
	background:#FD9453;
	border-top:#fff 1px solid;
	color:#fff;
}

#linkList a, #footer a{
	color:#FFF;
	text-decoration:none;
}

#linkList a:hover, #footer a:hover{
	color:#FCD2B8;
}

#lselect{
	background:#FD9453 url(lselect_top.gif) no-repeat top left;
	padding:29px 0 0 0;
}

#larchives{
	background:#FD9453 url(larchives_top.gif) no-repeat top left;
	padding:39px 0 0 0;
}

#lresources{
	background:#FD9453 url(lresources_top.gif) no-repeat top left;
	padding:39px 0 0 0;
}

#lselect ul, #larchives ul, #lresources ul{
	margin:0;
	padding:0 15px 5px 15px;
}

#lselect li, #larchives li, #lresources li{
	padding: 0 0 5px 15px;
	margin:0;
	list-style-type:none;
	background:transparent url(bullet2.gif) no-repeat 0 4px;
}

#extraDiv1{
	margin:auto;
	width:700px;
	height:9px;
	background:#fff url(extradiv1_bg.gif) no-repeat top left;
}


text:
									// This way we don't have to #include everything in every .h file
									// like iostream and the namespace stuff.

									// These are are the states of the sprite
									// This order is the order of the frames in the bitmap
#define NORTH 0						// This is the NORTH state of the sprite
#define EAST  1						// This is the EAST state of the sprite
#define SOUTH 2						// This is the SOUTH state of the sprite
#define WEST  3						// This is the WEST state of the sprite

struct SPRITE {						// This is our SPRITE structure for animation
	HBITMAP hBitmap;				// This is the bitmap we will draw our frames from
	POINT position;					// This the position of the sprite on the screen
	POINT speed;					// The x and y speed of the sprite
	int currentFrame;				// This is the current frame of animation we are on (starts at 0)
	int lastFrame;					// This is the amount of bitmaps that the sprite animates
	int state;						// The state of the sprite (0 = LEFT, 1 = RIGHT, 2 = NORTH, 3 = SOUTH)
	int width;						// The width in pixels of one of the frames of animation
	int height;						// The height in pixels of one of the frames of animation
};

// This loads a sprite and reads in the bitmap associate with it
void LoadSprite(SPRITE *pSprite, LPSTR szFileName, int width, int height, int lastFrame);

// This returns if we should animate the next frame depending on the frame rate
BOOL AnimateNextFrame(int desiredFrameRate);

// Sets a sprites X and Y position
void SetSpritePosition(SPRITE *pSprite, int x, int y);

// This sets the state of the animation (WEST, EAST, etc..)
void SetSpriteState(SPRITE *pSprite, int whichState);

// This sets the sprites x and y speed in pixels
void SetSpriteSpeed(SPRITE *pSprite, int xSpeed, int ySpeed);

// Animates and displays the current bitmap
void AnimateSprite(BUFFER *pBuffer, SPRITE *pSprite);

// This calculates the frames per second and display it in the window title bar
void CalculateFrameRate(HWND hWnd);

// This moves the sprite depending on its state and speed
void MoveSprite(SPRITE *pSprite);

// This erases the sprite with a portion of the background
void EraseSprite(BUFFER *pBuffer, SPRITE *pSprite, HBITMAP hBackground);

// This frees a sprite that is passed in
void FreeSprite(SPRITE *pSprite);

#endif

////////////////////////////////////////////////////////////
//
// *Quick Notes*
//
// If you include sprite.cpp with your programs, include this file too
// You probably won't want to change this file, unless you make
// NORTH-EAST , etc... directions.
//
//
//
//
//
//
//
//
//
//
//


text:
#pragma once

#include "IOBasicTypes.h"
#include "ObjectsBasicTypes.h"

#include <list>
#include <string>
#include <map>

class XCryptionCommon;

typedef std::list<IOBasicTypes::Byte> ByteList;
typedef std::list<ByteList> ByteListList;
typedef std::map<std::string, XCryptionCommon*> StringToXCryptionCommonMap;

class XCryptionCommon {
public:

	XCryptionCommon(void);
	virtual ~XCryptionCommon(void);

	/*
		To start using XCryptionCommon do this:

		1. Create an instance of the object
		2. Call Initial Setup with the PDF level. return bool will tell you if XCryption is supported for this input. if not...don't bother with the rest
		3. Call SetupInitialEncryptionKey. This may require some initial computations with other algorithms of this object, per what input you may possess. It is fine
			to call any method prior to SetupInitialEncryptionKey, but those that relate to state - OnObjectStart,OnObjectEnd, GetCurrentObjectKey. these require the computation.
			Call this whenever you acquired the required input for it, no matter when.
		4. now you can call all methods freely
	*/

	// call this whenever you first can.
	void Setup(bool inUsingAES);

	void SetupInitialEncryptionKey(const std::string& inUserPassword,
		unsigned int inRevision,
		unsigned int inLength,
		const ByteList& inO,
		long long inP,
		const ByteList& inFileIDPart1,
		bool inEncryptMetaData
		);
	// Setup key directly
	void SetupInitialEncryptionKey(const ByteList& inEncryptionKey);

	// Call on object start, will recompute a key for the new object (returns, so you can use if makes sense)
	const ByteList& OnObjectStart(long long inObjectID, long long inGenerationNumber);
	// Call on object end, will pop the computed key for this object
	void OnObjectEnd();
	const ByteList& GetCurrentObjectKey(); // will return empty key if stack is empty

	// get original encryption key (without particular object additions)
	const ByteList& GetInitialEncryptionKey() const;

	// bytelist operations (class methods)
	static ByteList stringToByteList(const std::string& inString);
	static ByteList substr(const ByteList& inList, IOBasicTypes::LongBufferSizeType inStart, IOBasicTypes::LongBufferSizeType inEnd);
	static void append(ByteList& ioTargetList, const ByteList& inSource);
	static ByteList add(const ByteList& inA, const ByteList& inB);
	static std::string ByteListToString(const ByteList& inByteList);

	// PDF xcryption algorithms (Important! length must be passed in bytes and not in bits. which normally means - the PDF value / 8)
	ByteList algorithm3_1(ObjectIDType inObjectNumber,
		unsigned long inGenerationNumber,
		const ByteList& inEncryptionKey,
		bool inIsUsingAES);
	ByteList algorithm3_2(unsigned int inRevision,
		unsigned int inLength,
		const ByteList& inPassword,
		const ByteList& inO,
		long long inP,
		const ByteList& inFileIDPart1,
		bool inEncryptMetaData);
	ByteList algorithm3_3(unsigned int inRevision,
		unsigned int inLength,
		const ByteList& inOwnerPassword,
		const ByteList& inUserPassword);
	ByteList algorithm3_4(unsigned int inLength,
		const ByteList& inUserPassword,
		const ByteList& inO,
		long long inP,
		const ByteList& inFileIDPart1,
		bool inEncryptMetaData);
	ByteList algorithm3_5(unsigned int inRevision,
		unsigned int inLength,
		const ByteList& inUserPassword,
		const ByteList& inO,
		long long inP,
		const ByteList& inFileIDPart1,
		bool inEncryptMetaData);
	bool algorithm3_6(unsigned int inRevision,
		unsigned int inLength,
		const ByteList& inPassword,
		const ByteList& inO,
		long long inP,
		const ByteList& inFileIDPart1,
		bool inEncryptMetaData,
		const ByteList inU);
	bool algorithm3_7(unsigned int inRevision,
		unsigned int inLength,
		const ByteList& inPassword,
		const ByteList& inO,
		long long inP,
		const ByteList& inFileIDPart1,
		bool inEncryptMetaData,
		const ByteList inU);

	bool IsUsingAES();

private:
	ByteList mPaddingFiller;
	ByteListList mEncryptionKeysStack;
	bool mUsingAES;
	ByteList mEncryptionKey;

	ByteList RC4Encode(const ByteList& inKey, const ByteList& inToEncode);
	ByteList ComputeEncryptionKeyForObject(ObjectIDType inObjectNumber, unsigned long inGenerationNumber); // with algorithm3_1

};


text:
using System;
using System.Linq;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DataRepository.Models
{
    public class BlogImage
    {
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int ID { get; set; }
        public string ImageId { get; set; }

        public int? BlogPostID { get; set; }
        [ForeignKey("BlogPostID")]
        public virtual BlogPost BlogPost { get; set; }
    }
}


text:
<?php
/**
 * The sidebar containing the main widget area
 *
 * If no active widgets are in the sidebar, hide it completely.
 *
 * @package WordPress
 * @subpackage Twenty_Twelve
 * @since Twenty Twelve 1.0
 */
?>

	<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
		<div id="secondary" class="widget-area" role="complementary">
			<?php dynamic_sidebar( 'sidebar-1' ); ?>
		</div><!-- #secondary -->
	<?php endif; ?>


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta http-equiv="x-ua-compatible" content="ie=edge">
	<title>Drag and Drop Quiz</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<meta name="theme-color" content="#999999">

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

		<button class="quiz__reset" type="button" name="button">Start over</button>

Let's play

			<button class="btn quiz__next" type="button" name="button">Start</button>

					<input type="radio" name="radio1" id="radio_1" value="">
					Radio 1

					<input type="radio" name="radio1" id="radio_2" value="">
					Radio 2

					<input type="radio" name="radio1" id="radio_3" value="">
					Radio 3

					<input type="radio" name="radio1" id="radio_4" value="">
					Radio 4

			<button class="btn quiz__next" type="button" name="button" disabled="disabled">Next</button>

					<input type="radio" name="radio2" id="radio_5" value="">
					Radio 1

					<input type="radio" name="radio2" id="radio_6" value="">
					Radio 2

					<input type="radio" name="radio2" id="radio_7" value="">
					Radio 3

					<input type="radio" name="radio2" id="radio_8" value="">
					Radio 4

			<button class="btn quiz__next" type="button" name="button" disabled="disabled">Next</button>

			Reset

			<button class="btn quiz__next" type="button" name="button">Next</button>

			Reset

			<button class="btn quiz__next" type="button" name="button">Next</button>

You are a narwhal!

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

			<button class="btn quiz__next" type="button" name="button">Next</button>

More stuff!

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

			<form id="form--email" class="form--email" action="" method="post">
				<input type="email" name="name" value="" placeholder="Email Address">
				<button class="btn email__submit" type="submit" name="button">Send</button>
				No thanks
			</form>

			<button class="btn quiz__next no-connection" type="button" name="button">Next</button>

Thanks for playing!

			<button class="btn quiz__reset" type="button" name="button">Start over</button>