text:
#ifndef _CONDOR_COMMANDS_H
#define _CONDOR_COMMANDS_H

/* these control the command_table_generator.pl script that makes the command id <-> name lookup tables.
NAMETABLE_DIRECTIVE:CLASS:BTranslation
NAMETABLE_DIRECTIVE:TABLE:DCTranslation
*/

/****
** Queue Manager Commands
****/
#define QMGMT_BASE		1110
#define QMGMT_READ_CMD	(QMGMT_BASE+1)
#define QMGMT_WRITE_CMD	(QMGMT_BASE+2)

/* Scheduler Commands */
/*
**	Scheduler version number
*/
#define SCHED_VERS			400
#define HAD_COMMANDS_BASE                  (700)
#define REPLICATION_COMMANDS_BASE          (800)
#define CA_AUTH_CMD_BASE	1000
// beware, QMGMT_CMD is 1111, so we don't want to use 1100...
#define CA_CMD_BASE			1200

/*
**	In the following definitions 'FRGN' does not
**	stand for "friggin'"...
*/
#define CONTINUE_CLAIM		(SCHED_VERS+1)		// New name for CONTINUE_FRGN_JOB
#define SUSPEND_CLAIM		(SCHED_VERS+2)		// New name for SUSPEND_FRGN_JOB
#define DEACTIVATE_CLAIM	(SCHED_VERS+3)		// New name for CKPT_FRGN_JOB
#define DEACTIVATE_CLAIM_FORCIBLY	(SCHED_VERS+4)		// New name for KILL_FRGN_JOB

#define LOCAL_STATUS		(SCHED_VERS+5)		/* Not used */
//#define LOCAL_STATISTICS	(SCHED_VERS+6)		/* Not used */

#define PERMISSION			(SCHED_VERS+7)		// used in negotiation protocol
//#define SET_DEBUG_FLAGS		(SCHED_VERS+8)		/* Not used */
//#define PREEMPT_LOCAL_JOBS	(SCHED_VERS+9)		/* Not used */

//#define RM_LOCAL_JOB		(SCHED_VERS+10)		/* Not used */
//#define START_FRGN_JOB		(SCHED_VERS+11)		/* Not used */

//#define AVAILABILITY		(SCHED_VERS+12)		/* Not used */
//#define NUM_FRGN_JOBS		(SCHED_VERS+13)		/* Not used */
//#define STARTD_INFO			(SCHED_VERS+14)		/* Not used */
//#define SCHEDD_INFO			(SCHED_VERS+15)		/* Not used */
#define NEGOTIATE			(SCHED_VERS+16) // 7.5.4+ negotiation command
#define SEND_JOB_INFO		(SCHED_VERS+17)     // used in negotiation protocol
#define NO_MORE_JOBS		(SCHED_VERS+18)		// used in negotiation protocol
#define JOB_INFO			(SCHED_VERS+19)		// used in negotiation protocol
//#define GIVE_STATUS			(SCHED_VERS+20)		/* Not used */
#define RESCHEDULE			(SCHED_VERS+21)
//#define PING				(SCHED_VERS+22)			/* Not used */
//#define NEGOTIATOR_INFO		(SCHED_VERS+23)		/* Not used */
//#define GIVE_STATUS_LINES	(SCHED_VERS+24)			/* Not used */
#define END_NEGOTIATE		(SCHED_VERS+25)		// used in negotiation protocol
#define REJECTED			(SCHED_VERS+26)
#define X_EVENT_NOTIFICATION		(SCHED_VERS+27)
//#define RECONFIG			(SCHED_VERS+28)			/* Not used */
#define GET_HISTORY			(SCHED_VERS+29)		/* repurposed in 8.9.7 to be query startd history */
//#define UNLINK_HISTORY_FILE			(SCHED_VERS+30)	/* Not used */
//#define UNLINK_HISTORY_FILE_DONE	(SCHED_VERS+31)		/* Not used */
//#define DO_NOT_UNLINK_HISTORY_FILE	(SCHED_VERS+32)	/* Not used */
//#define SEND_ALL_JOBS		(SCHED_VERS+33)			/* Not used */
//#define SEND_ALL_JOBS_PRIO	(SCHED_VERS+34)			/* Not used */
#define REQ_NEW_PROC		(SCHED_VERS+35)
#define PCKPT_FRGN_JOB		(SCHED_VERS+36)
//#define SEND_RUNNING_JOBS	(SCHED_VERS+37)			/* Not used */
//#define CHECK_CAPABILITY    (SCHED_VERS+38)		/* Not used */
//#define GIVE_PRIORITY		(SCHED_VERS+39)			/* Not used */
#define	MATCH_INFO			(SCHED_VERS+40)
#define	ALIVE				(SCHED_VERS+41)
#define REQUEST_CLAIM 		(SCHED_VERS+42)
#define RELEASE_CLAIM 		(SCHED_VERS+43)
#define ACTIVATE_CLAIM	 	(SCHED_VERS+44)
//#define PRIORITY_INFO       (SCHED_VERS+45)     /* negotiator to accountant, Not used */
#define PCKPT_ALL_JOBS		(SCHED_VERS+46)
#define VACATE_ALL_CLAIMS	(SCHED_VERS+47)
#define GIVE_STATE			(SCHED_VERS+48)
#define SET_PRIORITY		(SCHED_VERS+49)		// negotiator(priviliged) cmd
//#define GIVE_CLASSAD		(SCHED_VERS+50)		/* Not used */
#define GET_PRIORITY		(SCHED_VERS+51)		// negotiator
#define DAEMONS_OFF_FLEX	(SCHED_VERS+52)		// DAEMON_OFF but with a classad payload and optional reply
#define RESTART				(SCHED_VERS+53)
#define DAEMONS_OFF			(SCHED_VERS+54)
#define DAEMONS_ON			(SCHED_VERS+55)
#define MASTER_OFF			(SCHED_VERS+56)
#define CONFIG_VAL			(SCHED_VERS+57)
#define RESET_USAGE			(SCHED_VERS+58)		// negotiator
#define SET_PRIORITYFACTOR	(SCHED_VERS+59)		// negotiator
#define RESET_ALL_USAGE		(SCHED_VERS+60)		// negotiator
#define DAEMONS_OFF_FAST	(SCHED_VERS+61)
#define MASTER_OFF_FAST		(SCHED_VERS+62)
#define GET_RESLIST			(SCHED_VERS+63)		// negotiator
#define ATTEMPT_ACCESS		(SCHED_VERS+64) 	// schedd, test a file
#define VACATE_CLAIM		(SCHED_VERS+65)     // vacate a given claim
#define PCKPT_JOB			(SCHED_VERS+66)     // periodic ckpt a given slot
#define DAEMON_OFF			(SCHED_VERS+67)		// specific daemon, subsys follows
#define DAEMON_OFF_FAST		(SCHED_VERS+68)		// specific daemon, subsys follows
#define DAEMON_ON			(SCHED_VERS+69)		// specific daemon, subsys follows
#define GIVE_TOTALS_CLASSAD	(SCHED_VERS+70)
//#define DUMP_STATE          (SCHED_VERS+71)	// drop internal vars into classad (Not used)
#define PERMISSION_AND_AD	(SCHED_VERS+72) // negotiator is sending startad to schedd
//#define REQUEST_NETWORK		(SCHED_VERS+73)	// negotiator network mgmt, Not used
#define VACATE_ALL_FAST		(SCHED_VERS+74)		// fast vacate for whole machine
#define VACATE_CLAIM_FAST	(SCHED_VERS+75)  	// fast vacate for a given slot
#define REJECTED_WITH_REASON (SCHED_VERS+76) // diagnostic version of REJECTED
#define START_AGENT			(SCHED_VERS+77) // have the master start an agent
#define ACT_ON_JOBS			(SCHED_VERS+78) // have the schedd act on some jobs (rm, hold, release)
#define STORE_CRED			(SCHED_VERS+79)		// schedd, store a credential
#define SPOOL_JOB_FILES		(SCHED_VERS+80)	// spool all job files via filetransfer object
//#define GET_MYPROXY_PASSWORD (SCHED_VERS+81) // gmanager->schedd: Give me MyProxy password, Not used
#define DELETE_USER			(SCHED_VERS+82)		// negotiator  (actually, accountant)
#define DAEMON_OFF_PEACEFUL  (SCHED_VERS+83)		// specific daemon, subsys follows
#define DAEMONS_OFF_PEACEFUL (SCHED_VERS+84)
#define RESTART_PEACEFUL     (SCHED_VERS+85)
#define TRANSFER_DATA		(SCHED_VERS+86) // send all job files back via filetransfer object
#define UPDATE_GSI_CRED		(SCHED_VERS+87) // send refreshed gsi proxy file
#define SPOOL_JOB_FILES_WITH_PERMS	(SCHED_VERS+88)	// spool all job files via filetransfer object (new version with file permissions)
#define TRANSFER_DATA_WITH_PERMS	(SCHED_VERS+89) // send all job files back via filetransfer object (new version with file permissions)
#define CHILD_ON            (SCHED_VERS+90) // Turn my child ON (HAD)
#define CHILD_OFF           (SCHED_VERS+91) // Turn my child OFF (HAD)
#define CHILD_OFF_FAST      (SCHED_VERS+92) // Turn my child OFF/Fast (HAD)
#define NEGOTIATE_WITH_SIGATTRS	(SCHED_VERS+93)	// pre 7.5.4 NEGOTIATE
#define SET_ACCUMUSAGE	(SCHED_VERS+94)		// negotiator
#define SET_BEGINTIME	(SCHED_VERS+95)		// negotiator
#define SET_LASTTIME	(SCHED_VERS+96)		// negotiator
#define STORE_POOL_CRED		(SCHED_VERS+97)	// master, store password for daemon-to-daemon shared secret auth (PASSWORD)
//#define VM_REGISTER	(SCHED_VERS+98)		// Virtual Machine (*not* "slot") (Not used)
#define DELEGATE_GSI_CRED_SCHEDD	(SCHED_VERS+99) // delegate refreshed gsi proxy to schedd
#define DELEGATE_GSI_CRED_STARTER (SCHED_VERS+100) // delegate refreshed gsi proxy to starter
#define DELEGATE_GSI_CRED_STARTD (SCHED_VERS+101) // delegate gsi proxy to startd
#define REQUEST_SANDBOX_LOCATION (SCHED_VERS+102) // get the sinful of a transferd (Not used)
#define VM_UNIV_GAHP_ERROR   (SCHED_VERS+103) // report the error of vmgahp to startd
#define VM_UNIV_VMPID		(SCHED_VERS+104) // PID of process for a VM
#define VM_UNIV_GUEST_IP	(SCHED_VERS+105) // IP address of VM
#define VM_UNIV_GUEST_MAC	(SCHED_VERS+106) // MAC address of VM

#define TRANSFER_QUEUE_REQUEST (SCHED_VERS+107) // request to do file transfer

#define SET_SHUTDOWN_PROGRAM (SCHED_VERS+108) // Master: Run program at shutdown
#define GET_JOB_CONNECT_INFO (SCHED_VERS+109) // schedd: get connection information for starter running a job

#define RECYCLE_SHADOW (SCHED_VERS+110) // schedd: get a new job for a shadow
#define CLEAR_DIRTY_JOB_ATTRS (SCHED_VERS+111) // schedd: clear dirty attributes for a job
// These two commands originally used the same command int by mistake.
// In 7.9.6, GET_PRIORITY_ROLLUP was assigned a new command int.
#define GET_PRIORITY_ROLLUP_OLD DRAIN_JOBS // negotiator
#define DRAIN_JOBS (SCHED_VERS+112)
#define CANCEL_DRAIN_JOBS (SCHED_VERS+113)
#define GET_PRIORITY_ROLLUP (SCHED_VERS+114) // negotiator
#define QUERY_SCHEDD_HISTORY (SCHED_VERS+115)
#define QUERY_JOB_ADS (SCHED_VERS+116)
//#define SWAP_CLAIM_AND_ACTIVATION (SCHED_VERS+117) // swap claim & activation between two STARTD resources, for moving a job into a 'transfer' slot. (Not used)
#define SEND_RESOURCE_REQUEST_LIST	(SCHED_VERS+118)     // used in negotiation protocol
#define QUERY_JOB_ADS_WITH_AUTH (SCHED_VERS+119) // Same as QUERY_JOB_ADS but requires authentication
#define FETCH_PROXY_DELEGATION (SCHED_VERS+120)

#define REASSIGN_SLOT (SCHED_VERS+121) // Given two job IDs, deactivate the victim job's claim and reactivate it running the beneficiary job.
#define COALESCE_SLOTS (SCHED_VERS+122) // Given a resource request (job ad) and k claim IDs, invalidate them, merge them into one slot, and return that slot's new claim ID and machine ad.  The resource request is used to compute left-overs.

// Given a token request from a trusted collector, generate an identity token.
#define COLLECTOR_TOKEN_REQUEST (SCHED_VERS+123)
// Get the SubmitterCeiling
#define GET_CEILING (SCHED_VERS+124)
#define SET_CEILING (SCHED_VERS+125)

#define EXPORT_JOBS (SCHED_VERS+126) // Schedd: export selected jobs to a new job_queue.log put jobs into externally managed state
#define IMPORT_EXPORTED_JOB_RESULTS (SCHED_VERS+127) // Schedd: import changes to previously exported jobs and take them out of managed state
#define UNEXPORT_JOBS (SCHED_VERS+128) // Schedd: undo previous export of selected jobs, taking them out of managed state
// Get the Submitter Floor
#define GET_FLOOR (SCHED_VERS+129)
#define SET_FLOOR (SCHED_VERS+130)

// values used for "HowFast" in the draining request
#define DRAIN_GRACEFUL 0  // retirement time and vacate time are honored
#define DRAIN_QUICK 10	  // retirement time will not be honored, but vacate time will
#define DRAIN_FAST 20	  // neither retirement time nor vacate time will be honored

// values for OnCompletion for draining request
// note that prior to 8.9.11 only Resume and Nothing are recognised
#define DRAIN_NOTHING_ON_COMPLETION 0
#define DRAIN_RESUME_ON_COMPLETION  1
#define DRAIN_EXIT_ON_COMPLETION    2
#define DRAIN_RESTART_ON_COMPLETION 3
#define DRAIN_RECONFIG_ON_COMPLETION 4 // New for 9.11.0

// HAD-related commands
#define HAD_ALIVE_CMD                   (HAD_COMMANDS_BASE + 0)
#define HAD_SEND_ID_CMD                 (HAD_COMMANDS_BASE + 1)
//#define HAD_REPL_UPDATE_VERSION         (HAD_COMMANDS_BASE + 2)	/* Not used */
#define HAD_BEFORE_PASSIVE_STATE        (HAD_COMMANDS_BASE + 3)
#define HAD_AFTER_ELECTION_STATE        (HAD_COMMANDS_BASE + 4)
#define HAD_AFTER_LEADER_STATE          (HAD_COMMANDS_BASE + 5)
#define HAD_IN_LEADER_STATE             (HAD_COMMANDS_BASE + 6)

// Replication-related commands
#define REPLICATION_TRANSFER_FILE          (REPLICATION_COMMANDS_BASE + 0)
#define REPLICATION_LEADER_VERSION         (REPLICATION_COMMANDS_BASE + 1)
#define REPLICATION_NEWLY_JOINED_VERSION   (REPLICATION_COMMANDS_BASE + 2)
#define REPLICATION_GIVING_UP_VERSION      (REPLICATION_COMMANDS_BASE + 3)
#define REPLICATION_SOLICIT_VERSION        (REPLICATION_COMMANDS_BASE + 4)
#define REPLICATION_SOLICIT_VERSION_REPLY  (REPLICATION_COMMANDS_BASE + 5)
#define REPLICATION_TRANSFER_FILE_NEW      (REPLICATION_COMMANDS_BASE + 6)

/*
  The ClassAd-only protocol.  CA_CMD is the base command that's sent
  on the wire that means "read a ClassAd off the wire, lookup
  ATTR_COMMAND, do the right thing, and send the results back as a
  ClassAd".  The rest of the commands listed here are possible values
  for ATTR_COMMAND.
  CA_AUTH_CMD forces authentication if that's needed, while CA_CMD
  just uses whatever authentication methods are configured.
*/

#define CA_AUTH_CMD                  (CA_AUTH_CMD_BASE+0)

// generic claiming protocol that the startd uses for COD
#define CA_REQUEST_CLAIM        (CA_AUTH_CMD_BASE+1)
#define CA_RELEASE_CLAIM        (CA_AUTH_CMD_BASE+2)
#define CA_ACTIVATE_CLAIM       (CA_AUTH_CMD_BASE+3)
#define CA_DEACTIVATE_CLAIM     (CA_AUTH_CMD_BASE+4)
#define CA_SUSPEND_CLAIM        (CA_AUTH_CMD_BASE+5)
#define CA_RESUME_CLAIM         (CA_AUTH_CMD_BASE+6)
#define CA_RENEW_LEASE_FOR_CLAIM (CA_AUTH_CMD_BASE+7)
// other commands that use the ClassAd-only protocol
// CA_LOCATE_STARTER used to be (CA_AUTH_CMD_BASE+7), but no more
// CA_RECONNECT_JOB used to be  (CA_AUTH_CMD_BASE+8), but no more

// Use the ClassAd-based protocol for updating the machine ClassAd.
#define CA_UPDATE_MACHINE_AD	(CA_AUTH_CMD_BASE+9)
// Use the ClassAd-based protocol for communicating with the annex daemon.
#define CA_BULK_REQUEST			(CA_AUTH_CMD_BASE+10)

#define CA_CMD                  (CA_CMD_BASE+0)
#define CA_LOCATE_STARTER       (CA_CMD_BASE+1)
#define CA_RECONNECT_JOB        (CA_CMD_BASE+2)

/* these comments are parsed by command_table_generator.pl
NAMETABLE_DIRECTIVE:BEGIN_SECTION:COLLECTOR
NAMETABLE_DIRECTIVE:PARSE:const int
NAMETABLE_DIRECTIVE:BASE:0
*/

/************
*** Command ids used by the collector
************/
const int UPDATE_STARTD_AD		= 0;
const int UPDATE_SCHEDD_AD		= 1;
const int UPDATE_MASTER_AD		= 2;
//const int UPDATE_GATEWAY_AD		= 3;			/* Not used */
const int UPDATE_CKPT_SRVR_AD	= 4;

const int QUERY_STARTD_ADS		= 5;
const int QUERY_SCHEDD_ADS		= 6;
const int QUERY_MASTER_ADS		= 7;
//const int QUERY_GATEWAY_ADS		= 8;			/* Not used */
const int QUERY_CKPT_SRVR_ADS	= 9;
const int QUERY_STARTD_PVT_ADS	= 10;

const int UPDATE_SUBMITTOR_AD	= 11;
const int QUERY_SUBMITTOR_ADS	= 12;

const int INVALIDATE_STARTD_ADS	= 13;
const int INVALIDATE_SCHEDD_ADS	= 14;
const int INVALIDATE_MASTER_ADS	= 15;
//const int INVALIDATE_GATEWAY_ADS	= 16;			/* Not used */
const int INVALIDATE_CKPT_SRVR_ADS	= 17;
const int INVALIDATE_SUBMITTOR_ADS	= 18;

const int UPDATE_COLLECTOR_AD	= 19;
const int QUERY_COLLECTOR_ADS	= 20;
const int INVALIDATE_COLLECTOR_ADS	= 21;

const int QUERY_HIST_STARTD = 22;
const int QUERY_HIST_STARTD_LIST = 23;
const int QUERY_HIST_SUBMITTOR = 24;
const int QUERY_HIST_SUBMITTOR_LIST = 25;
const int QUERY_HIST_GROUPS = 26;
const int QUERY_HIST_GROUPS_LIST = 27;
const int QUERY_HIST_SUBMITTORGROUPS = 28;
const int QUERY_HIST_SUBMITTORGROUPS_LIST = 29;
const int QUERY_HIST_CKPTSRVR = 30;
const int QUERY_HIST_CKPTSRVR_LIST = 31;

const int UPDATE_LICENSE_AD			= 42;
const int QUERY_LICENSE_ADS			= 43;
const int INVALIDATE_LICENSE_ADS	= 44;

const int UPDATE_STORAGE_AD = 45;
const int QUERY_STORAGE_ADS = 46;
const int INVALIDATE_STORAGE_ADS = 47;

const int QUERY_ANY_ADS = 48;

const int UPDATE_NEGOTIATOR_AD 	= 49;
const int QUERY_NEGOTIATOR_ADS	= 50;
const int INVALIDATE_NEGOTIATOR_ADS = 51;

const int UPDATE_HAD_AD = 55;
const int QUERY_HAD_ADS = 56;
const int INVALIDATE_HAD_ADS = 57;

const int UPDATE_AD_GENERIC = 58;
const int INVALIDATE_ADS_GENERIC = 59;

const int UPDATE_STARTD_AD_WITH_ACK = 60;

//const int UPDATE_XFER_SERVICE_AD		= 61;	/* Not used */
//const int QUERY_XFER_SERVICE_ADS		= 62;	/* Not used */
//const int INVALIDATE_XFER_SERVICE_ADS	= 63;	/* Not used */

//const int UPDATE_LEASE_MANAGER_AD		= 64;	/* Not used */
//const int QUERY_LEASE_MANAGER_ADS		= 65;	/* Not used */
//const int INVALIDATE_LEASE_MANAGER_ADS  = 66;	/* Not used */

const int CCB_REGISTER = 67;
const int CCB_REQUEST = 68;
const int CCB_REVERSE_CONNECT = 69;

const int UPDATE_GRID_AD 	= 70;
const int QUERY_GRID_ADS	= 71;
const int INVALIDATE_GRID_ADS = 72;

const int MERGE_STARTD_AD = 73;
const int QUERY_GENERIC_ADS = 74;

const int SHARED_PORT_CONNECT = 75;
const int SHARED_PORT_PASS_SOCK = 76;

const int UPDATE_ACCOUNTING_AD = 77;
const int QUERY_ACCOUNTING_ADS = 78;
const int INVALIDATE_ACCOUNTING_ADS = 79;

const int UPDATE_OWN_SUBMITTOR_AD = 80;

// Request a collector to retrieve an identity token from a schedd.
const int IMPERSONATION_TOKEN_REQUEST = 81;

/* these comments are used to control command_table_generator.pl
NAMETABLE_DIRECTIVE:END_SECTION:collector
*/

/*
*** Commands to the starter
*/

#define STARTER_COMMANDS_BASE 1500
#define STARTER_HOLD_JOB    (STARTER_COMMANDS_BASE+0)
#define CREATE_JOB_OWNER_SEC_SESSION (STARTER_COMMANDS_BASE+1)
#define START_SSHD (STARTER_COMMANDS_BASE+2)
#define STARTER_PEEK (STARTER_COMMANDS_BASE+3)

/*
*** Daemon Core Signals
*/

// Signals used for Startd -> Starter communication
#define DC_SIGSUSPEND	100
#define DC_SIGCONTINUE	101
#define DC_SIGSOFTKILL	102	// vacate w/ checkpoint
#define DC_SIGHARDKILL	103 // kill w/o checkpoint
#define DC_SIGPCKPT		104	// periodic checkpoint
#define DC_SIGREMOVE	105
#define DC_SIGHOLD		106

/*
*** Daemon Core Commands and Signals
*/
#define DC_BASE	60000
#define DC_RAISESIGNAL		(DC_BASE+0)
#define DC_CONFIG_PERSIST	(DC_BASE+2)
#define DC_CONFIG_RUNTIME	(DC_BASE+3)
#define DC_RECONFIG			(DC_BASE+4)
#define DC_OFF_GRACEFUL		(DC_BASE+5)
#define DC_OFF_FAST			(DC_BASE+6)
#define DC_CONFIG_VAL		(DC_BASE+7)
#define DC_CHILDALIVE		(DC_BASE+8)
#define DC_SERVICEWAITPIDS	(DC_BASE+9)
#define DC_AUTHENTICATE     (DC_BASE+10)
#define DC_NOP              (DC_BASE+11)
#define DC_RECONFIG_FULL	(DC_BASE+12)
#define DC_FETCH_LOG        (DC_BASE+13)
#define DC_INVALIDATE_KEY   (DC_BASE+14)
#define DC_OFF_PEACEFUL     (DC_BASE+15)
#define DC_SET_PEACEFUL_SHUTDOWN (DC_BASE+16)
#define DC_TIME_OFFSET      (DC_BASE+17)
#define DC_PURGE_LOG        (DC_BASE+18)
//#define DC_SHARE_SOCK       (DC_BASE+19)		/* Not used */

// these are all NOP but registered at different authz levels
#define DC_NOP_READ         (DC_BASE+20)
#define DC_NOP_WRITE        (DC_BASE+21)
#define DC_NOP_NEGOTIATOR   (DC_BASE+22)
#define DC_NOP_ADMINISTRATOR (DC_BASE+23)
#define DC_NOP_OWNER        (DC_BASE+24)
#define DC_NOP_CONFIG       (DC_BASE+25)
#define DC_NOP_DAEMON       (DC_BASE+26)
#define DC_NOP_ADVERTISE_STARTD (DC_BASE+27)
#define DC_NOP_ADVERTISE_SCHEDD (DC_BASE+28)
#define DC_NOP_ADVERTISE_MASTER (DC_BASE+29)
// leave 30-39 open -- zmiller
#define DC_SEC_QUERY        (DC_BASE+40)
#define DC_SET_FORCE_SHUTDOWN (DC_BASE+41)
#define DC_OFF_FORCE       (DC_BASE+42)
#define DC_SET_READY       (DC_BASE+43)  // sent to parent to indicate a demon is ready for use
#define DC_QUERY_READY     (DC_BASE+44)  // daemon command handler should reply only once it and children are ready
#define DC_QUERY_INSTANCE  (DC_BASE+45)  // ask if a daemon is alive - returns a random 64 bit int that will not change as long as this instance is alive.
#define DC_GET_SESSION_TOKEN (DC_BASE+46) // Retrieve an authentication token for TOKEN that is at most equivalent to the current session.
#define DC_START_TOKEN_REQUEST (DC_BASE+47) // Request a token from this daemon.
#define DC_FINISH_TOKEN_REQUEST (DC_BASE+48) // Poll remote daemon for available token.
#define DC_LIST_TOKEN_REQUEST (DC_BASE+49) // Poll for the existing token requests.
#define DC_APPROVE_TOKEN_REQUEST (DC_BASE+50) // Approve a token request.
#define DC_AUTO_APPROVE_TOKEN_REQUEST (DC_BASE+51) // Auto-approve token requests.
#define DC_EXCHANGE_SCITOKEN (DC_BASE+52) // Exchange a SciToken for a Condor token.

/*
*** Log type supported by DC_FETCH_LOG
*** These are not interpreted directly by DaemonCore,
*** so it's ok that they start at zero.
*/

#define DC_FETCH_LOG_TYPE_PLAIN 0
#define DC_FETCH_LOG_TYPE_HISTORY 1
#define DC_FETCH_LOG_TYPE_HISTORY_DIR 2
#define DC_FETCH_LOG_TYPE_HISTORY_PURGE 3
  /* Add more type here... */

/*
*** Result codes given by DC_FETCH_LOG.
*** These are not interpreted directly by DaemonCore,
*** so it's ok that they start at zero.
*/

#define DC_FETCH_LOG_RESULT_SUCCESS   0
#define DC_FETCH_LOG_RESULT_NO_NAME   1
#define DC_FETCH_LOG_RESULT_CANT_OPEN 2
#define DC_FETCH_LOG_RESULT_BAD_TYPE  3

/*
*** Commands used by the FileTransfer object
*/
#define FILETRANSFER_BASE 61000
#define FILETRANS_UPLOAD (FILETRANSFER_BASE+0)
#define FILETRANS_DOWNLOAD (FILETRANSFER_BASE+1)

/*
*** Condor Password Daemon Commands
*/
//#define PW_BASE 70000							/* Not used */
//#define PW_SETPASS			(PW_BASE+1)		/* Not used */
//#define PW_GETPASS			(PW_BASE+2)		/* Not used */
//#define PW_CLEARPASS		(PW_BASE+3)			/* Not used */

/*
*** Commands used by the daemon core Shadow
*/
#define DCSHADOW_BASE 71000
#define SHADOW_UPDATEINFO	   (DCSHADOW_BASE+0)
//#define TAKE_MATCH             (DCSHADOW_BASE+1)  // for MPI & parallel shadow, Not used
#define MPI_START_COMRADE      (DCSHADOW_BASE+2)  // for MPI & parallel shadow
#define GIVE_MATCHES 	       (DCSHADOW_BASE+3)  // for MPI & parallel shadow
//#define RECEIVE_JOBAD		   (DCSHADOW_BASE+4)	/* Not used */
#define UPDATE_JOBAD		   (DCSHADOW_BASE+5)

/*
*** Used only in THE TOOL to choose the condor_squawk option.
*/
#define SQUAWK 72000

/*
*** Commands used by the gridmanager daemon
*/
#define DCGRIDMANAGER_BASE 73000
#define GRIDMAN_CHECK_LEASES (DCGRIDMANAGER_BASE+0)
#define GRIDMAN_REMOVE_JOBS SIGUSR1
#define GRIDMAN_ADD_JOBS SIGUSR2

/*
*** Commands used by the transfer daemon
*/
//#define TRANSFERD_BASE 74000
/* This is used by the schedd when a transferd registers itself */
//#define TRANSFERD_REGISTER		(TRANSFERD_BASE+0)	// Not used
/* a channel under which a transferd may be sent control message such as
	being informed of a new a new transfer request
*/
//#define TRANSFERD_CONTROL_CHANNEL	(TRANSFERD_BASE+1)	// Not used
/* Files are being written to the transferd for storage */
//#define TRANSFERD_WRITE_FILES	(TRANSFERD_BASE+2)	// Not used
/* files are being read from the transferd's storage */
//#define TRANSFERD_READ_FILES	(TRANSFERD_BASE+3)	// Not used

/*
*** Commands used by the credd daemon
*/
#define CREDD_BASE 81000
#define CREDD_STORE_CRED (CREDD_BASE+0)
#define CREDD_GET_CRED (CREDD_BASE+1)
#define CREDD_REMOVE_CRED (CREDD_BASE+2)
#define CREDD_QUERY_CRED (CREDD_BASE+3)
#define CREDD_REFRESH_ALL (CREDD_BASE+20)
#define CREDD_CHECK_CREDS (CREDD_BASE+30)	// check to see if the desired oauth tokens are stored
#define CREDD_GET_PASSWD (CREDD_BASE+99)	// used by the Win32 credd only
#define CREDD_NOP (CREDD_BASE+100)			// used by the Win32 credd only

/*
*** Replies used in various stages of various protocols
*/

/* Failure cases */
#ifndef NOT_OK
#define NOT_OK		0
#endif
#ifndef REJECTED
#define REJECTED	0
#endif

/* Success cases */
#ifndef OK
#define OK			1
#endif
#ifndef ACCEPTED
#define ACCEPTED	1
#endif

/* Other replies */
#define CONDOR_TRY_AGAIN	2
#define CONDOR_ERROR	3

/* Replies specific to the REQUEST_CLAIM command */
#define REQUEST_CLAIM_LEFTOVERS		3
//#define REQUEST_CLAIM_PAIR			4	// Not used
#define REQUEST_CLAIM_LEFTOVERS_2	5
//#define REQUEST_CLAIM_PAIR_2		6		// Not used

#endif  /* of ifndef _CONDOR_COMMANDS_H */


text:
package io.quarkus.quartz.runtime.graal;

import java.io.ByteArrayOutputStream;
import java.rmi.RemoteException;
import java.sql.ResultSet;

import org.quartz.core.RemotableQuartzScheduler;
import org.quartz.impl.jdbcjobstore.StdJDBCDelegate;

import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

@TargetClass(className = "org.quartz.core.QuartzScheduler")
final class Target_org_quartz_core_QuartzScheduler {

    @Substitute
    private void bind() throws RemoteException {
    }

    @Substitute
    private void unBind() throws RemoteException {
    }

    @Substitute
    private void registerJMX() throws Exception {
    }

    @Substitute
    private void unregisterJMX() throws Exception {
    }
}

@TargetClass(className = "org.quartz.impl.RemoteScheduler")
final class Target_org_quartz_impl_RemoteScheduler {

    @Substitute
    protected RemotableQuartzScheduler getRemoteScheduler() {
        return null;
    }

}

@TargetClass(StdJDBCDelegate.class)
final class Target_org_quartz_impl_jdbc_jobstore_StdJDBCDelegate {

    /**
     * Activate the usage of {@link java.util.Properties} to avoid Object serialization
     * which is not supported by GraalVM - see https://github.com/oracle/graal/issues/460
     *
     * @return true
     */
    @Substitute
    protected boolean canUseProperties() {
        return true;
    }

    @Substitute
    protected ByteArrayOutputStream serializeObject(Object obj) {
        throw new IllegalStateException("Object serialization not supported."); // should not reach here
    }

    @Substitute
    protected Object getObjectFromBlob(ResultSet rs, String colName) {
        throw new IllegalStateException("Object serialization not supported."); // should not reach here
    }
}

final class QuartzSubstitutions {
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef UAVCAN_PROTOCOL_DYNAMIC_NODE_ID_SERVER_STORAGE_BACKEND_HPP_INCLUDED
#define UAVCAN_PROTOCOL_DYNAMIC_NODE_ID_SERVER_STORAGE_BACKEND_HPP_INCLUDED

#include <uavcan/build_config.hpp>
#include <uavcan/marshal/types.hpp>

namespace uavcan
{
namespace dynamic_node_id_server
{
/**
 * This interface is used by the server to read and write stable storage.
 * The storage is represented as a key-value container, where keys and values are ASCII strings up to 32
 * characters long, not including the termination byte. Fixed block size allows for absolutely straightforward
 * and efficient implementation of storage backends, e.g. based on text files.
 * Keys and values may contain only non-whitespace, non-formatting printable characters.
 */
class UAVCAN_EXPORT IStorageBackend
{
public:
    /**
     * Maximum length of keys and values. One pair takes twice as much space.
     */
    enum { MaxStringLength = 32 };

    /**
     * It is guaranteed that the server will never require more than this number of key/value pairs.
     * Total storage space needed is (MaxKeyValuePairs * MaxStringLength * 2), not including storage overhead.
     */
    enum { MaxKeyValuePairs = 512 };

    /**
     * This type is used to exchange data chunks with the backend.
     * It doesn't use any dynamic memory; please refer to the Array<> class for details.
     */
    typedef MakeString<MaxStringLength>::Type String;

    /**
     * Read one value from the storage.
     * If such key does not exist, or if read failed, an empty string will be returned.
     * This method should not block for more than 50 ms.
     */
    virtual String get(const String& key) const = 0;

    /**
     * Create or update value for the given key. Empty value should be regarded as a request to delete the key.
     * This method should not block for more than 50 ms.
     * Failures will be ignored.
     */
    virtual void set(const String& key, const String& value) = 0;

    virtual ~IStorageBackend() { }
};

}
}

#endif // Include guard


text:
body {
	padding-top: 40px;
	padding-bottom: 40px;
	background-color: #eee;
}


text:
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
 * @name: S15.6.4.3_A2_T1;
 * @section: 15.6.4.3;
 * @assertion: The valueOf function is not generic, it cannot be transferred
 * to other kinds of objects for use as a method and there is should be
 * a TypeError exception if its this value is not a Boolean object;
 * @description: transferring to the String objects;
*/

//CHECK#1
try{
  var s1 = new String();
  s1.valueOf = Boolean.prototype.valueOf;
  var v1 = s1.valueOf();
  $ERROR('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError');
}
catch(e){
  if(!(e instanceof TypeError)){
    $ERROR('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not '+e);
  }
}

//CHECK#1
try{
  var s2 = new String();
  s2.myValueOf = Boolean.prototype.valueOf;
  var v2 = s2.myValueOf();
  $ERROR('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError');
}
catch(e){
  if(!(e instanceof TypeError)){
    $ERROR('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not '+e);
  }
}


text:
#pragma once

#include "common.h"
#include <temple/dll.h>

const float tileToOffset = 12.0;
#define LOCATION_OFFSET_TOL 0.001 // when comparing offsets, differences smaller than this will be considered as ignorable computational error

struct LocationSys : temple::AddressTable
{
	int64_t * locTransX;
	int64_t*locTransY;
	float distBtwnLocAndOffs(LocAndOffsets, LocAndOffsets); // in inches
	void RegularizeLoc(LocAndOffsets* toLocTweaked); //  alters the location and offsets so that the offsets are within the tile
	void GetOverallOffset(LocAndOffsets loc, float* absX, float* absY);
	BOOL ShiftLocationByOneSubtile(LocAndOffsets* loc, ScreenDirections direction, LocAndOffsets* locOut);

	void (__cdecl*PointNodeInit)(LocAndOffsets* loc, PointNode* pntNode);
	int GetLocFromScreenLocPrecise(int x, int y, LocAndOffsets&);

	void(__cdecl * getLocAndOff)(objHndl objHnd, LocAndOffsets * locAndOff);
	void(__cdecl* SubtileToLocAndOff)(int64_t subtile, LocAndOffsets* locFromSubtile);
	int64_t(__cdecl * subtileFromLoc)(LocAndOffsets * loc);
	BOOL(__cdecl* ShiftSubtileOnceByDirection)(Subtile subtile, int direction, Subtile * shiftedTile);
	void(__cdecl * TOEEdistBtwnLocAndOffs)(LocAndOffsets, LocAndOffsets); // outputs to the FPU (st0);is basically  sqrt(dx^2+dy^2) where a tile is sqrt(800)xsqrt(800);  I think it's in Inches because some functions divide this result by 12 (inches->feet)
	float (__cdecl * Distance3d)(LocAndOffsets loc1, LocAndOffsets loc2); // is basically  sqrt(dx^2+dy^2)*INCH_PER_TILE  [inch]
	float intToFloat(int32_t x);

	void ToTranslation(int x, int y, int &xOut, int &yOut);
	void TileToScreen(int x, int y, int &xOut, int &yOut);
	void GetScrollTranslation(int &xOut, int &yOut);

	// Distance between two objects in feet
	float DistanceToObj(objHndl from, objHndl to);
	float DistanceToObj_NonNegative(objHndl from, objHndl to); // as above but not less than 0.0

	// Distance between from and loc in inches (without the obj radius)
	float DistanceToLoc(objHndl from, LocAndOffsets loc);
	float DistanceToLocFeet(objHndl obj, LocAndOffsets *loc);
	float DistanceToLocFeet_NonNegative(objHndl obj, LocAndOffsets* loc);

	/*
		gets the higher tile delta value (absolute value)
		e.g. if deltaX = 15 and deltaY = -17 it will return 17
	*/
	int64_t (__cdecl*GetTileDeltaMax)(objHndl obj, objHndl obj2);
	int64_t GetTileDeltaMaxBtwnLocs(locXY loc1, locXY loc2);

	float InchesToFeet(float inches);

	int64_t *translationX;
	int64_t *translationY;

	LocAndOffsets TrimToLength(LocAndOffsets srcLoc, LocAndOffsets tgtLoc, float lengthInches);

	/*
	Calculates the angle in radians between two points in the tile coordinate system.
	The angle can be used to make an object that is at fromPoint face the location at toPoint.
	To convert to screen space rotation, which is defined as 0 when facing to the top of the screen and increasing ** clockwise **, do:
	rotation = -angle + 5*pi/4
	         = -angle - 2.3561945f
	*/
	float AngleBetweenPoints(LocAndOffsets &fromPoint, LocAndOffsets &toPoint);

	XMFLOAT2 GetDirectionVector(LocAndOffsets &fromPoint, LocAndOffsets &toPoint); // returns a normalized vector in the direction from -> to

	LocationSys();
};

float AngleBetweenPoints(LocAndOffsets fromPoint, LocAndOffsets toPoint);

bool operator!=(const LocAndOffsets& to, const LocAndOffsets& rhs);
bool operator==(const LocAndOffsets& to, const LocAndOffsets& rhs);

extern LocationSys locSys;


text: Please see [documentation](http://fathom.gitblit.com/rest).


text:
import React from 'react'
import ReactDOM from 'react-dom'
import { observable } from 'mobx'
import { observer } from 'mobx-react'
import DevTools from 'mobx-react-devtools'

import CSS from '../css/layout.sass'

@observer
export default class Layout extends React.Component {
  render() {
    return (
      <div id='layout' className={CSS.layout}>
        {this.props.children}
        {/*<DevTools />*/}
      </div>
    )
  }
}


text:
package org.apache.camel.builder.component.dsl;

import javax.annotation.Generated;
import org.apache.camel.Component;
import org.apache.camel.builder.component.AbstractComponentBuilder;
import org.apache.camel.builder.component.ComponentBuilder;
import org.apache.camel.component.aws2.msk.MSK2Component;

/**
 * Manage AWS MSK instances using AWS SDK version 2.x.
 *
 * Generated by camel-package-maven-plugin - do not edit this file!
 */
@Generated("org.apache.camel.maven.packaging.ComponentDslMojo")
public interface Aws2MskComponentBuilderFactory {

    /**
     * AWS 2 Managed Streaming for Apache Kafka (MSK) (camel-aws2-msk)
     * Manage AWS MSK instances using AWS SDK version 2.x.
     *
     * Category: cloud,management
     * Since: 3.1
     * Maven coordinates: org.apache.camel:camel-aws2-msk
     */
    static Aws2MskComponentBuilder aws2Msk() {
        return new Aws2MskComponentBuilderImpl();
    }

    /**
     * Builder for the AWS 2 Managed Streaming for Apache Kafka (MSK) component.
     */
    interface Aws2MskComponentBuilder extends ComponentBuilder<MSK2Component> {
        /**
         * Setting the autoDiscoverClient mechanism, if true, the component will
         * look for a client instance in the registry automatically otherwise it
         * will skip that checking.
         *
         * The option is a: boolean type.
         *
         * Default: true
         * Group: common
         */
        default Aws2MskComponentBuilder autoDiscoverClient(
                boolean autoDiscoverClient) {
            doSetProperty("autoDiscoverClient", autoDiscoverClient);
            return this;
        }
        /**
         * Component configuration.
         *
         * The option is a:
         * org.apache.camel.component.aws2.msk.MSK2Configuration
         * type.
         *
         * Group: producer
         */
        default Aws2MskComponentBuilder configuration(
                org.apache.camel.component.aws2.msk.MSK2Configuration configuration) {
            doSetProperty("configuration", configuration);
            return this;
        }
        /**
         * Whether the producer should be started lazy (on the first message).
         * By starting lazy you can use this to allow CamelContext and routes to
         * startup in situations where a producer may otherwise fail during
         * starting and cause the route to fail being started. By deferring this
         * startup to be lazy then the startup failure can be handled during
         * routing messages via Camel's routing error handlers. Beware that when
         * the first message is processed then creating and starting the
         * producer may take a little time and prolong the total processing time
         * of the processing.
         *
         * The option is a: boolean type.
         *
         * Default: false
         * Group: producer
         */
        default Aws2MskComponentBuilder lazyStartProducer(
                boolean lazyStartProducer) {
            doSetProperty("lazyStartProducer", lazyStartProducer);
            return this;
        }
        /**
         * To use a existing configured AWS MSK as client.
         *
         * The option is a:
         * software.amazon.awssdk.services.kafka.KafkaClient type.
         *
         * Group: producer
         */
        default Aws2MskComponentBuilder mskClient(
                software.amazon.awssdk.services.kafka.KafkaClient mskClient) {
            doSetProperty("mskClient", mskClient);
            return this;
        }
        /**
         * The operation to perform.
         *
         * The option is a:
         * org.apache.camel.component.aws2.msk.MSK2Operations type.
         *
         * Group: producer
         */
        default Aws2MskComponentBuilder operation(
                org.apache.camel.component.aws2.msk.MSK2Operations operation) {
            doSetProperty("operation", operation);
            return this;
        }
        /**
         * If we want to use a POJO request as body or not.
         *
         * The option is a: boolean type.
         *
         * Default: false
         * Group: producer
         */
        default Aws2MskComponentBuilder pojoRequest(boolean pojoRequest) {
            doSetProperty("pojoRequest", pojoRequest);
            return this;
        }
        /**
         * To define a proxy host when instantiating the MSK client.
         *
         * The option is a: java.lang.String type.
         *
         * Group: producer
         */
        default Aws2MskComponentBuilder proxyHost(java.lang.String proxyHost) {
            doSetProperty("proxyHost", proxyHost);
            return this;
        }
        /**
         * To define a proxy port when instantiating the MSK client.
         *
         * The option is a: java.lang.Integer type.
         *
         * Group: producer
         */
        default Aws2MskComponentBuilder proxyPort(java.lang.Integer proxyPort) {
            doSetProperty("proxyPort", proxyPort);
            return this;
        }
        /**
         * To define a proxy protocol when instantiating the MSK client.
         *
         * The option is a: software.amazon.awssdk.core.Protocol
         * type.
         *
         * Default: HTTPS
         * Group: producer
         */
        default Aws2MskComponentBuilder proxyProtocol(
                software.amazon.awssdk.core.Protocol proxyProtocol) {
            doSetProperty("proxyProtocol", proxyProtocol);
            return this;
        }
        /**
         * The region in which MSK client needs to work. When using this
         * parameter, the configuration will expect the lowercase name of the
         * region (for example ap-east-1) You'll need to use the name
         * Region.EU_WEST_1.id().
         *
         * The option is a: java.lang.String type.
         *
         * Group: producer
         */
        default Aws2MskComponentBuilder region(java.lang.String region) {
            doSetProperty("region", region);
            return this;
        }
        /**
         * If we want to trust all certificates in case of overriding the
         * endpoint.
         *
         * The option is a: boolean type.
         *
         * Default: false
         * Group: producer
         */
        default Aws2MskComponentBuilder trustAllCertificates(
                boolean trustAllCertificates) {
            doSetProperty("trustAllCertificates", trustAllCertificates);
            return this;
        }
        /**
         * Whether the component should use basic property binding (Camel 2.x)
         * or the newer property binding with additional capabilities.
         *
         * The option is a: boolean type.
         *
         * Default: false
         * Group: advanced
         */
        @Deprecated
        default Aws2MskComponentBuilder basicPropertyBinding(
                boolean basicPropertyBinding) {
            doSetProperty("basicPropertyBinding", basicPropertyBinding);
            return this;
        }
        /**
         * Amazon AWS Access Key.
         *
         * The option is a: java.lang.String type.
         *
         * Group: security
         */
        default Aws2MskComponentBuilder accessKey(java.lang.String accessKey) {
            doSetProperty("accessKey", accessKey);
            return this;
        }
        /**
         * Amazon AWS Secret Key.
         *
         * The option is a: java.lang.String type.
         *
         * Group: security
         */
        default Aws2MskComponentBuilder secretKey(java.lang.String secretKey) {
            doSetProperty("secretKey", secretKey);
            return this;
        }
    }

    class Aws2MskComponentBuilderImpl
            extends
                AbstractComponentBuilder<MSK2Component>
            implements
                Aws2MskComponentBuilder {
        @Override
        protected MSK2Component buildConcreteComponent() {
            return new MSK2Component();
        }
        private org.apache.camel.component.aws2.msk.MSK2Configuration getOrCreateConfiguration(
                org.apache.camel.component.aws2.msk.MSK2Component component) {
            if (component.getConfiguration() == null) {
                component.setConfiguration(new org.apache.camel.component.aws2.msk.MSK2Configuration());
            }
            return component.getConfiguration();
        }
        @Override
        protected boolean setPropertyOnComponent(
                Component component,
                String name,
                Object value) {
            switch (name) {
            case "autoDiscoverClient": getOrCreateConfiguration((MSK2Component) component).setAutoDiscoverClient((boolean) value); return true;
            case "configuration": ((MSK2Component) component).setConfiguration((org.apache.camel.component.aws2.msk.MSK2Configuration) value); return true;
            case "lazyStartProducer": ((MSK2Component) component).setLazyStartProducer((boolean) value); return true;
            case "mskClient": getOrCreateConfiguration((MSK2Component) component).setMskClient((software.amazon.awssdk.services.kafka.KafkaClient) value); return true;
            case "operation": getOrCreateConfiguration((MSK2Component) component).setOperation((org.apache.camel.component.aws2.msk.MSK2Operations) value); return true;
            case "pojoRequest": getOrCreateConfiguration((MSK2Component) component).setPojoRequest((boolean) value); return true;
            case "proxyHost": getOrCreateConfiguration((MSK2Component) component).setProxyHost((java.lang.String) value); return true;
            case "proxyPort": getOrCreateConfiguration((MSK2Component) component).setProxyPort((java.lang.Integer) value); return true;
            case "proxyProtocol": getOrCreateConfiguration((MSK2Component) component).setProxyProtocol((software.amazon.awssdk.core.Protocol) value); return true;
            case "region": getOrCreateConfiguration((MSK2Component) component).setRegion((java.lang.String) value); return true;
            case "trustAllCertificates": getOrCreateConfiguration((MSK2Component) component).setTrustAllCertificates((boolean) value); return true;
            case "basicPropertyBinding": ((MSK2Component) component).setBasicPropertyBinding((boolean) value); return true;
            case "accessKey": getOrCreateConfiguration((MSK2Component) component).setAccessKey((java.lang.String) value); return true;
            case "secretKey": getOrCreateConfiguration((MSK2Component) component).setSecretKey((java.lang.String) value); return true;
            default: return false;
            }
        }
    }
}


text:
module Spree
  module TestingSupport
    module CheckoutHelpers
      def fill_in_address
        address = 'order_bill_address_attributes'
        fill_in "#{address}_firstname", with: 'Ryan'
        fill_in "#{address}_lastname", with: 'Bigg'
        fill_in "#{address}_address1", with: '143 Swan Street'
        fill_in "#{address}_city", with: 'Richmond'
        select country.name, from: "#{address}_country_id"
        select state.name, from: "#{address}_state_id"
        fill_in "#{address}_zipcode", with: '12345'
        fill_in "#{address}_phone", with: '(555) 555-5555'
      end

      def fill_in_credit_card_info(invalid: false)
        fill_in 'name_on_card', with: 'Spree Commerce'
        fill_in 'card_number', with: invalid ? '123' : '4111 1111 1111 1111'
        fill_in 'card_expiry', with: '12 / 24'
        fill_in 'card_code', with: '123'
      end
    end
  end
end


text:
package org.smoothbuild.util.function;

@FunctionalInterface
public interface ThrowingFunction<T, R, E extends Throwable> {
  public R apply(T t) throws E;
}


text:
/// <reference path="../../../../tsd_typings/tsd.d.ts"/>

import {normalize, normalizers, defaultFreezeStyles} from '../../src/server/normalize';

describe('normalize', function () {

  describe('pauseEvent()', function () {
    it('should verify default', function () {
      let opts = { pauseEvent: '' };
      normalizers.pauseEvent(opts);
      expect(opts.pauseEvent).toBe('PrebootPause');
    });

    it('should set value', function () {
      let opts = { pauseEvent: 'BlahEvt' };
      normalizers.pauseEvent(opts);
      expect(opts.pauseEvent).toBe('BlahEvt');
    });
  });

  describe('resumeEvent()', function () {
    it('should verify default', function () {
      let opts = { resumeEvent: '' };
      normalizers.resumeEvent(opts);
      expect(opts.resumeEvent).toBe('PrebootResume');
    });

    it('should set value', function () {
      let opts = { resumeEvent: 'foo' };
      normalizers.resumeEvent(opts);
      expect(opts.resumeEvent).toBe('foo');
    });
  });

  describe('listen()', function () {
    it('should verify default', function () {
      let opts = { listen: null };
      normalizers.listen(opts);
      expect(opts.listen).toEqual([]);
    });

    it('should throw an error if string not valid listen strategy', function () {
      let opts = { listen: 'blah' };
      let fn = () => normalizers.listen(opts);
      expect(fn).toThrowError('Invalid listen strategy: blah');
    });

    it('should convert string to array', function () {
      let opts = { listen: 'event_bindings' };
      normalizers.listen(opts);
      expect(opts.listen).toEqual([{ name: 'event_bindings' }]);
    });

    it('should throw error if no name or getNodeEvents', function () {
      let listen = { foo: 'zoo' };
      let opts = { listen: listen };
      let fn = () => normalizers.listen(opts);
      expect(fn).toThrowError('Every listen strategy must either have a valid name or implement getNodeEvents()');
    });

    /* tslint:disable:no-empty */
    it('should convert object to array with getNodeEvents impl', function () {
      let listen = { foo: 'blue', getNodeEvents: function () {} };
      let opts = { listen: listen };
      normalizers.listen(opts);
      expect(opts.listen).toEqual([listen]);
    });

    it('should throw error if invalid name', function () {
      let listen = [{ name: 'asdfsd', foo: 'shoo' }];
      let opts = { listen: listen };
      let fn = () => normalizers.listen(opts);
      expect(fn).toThrowError('Invalid listen strategy: ' + 'asdfsd');
    });

    it('should use array if valid', function () {
      let listen = [
          { name: 'event_bindings', foo: 'shoo' },
          { getNodeEvents: function () {}, foo: 'sdfsd' }
      ];
      let opts = { listen: listen };
      normalizers.listen(opts);
      expect(opts.listen).toEqual(listen);
    });
  });

  describe('replay()', function () {
    it('should verify default', function () {
      let opts = { replay: null };
      normalizers.replay(opts);
      expect(opts.replay).toEqual([]);
    });

    it('should throw an error if string not valid replay strategy', function () {
      let opts = { replay: 'blah' };
      let fn = () => normalizers.replay(opts);
      expect(fn).toThrowError('Invalid replay strategy: blah');
    });

    it('should convert string to array', function () {
      let opts = { replay: 'rerender' };
      normalizers.replay(opts);
      expect(opts.replay).toEqual([{ name: 'rerender' }]);
    });

    it('should throw error if no name or replayEvents', function () {
      let replay = { foo: 'zoo' };
      let opts = { replay: replay };
      let fn = () => normalizers.replay(opts);
      expect(fn).toThrowError('Every replay strategy must either have a valid name or implement replayEvents()');
    });

    it('should convert object to array with replayEvents impl', function () {
      let replay = { foo: 'blue', replayEvents: function () {} };
      let opts = { replay: replay };
      normalizers.replay(opts);
      expect(opts.replay).toEqual([replay]);
    });

    it('should throw error if invalid name', function () {
      let replay = [{ name: 'asdfsd', foo: 'shoo' }];
      let opts = { replay: replay };
      let fn = () => normalizers.replay(opts);
      expect(fn).toThrowError('Invalid replay strategy: ' + 'asdfsd');
    });

    it('should use array if valid', function () {
      let replay = [
        { name: 'hydrate', foo: 'shoo' },
        { replayEvents: function () {}, foo: 'sdfsd' }
      ];
      let opts = { replay: replay };
      normalizers.replay(opts);
      expect(opts.replay).toEqual(replay);
    });
});

describe('freeze()', function () {
    it('should do nothing if no freeze option', function () {
      let opts = {};
      normalizers.freeze(opts);
      expect(opts).toEqual({});
    });

    it('should throw error if invalid freeze strategy', function () {
      let opts = { freeze: 'asdf' };
      let fn = () => normalizers.freeze(opts);
      expect(fn).toThrowError('Invalid freeze option: asdf');
    });

    it('should throw error if no string and no prep and cleanup', function () {
      let opts = { freeze: {} };
      let fn = () => normalizers.freeze(opts);
      expect(fn).toThrowError('Freeze must have name or prep and cleanup functions');
    });

    it('should have default styles if valid freeze', function () {
      let opts = { freeze: { name: 'spinner', styles: {} } };
      normalizers.freeze(opts);
      expect(opts.freeze.styles).toEqual(defaultFreezeStyles);
    });

    it('should override default styles', function () {
      let freezeStyleOverrides = {
        overlay: { className: 'foo' },
        spinner: { className: 'zoo' }
      };
      let opts = { freeze: { name: 'spinner', styles: freezeStyleOverrides } };
      normalizers.freeze(opts);
      expect(opts.freeze.styles.overlay.className).toEqual(freezeStyleOverrides.overlay.className);
      expect(opts.freeze.styles.spinner.className).toEqual(defaultFreezeStyles.spinner.className);
    });
  });

  describe('presets()', function () {
    it('should do nothing if no presets option', function () {
      let opts = {};
      normalizers.presets(opts);
      expect(opts).toEqual({});
    });

    it('should throw error if presets not an array', function () {
      let opts = { presets: 'asdf' };
      let fn = () => normalizers.presets(opts);
      expect(fn).toThrowError('presets must be an array of strings');
    });

    it('should throw error if presets not an array', function () {
      let opts = { presets: [{}] };
      let fn = () => normalizers.presets(opts);
      expect(fn).toThrowError('presets must be an array of strings');
    });

    it('should throw error if invalid preset value', function () {
      let opts = { presets: ['asdfsd'] };
      let fn = () => normalizers.presets(opts);
      expect(fn).toThrowError('Invalid preset: asdfsd');
    });
  });

  describe('normalize()', function () {
    it('should throw error if not listening for events', function () {
      let opts = {};
      let fn = () => normalize(opts);
      expect(fn).toThrowError('Not listening for any events. Preboot not going to do anything.');
    });
  });
});


text:
"use strict";

/**
 * Returns an object which has better optimized `forEach()`, `map()`, and `filter()` methods.
 *
 * This library builds optimized versions for "standard" array methods. It is developed for Node.js
 * (Google v8 engine), although the resulting code will work on any JavaScript implementation.
 *
 * @param a {array} The array to operate.
 */
module.exports = function nor_array_prototype(a_) {
	var a = a_;

	/** The type of our method container */
	function ArrayUtils() {
	}

	/** The forEach implementation
	 * Our implementation does not have implementation for `thisArg` because it would affect the performance and you can always use `o.f.bind(o)`.
	 * @param c {function} The callback which will be executed for each element in the array
	 */
	ArrayUtils.prototype.forEach = function forEach(c) {
		var i = 0, l = a.length;
		/*jshint plusplus:false, curly:false */
		while(i < l) c(a[i], i++, a);
		return this;
	};

	// Export it
	return new ArrayUtils();
};

/* EOF */


text:
package org.deeplearning4j.nn.conf;

import org.deeplearning4j.nn.api.Layer;
import org.deeplearning4j.nn.api.OptimizationAlgorithm;
import org.deeplearning4j.nn.conf.distribution.NormalDistribution;
import org.deeplearning4j.nn.conf.inputs.InputType;
import org.deeplearning4j.nn.conf.layers.*;
import org.deeplearning4j.nn.conf.preprocessor.CnnToFeedForwardPreProcessor;
import org.deeplearning4j.nn.multilayer.MultiLayerNetwork;
import org.deeplearning4j.nn.weights.WeightInit;
import org.deeplearning4j.optimize.api.IterationListener;
import org.deeplearning4j.optimize.listeners.ScoreIterationListener;
import org.junit.Test;
import org.nd4j.linalg.activations.Activation;
import org.nd4j.linalg.factory.Nd4j;
import org.nd4j.linalg.lossfunctions.LossFunctions;

import java.io.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.Properties;

import static org.junit.Assert.*;

/**
 * Created by agibsonccc on 11/27/14.
 */
public class MultiLayerNeuralNetConfigurationTest {

    @Test
    public void testJson() throws Exception {
        MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().list()
                        .layer(0, new RBM.Builder().dist(new NormalDistribution(1, 1e-1)).build())
                        .inputPreProcessor(0, new CnnToFeedForwardPreProcessor()).build();

        String json = conf.toJson();
        MultiLayerConfiguration from = MultiLayerConfiguration.fromJson(json);
        assertEquals(conf.getConf(0), from.getConf(0));

        Properties props = new Properties();
        props.put("json", json);
        String key = props.getProperty("json");
        assertEquals(json, key);
        File f = new File("props");
        f.deleteOnExit();
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(f));
        props.store(bos, "");
        bos.flush();
        bos.close();
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream(f));
        Properties props2 = new Properties();
        props2.load(bis);
        bis.close();
        assertEquals(props2.getProperty("json"), props.getProperty("json"));
        String json2 = props2.getProperty("json");
        MultiLayerConfiguration conf3 = MultiLayerConfiguration.fromJson(json2);
        assertEquals(conf.getConf(0), conf3.getConf(0));

    }

    @Test
    public void testConvnetJson() {
        final int numRows = 76;
        final int numColumns = 76;
        int nChannels = 3;
        int outputNum = 6;
        int iterations = 10;
        int seed = 123;

        //setup the network
        MultiLayerConfiguration.Builder builder = new NeuralNetConfiguration.Builder().seed(seed).iterations(iterations)
                        .regularization(true).l1(1e-1).l2(2e-4).useDropConnect(true).dropOut(0.5).miniBatch(true)
                        .optimizationAlgo(OptimizationAlgorithm.CONJUGATE_GRADIENT).list()
                        .layer(0, new ConvolutionLayer.Builder(5, 5).nOut(5).dropOut(0.5).weightInit(WeightInit.XAVIER)
                                        .activation(Activation.RELU).build())
                        .layer(1, new SubsamplingLayer.Builder(SubsamplingLayer.PoolingType.MAX, new int[] {2, 2})
                                        .build())
                        .layer(2, new ConvolutionLayer.Builder(3, 3).nOut(10).dropOut(0.5).weightInit(WeightInit.XAVIER)
                                        .activation(Activation.RELU).build())
                        .layer(3, new SubsamplingLayer.Builder(SubsamplingLayer.PoolingType.MAX, new int[] {2, 2})
                                        .build())
                        .layer(4, new DenseLayer.Builder().nOut(100).activation(Activation.RELU).build())
                        .layer(5, new OutputLayer.Builder(LossFunctions.LossFunction.NEGATIVELOGLIKELIHOOD)
                                        .nOut(outputNum).weightInit(WeightInit.XAVIER).activation(Activation.SOFTMAX)
                                        .build())
                        .backprop(true).pretrain(false)
                        .setInputType(InputType.convolutional(numRows, numColumns, nChannels));

        MultiLayerConfiguration conf = builder.build();
        String json = conf.toJson();
        MultiLayerConfiguration conf2 = MultiLayerConfiguration.fromJson(json);
        assertEquals(conf, conf2);
    }

    @Test
    public void testGlobalPoolingJson() {
        MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().regularization(false).updater(Updater.NONE)
                        .weightInit(WeightInit.DISTRIBUTION).dist(new NormalDistribution(0, 1.0)).seed(12345L).list()
                        .layer(0, new ConvolutionLayer.Builder().kernelSize(2, 2).stride(1, 1).nOut(5).build())
                        .layer(1, new GlobalPoolingLayer.Builder().poolingType(PoolingType.PNORM).pnorm(3).build())
                        .layer(2, new OutputLayer.Builder(LossFunctions.LossFunction.MCXENT)
                                        .activation(Activation.SOFTMAX).nOut(3).build())
                        .pretrain(false).backprop(true).setInputType(InputType.convolutional(32, 32, 1)).build();

        String str = conf.toJson();
        MultiLayerConfiguration fromJson = conf.fromJson(str);

        assertEquals(conf, fromJson);
    }

    @Test
    public void testYaml() throws Exception {
        MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().list()
                        .layer(0, new RBM.Builder().dist(new NormalDistribution(1, 1e-1)).build())
                        .inputPreProcessor(0, new CnnToFeedForwardPreProcessor()).build();
        String json = conf.toYaml();
        MultiLayerConfiguration from = MultiLayerConfiguration.fromYaml(json);
        assertEquals(conf.getConf(0), from.getConf(0));

        Properties props = new Properties();
        props.put("json", json);
        String key = props.getProperty("json");
        assertEquals(json, key);
        File f = new File("props");
        f.deleteOnExit();
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(f));
        props.store(bos, "");
        bos.flush();
        bos.close();
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream(f));
        Properties props2 = new Properties();
        props2.load(bis);
        bis.close();
        assertEquals(props2.getProperty("json"), props.getProperty("json"));
        String yaml = props2.getProperty("json");
        MultiLayerConfiguration conf3 = MultiLayerConfiguration.fromYaml(yaml);
        assertEquals(conf.getConf(0), conf3.getConf(0));

    }

    @Test
    public void testClone() {
        MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().list().layer(0, new RBM.Builder().build())
                        .layer(1, new OutputLayer.Builder().build())
                        .inputPreProcessor(1, new CnnToFeedForwardPreProcessor()).build();

        MultiLayerConfiguration conf2 = conf.clone();

        assertEquals(conf, conf2);
        assertNotSame(conf, conf2);
        assertNotSame(conf.getConfs(), conf2.getConfs());
        for (int i = 0; i < conf.getConfs().size(); i++) {
            assertNotSame(conf.getConf(i), conf2.getConf(i));
        }
        assertNotSame(conf.getInputPreProcessors(), conf2.getInputPreProcessors());
        for (Integer layer : conf.getInputPreProcessors().keySet()) {
            assertNotSame(conf.getInputPreProcess(layer), conf2.getInputPreProcess(layer));
        }
    }

    @Test
    public void testRandomWeightInit() {
        MultiLayerNetwork model1 = new MultiLayerNetwork(getConf());
        model1.init();

        Nd4j.getRandom().setSeed(12345L);
        MultiLayerNetwork model2 = new MultiLayerNetwork(getConf());
        model2.init();

        float[] p1 = model1.params().data().asFloat();
        float[] p2 = model2.params().data().asFloat();
        System.out.println(Arrays.toString(p1));
        System.out.println(Arrays.toString(p2));

        org.junit.Assert.assertArrayEquals(p1, p2, 0.0f);
    }

    @Test
    public void testIterationListener() {
        MultiLayerNetwork model1 = new MultiLayerNetwork(getConf());
        model1.init();
        model1.setListeners(Collections.singletonList((IterationListener) new ScoreIterationListener(1)));

        MultiLayerNetwork model2 = new MultiLayerNetwork(getConf());
        model2.setListeners(Collections.singletonList((IterationListener) new ScoreIterationListener(1)));
        model2.init();

        Layer[] l1 = model1.getLayers();
        for (int i = 0; i < l1.length; i++)
            assertTrue(l1[i].getListeners() != null && l1[i].getListeners().size() == 1);

        Layer[] l2 = model2.getLayers();
        for (int i = 0; i < l2.length; i++)
            assertTrue(l2[i].getListeners() != null && l2[i].getListeners().size() == 1);
    }

    private static MultiLayerConfiguration getConf() {
        MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().seed(12345l).list()
                        .layer(0, new RBM.Builder().nIn(2).nOut(2).weightInit(WeightInit.DISTRIBUTION)
                                        .dist(new NormalDistribution(0, 1)).build())
                        .layer(1, new OutputLayer.Builder().nIn(2).nOut(1).weightInit(WeightInit.DISTRIBUTION)
                                        .dist(new NormalDistribution(0, 1)).build())
                        .build();
        return conf;
    }

    @Test
    public void testInvalidConfig() {

        try {
            MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().seed(12345).list().pretrain(false)
                            .backprop(true).build();
            MultiLayerNetwork net = new MultiLayerNetwork(conf);
            net.init();
            fail("No exception thrown for invalid configuration");
        } catch (IllegalStateException e) {
            //OK
            e.printStackTrace();
        } catch (Throwable e) {
            e.printStackTrace();
            fail("Unexpected exception thrown for invalid config");
        }

        try {
            MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().seed(12345).list()
                            .layer(1, new DenseLayer.Builder().nIn(3).nOut(4).build())
                            .layer(2, new OutputLayer.Builder().nIn(4).nOut(5).build()).pretrain(false).backprop(true)
                            .build();
            MultiLayerNetwork net = new MultiLayerNetwork(conf);
            net.init();
            fail("No exception thrown for invalid configuration");
        } catch (IllegalStateException e) {
            //OK
            e.printStackTrace();
        } catch (Throwable e) {
            e.printStackTrace();
            fail("Unexpected exception thrown for invalid config");
        }

        try {
            MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().seed(12345).list()
                            .layer(0, new DenseLayer.Builder().nIn(3).nOut(4).build())
                            .layer(2, new OutputLayer.Builder().nIn(4).nOut(5).build()).pretrain(false).backprop(true)
                            .build();
            MultiLayerNetwork net = new MultiLayerNetwork(conf);
            net.init();
            fail("No exception thrown for invalid configuration");
        } catch (IllegalStateException e) {
            //OK
            e.printStackTrace();
        } catch (Throwable e) {
            e.printStackTrace();
            fail("Unexpected exception thrown for invalid config");
        }
    }

    @Test
    public void testListOverloads() {

        MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().seed(12345).list()
                        .layer(0, new DenseLayer.Builder().nIn(3).nOut(4).build())
                        .layer(1, new OutputLayer.Builder().nIn(4).nOut(5).build()).pretrain(false).backprop(true)
                        .build();
        MultiLayerNetwork net = new MultiLayerNetwork(conf);
        net.init();

        DenseLayer dl = (DenseLayer) conf.getConf(0).getLayer();
        assertEquals(3, dl.getNIn());
        assertEquals(4, dl.getNOut());
        OutputLayer ol = (OutputLayer) conf.getConf(1).getLayer();
        assertEquals(4, ol.getNIn());
        assertEquals(5, ol.getNOut());

        MultiLayerConfiguration conf2 = new NeuralNetConfiguration.Builder().seed(12345).list()
                        .layer(0, new DenseLayer.Builder().nIn(3).nOut(4).build())
                        .layer(1, new OutputLayer.Builder().nIn(4).nOut(5).build()).pretrain(false).backprop(true)
                        .build();
        MultiLayerNetwork net2 = new MultiLayerNetwork(conf2);
        net2.init();

        MultiLayerConfiguration conf3 = new NeuralNetConfiguration.Builder().seed(12345)
                        .list(new DenseLayer.Builder().nIn(3).nOut(4).build(),
                                        new OutputLayer.Builder().nIn(4).nOut(5).build())
                        .pretrain(false).backprop(true).build();
        MultiLayerNetwork net3 = new MultiLayerNetwork(conf3);
        net3.init();

        assertEquals(conf, conf2);
        assertEquals(conf, conf3);
    }

    @Test
    public void testPreBackFineValidation() {
        MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().list()
                        .layer(0, new DenseLayer.Builder().nIn(2).nOut(2).build())
                        .layer(1, new DenseLayer.Builder().nIn(2).nOut(2).build()).build();

        assertFalse(conf.isPretrain());
        assertTrue(conf.isBackprop());

        conf = new NeuralNetConfiguration.Builder().list().layer(0, new DenseLayer.Builder().nIn(2).nOut(2).build())
                        .layer(1, new DenseLayer.Builder().nIn(2).nOut(2).build()).pretrain(true).backprop(false)
                        .build();

        assertTrue(conf.isPretrain());
        assertFalse(conf.isBackprop());
    }

    @Test
    public void testBiasLr() {
        //setup the network
        MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().seed(12345).learningRate(1e-2)
                        .biasLearningRate(0.5).updater(Updater.ADAM).list()
                        .layer(0, new ConvolutionLayer.Builder(5, 5).nOut(5).weightInit(WeightInit.XAVIER)
                                        .activation(Activation.RELU).build())
                        .layer(1, new DenseLayer.Builder().nOut(100).activation(Activation.RELU).build())
                        .layer(2, new DenseLayer.Builder().nOut(100).activation(Activation.RELU).biasLearningRate(0.25)
                                        .build())
                        .layer(3, new OutputLayer.Builder(LossFunctions.LossFunction.NEGATIVELOGLIKELIHOOD).nOut(10)
                                        .weightInit(WeightInit.XAVIER).activation(Activation.SOFTMAX).build())
                        .setInputType(InputType.convolutional(28, 28, 1)).build();

        org.deeplearning4j.nn.conf.layers.BaseLayer l0 = (BaseLayer) conf.getConf(0).getLayer();
        org.deeplearning4j.nn.conf.layers.BaseLayer l1 = (BaseLayer) conf.getConf(1).getLayer();
        org.deeplearning4j.nn.conf.layers.BaseLayer l2 = (BaseLayer) conf.getConf(2).getLayer();
        org.deeplearning4j.nn.conf.layers.BaseLayer l3 = (BaseLayer) conf.getConf(3).getLayer();

        assertEquals(0.5, l0.getBiasLearningRate(), 1e-6);
        assertEquals(1e-2, l0.getLearningRate(), 1e-6);

        assertEquals(0.5, l1.getBiasLearningRate(), 1e-6);
        assertEquals(1e-2, l1.getLearningRate(), 1e-6);

        assertEquals(0.25, l2.getBiasLearningRate(), 1e-6);
        assertEquals(1e-2, l2.getLearningRate(), 1e-6);

        assertEquals(0.5, l3.getBiasLearningRate(), 1e-6);
        assertEquals(1e-2, l3.getLearningRate(), 1e-6);
    }

}


text:
package in.adityaanand.websitecompressor;

import javax.swing.*;

public class CompressionResultDialog extends JDialog {
    private JPanel contentPane;
    private JButton buttonOK;
    private JButton buttonOpen;
    private JLabel percentageSizeReductionLabel;
    private JLabel HTMLLabel;
    private JLabel totalBuildSizeLabel;
    private JLabel totalInputSizeLabel;
    private JLabel JSLabel;
    private JLabel CSSLabel;

    public CompressionResultDialog() {
        setContentPane(contentPane);
        setModal(true);
        getRootPane().setDefaultButton(buttonOK);
        setLabels();
        buttonOK.addActionListener(e -> dispose());
        buttonOpen.addActionListener(e -> onCancel());
        pack();
        setLocationRelativeTo(null);
        setVisible(true);
    }

    private void onCancel() {
        Utils.openFolder(CompressionResult.buildPath);
        dispose();
    }

    void setLabels() {
        CSSLabel.setText(CSSLabel.getText() + CompressionResult.css);
        HTMLLabel.setText(HTMLLabel.getText() + CompressionResult.html);
        JSLabel.setText(JSLabel.getText() + CompressionResult.js);
        totalInputSizeLabel.setText(totalInputSizeLabel.getText() + CompressionResult.totalOriginalSize);
        totalBuildSizeLabel.setText(totalBuildSizeLabel.getText() + CompressionResult.totalCompressedSize);
        float percentageReduction = CompressionResult.totalCompressedSize / CompressionResult.totalOriginalSize * 100;
        percentageReduction = 100 - percentageReduction;
        percentageReduction -= percentageReduction % 0.01f; //round off to two decimals
        percentageSizeReductionLabel.setText(percentageSizeReductionLabel.getText() + percentageReduction + '%');
    }
}


text:
import Cookie from './adapters/cookie';
import LocalMemory from './adapters/local-memory';
import LocalStorage from './adapters/local-storage';
import SessionStorage from './adapters/session-storage';

export default {
  cookie: Cookie,
  'local-memory': LocalMemory,
  'local-storage': LocalStorage,
  'session-storage': SessionStorage,
};


text:
package io.mstream.trader.datafeed.handlers.api.stocks.price.data;

import org.joda.money.Money;

import javax.inject.Inject;
import java.text.DecimalFormat;
import java.util.function.Function;

public class StockPriceConverter
        implements Function<Money, StockPrice> {

    private final DecimalFormat decimalFormat;
    private final StockPriceFactory stockPriceFactory;

    @Inject
    public StockPriceConverter(DecimalFormat decimalFormat,
                               StockPriceFactory stockPriceFactory) {
        this.decimalFormat = decimalFormat;
        this.stockPriceFactory = stockPriceFactory;
    }

    @Override
    public StockPrice apply(Money money) {
        double doubleValue = money.getAmount().doubleValue();
        String valueString = decimalFormat.format(doubleValue);
        return stockPriceFactory.create(valueString);
    }
}


text:
"""A collection of gym wrappers."""

from representation_batch_rl.gym.wrappers.absorbing_wrapper import AbsorbingWrapper
from representation_batch_rl.gym.wrappers.frame_stack_wrapper import FrameStackWrapper
from representation_batch_rl.gym.wrappers.frame_stack_wrapper import stack_expert_frames
from representation_batch_rl.gym.wrappers.normalize_action_wrapper import check_and_normalize_box_actions
from representation_batch_rl.gym.wrappers.normalize_action_wrapper import NormalizeBoxActionWrapper
from representation_batch_rl.gym.wrappers.normalize_state_wrapper import NormalizeStateWrapper
from representation_batch_rl.gym.wrappers.stochastic_wrappers import maybe_make_stochastic

def create_il_env(env_name, num_stack_frames, seed, shift, scale):
  """Create a gym environment for imitation learning.

  Args:
    env_name: an environment name.
    num_stack_frames: a number of consequtive observations to stack.
    seed: a random seed.
    shift: a numpy vector to shift observations.
    scale: a numpy vector to scale observations.

  Returns:
    An initialized gym environment.
  """
  env = maybe_make_stochastic(env_name)
  env = check_and_normalize_box_actions(env)
  env.seed(seed)

  if num_stack_frames != 1:
    env = FrameStackWrapper(env, num_stack_frames)

  if shift is not None:
    env = NormalizeStateWrapper(env, shift=shift, scale=scale)

  return AbsorbingWrapper(env)


text:
package log

import (
	_ "io/ioutil"
	"log"
	"os"
)

var (
	Trace   *log.Logger
	Info    *log.Logger
	Warning *log.Logger
	Error   *log.Logger
)

func init() {
	//traceHandle := ioutil.Discard
	traceHandle := os.Stdout
	infoHandle := os.Stdout
	warningHandle := os.Stdout
	errorHandle := os.Stderr

	Trace = log.New(traceHandle, "TRACE:   ", log.Ldate|log.Ltime|log.Lshortfile)
	Info = log.New(infoHandle, "INFO:    ", log.Ldate|log.Ltime|log.Lshortfile)
	Warning = log.New(warningHandle, "WARNING: ", log.Ldate|log.Ltime|log.Lshortfile)
	Error = log.New(errorHandle, "ERROR:   ", log.Ldate|log.Ltime|log.Lshortfile)
}


text:
package org.kuali.kra.protocol;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.kuali.coeus.common.framework.org.Organization;
import org.kuali.coeus.common.framework.person.KcPersonService;
import org.kuali.coeus.common.framework.rolodex.Rolodex;
import org.kuali.coeus.common.framework.unit.Unit;
import org.kuali.coeus.sys.framework.auth.perm.KcAuthorizationService;
import org.kuali.coeus.sys.framework.auth.task.TaskAuthorizationService;
import org.kuali.kra.infrastructure.KeyConstants;
import org.kuali.kra.infrastructure.PermissionConstants;
import org.kuali.kra.irb.ResearchArea;
import org.kuali.kra.lookup.KraLookupableHelperServiceImpl;
import org.kuali.kra.protocol.auth.ProtocolTaskBase;
import org.kuali.kra.protocol.personnel.ProtocolPersonBase;
import org.kuali.rice.core.api.CoreApiServiceLocator;
import org.kuali.rice.kew.api.KewApiConstants;
import org.kuali.rice.kew.api.exception.WorkflowException;
import org.kuali.rice.kns.lookup.HtmlData;
import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
import org.kuali.rice.kns.lookup.LookupUtils;
import org.kuali.rice.kns.service.DictionaryValidationService;
import org.kuali.rice.kns.service.KNSServiceLocator;
import org.kuali.rice.kns.web.ui.Field;
import org.kuali.rice.kns.web.ui.Row;
import org.kuali.rice.krad.bo.BusinessObject;
import org.kuali.rice.krad.lookup.CollectionIncomplete;
import org.kuali.rice.krad.service.DocumentService;
import org.kuali.rice.krad.util.GlobalVariables;
import org.kuali.rice.krad.util.KRADConstants;
import org.kuali.rice.krad.util.UrlFactory;

import java.text.ParseException;
import java.util.*;

/**
 * This class handles searching for protocols.
 */
public abstract class ProtocolLookupableHelperServiceImplBase<GenericProtocol extends ProtocolBase> extends KraLookupableHelperServiceImpl {

    private static final long serialVersionUID = 273532318463507554L;
    protected static final String AMEND_RENEW_PROTOCOL_LOOKUP_ACTION = "lookupActionAmendRenewProtocol";
    protected static final String REQUEST_PROTOCOL_ACTION = "lookupActionRequestProtocol";
    protected static final String PENDING_PROTOCOL_LOOKUP = "lookupPendingProtocol";
    protected static final String PENDING_PI_ACTION_PROTOCOL_LOOKUP = "lookupPendingPIActionProtocol";
    protected static final String PROTOCOL_PERSON_ID_LOOKUP = "lookupProtocolPersonId";

    private static final String PROTOCOL_LOOKUP_KEY_FIELD = "protocolNumber";

    private static final String RESEARCH_AREA_CLASS_PATH = ResearchArea.class.getName();
    private static final String ORGANIZATION_CLASS_PATH = Organization.class.getName();

    private static final Log LOG = LogFactory.getLog(ProtocolLookupableHelperServiceImplBase.class);

    private DictionaryValidationService dictionaryValidationService;

    protected KcPersonService kcPersonService;
    protected KcAuthorizationService kraAuthorizationService;
    protected TaskAuthorizationService taskAuthorizationService;
    protected DocumentService documentService;

    @Override
    public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) {
        validateSearchParameters(fieldValues);
        // need to set backlocation & docformkey here. Otherwise, they are empty
        super.setBackLocationDocFormKey(fieldValues);
        return getSearchResultsFilteredByTask(fieldValues); //filterProtocols(fieldValues);
    }

    /**
     * Filters the unbounded list of protocols by the given field values and protocol tasks.
     * @param fieldValues the field values that form a normal protocol search
     * @param taskNames the list of protocol tasks that the user must be able to perform in a protocol in order for it to be in the search results
     * @return a list of all protocols filtered by the given field values and being able to perform tasks in the taskNames
     */
    protected List<? extends BusinessObject> filterProtocolsByTask(Map<String, String> fieldValues, String... taskNames) {
        List<GenericProtocol> filteredProtocols = new ArrayList<GenericProtocol>();

        for (GenericProtocol protocol : (List<GenericProtocol>)getProtocolDaoHook().getProtocols(filterFieldValues(fieldValues))) {
            for (String taskName : taskNames) {
                ProtocolTaskBase task = createNewProtocolTaskInstanceHook(taskName, protocol);
                if (taskAuthorizationService.isAuthorized(getUserIdentifier(), task)) {
                    filteredProtocols.add(protocol);
                    break;
                }
            }
        }

        return getPagedResults(filteredProtocols);
    }

    protected abstract ProtocolTaskBase createNewProtocolTaskInstanceHook(String taskName, ProtocolBase protocol);

    /**
     * Filters the unbounded list of protocols by the given field values and protocol status codes.
     * @param fieldValues the field values that form a normal protocol search
     * @param protocolStatusCodes the list of protocol status codes that should be included in the search result
     * @return a list of all protocols filtered by the given field values and having statuses in protocolStatusCodes
     */
    protected List<? extends BusinessObject> filterProtocolsByStatus(Map<String, String> fieldValues, String... protocolStatusCodes) {
        List<GenericProtocol> filteredProtocols = new ArrayList<GenericProtocol>();

        List<String> protocolStatusCodeList = Arrays.asList(protocolStatusCodes);
        for (GenericProtocol protocol : (List<GenericProtocol>)getProtocolDaoHook().getProtocols(filterFieldValues(fieldValues))) {
            String statusCode = protocol.getProtocolStatusCode();
            if (protocolStatusCodeList.contains(statusCode)) {
                filteredProtocols.add(protocol);
            }
        }

        return getPagedResults(filteredProtocols);
    }

    /**
     * Filters the unbounded list of protocols by the given field values and whether the given principalId represents a protocol initiator or PI.
     * @param fieldValues the field values that form a normal protocol search
     * @param personKey the key in the fieldValues that maps to the principalId
     * @return a list of all protocols filtered by the given field values and whether the given principalId represents a protocol initiator or PI
     */
    protected List<? extends BusinessObject> filterProtocolsByPrincipal(Map<String, String> fieldValues, String principalKey) {
        List<GenericProtocol> filteredProtocols = new ArrayList<GenericProtocol>();

        String principalId = fieldValues.get(principalKey);
        for (GenericProtocol protocol : (List<GenericProtocol>)getProtocolDaoHook().getProtocols(filterFieldValues(fieldValues))) {
            try {
                String principalInvestigatorId = protocol.getPrincipalInvestigator().getPersonId();
                ProtocolDocumentBase document = (ProtocolDocumentBase) documentService.getByDocumentHeaderId(protocol.getProtocolDocument().getDocumentNumber());
                String initiatorId = document.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId();
                if (StringUtils.equals(principalId, principalInvestigatorId) || StringUtils.equals(principalId, initiatorId)) {
                    filteredProtocols.add(protocol);
                }
            } catch (WorkflowException we) {
                LOG.warn("Cannot find Document with header id " + protocol.getProtocolDocument().getDocumentNumber() + ", removing from search results.");
            }
        }

        return getPagedResults(filteredProtocols);
    }

    /**
     * Filters the unbounded list of protocols by the given field values
     * @param fieldValues the field values that form a normal protocol search
     * @return a list of all protocols filtered by the given field values
     */
    protected List<? extends BusinessObject> filterProtocols(Map<String, String> fieldValues) {
        List<GenericProtocol> protocols = (List<GenericProtocol>)getProtocolDaoHook().getProtocols(filterFieldValues(fieldValues));
        return getPagedResults(protocols);
    }

    /**
     * Filters out extra lookup parameters from the fieldValues.
     * @param fieldValues the field values that form a normal protocol search
     * @return the field values with extra lookup parameters removed
     */
    private Map<String, String> filterFieldValues(Map<String, String> fieldValues) {
        return removeExtraFilterParameters(fieldValues);
    }

    /**
     * Separates the list of protocols into pageable results.
     * @param protocols the list of protocols
     * @return a collection of protocol pageable results.
     */
    private CollectionIncomplete<GenericProtocol> getPagedResults(List<GenericProtocol> protocols) {
        Long matchingResultsCount = new Long(protocols.size());
        Integer searchResultsLimit = LookupUtils.getSearchResultsLimit(getProtocolClassHook());
        if ((matchingResultsCount == null) || (matchingResultsCount.intValue() <= searchResultsLimit.intValue())) {
            return new CollectionIncomplete<GenericProtocol>(protocols, new Long(0));
        } else {
            return new CollectionIncomplete<GenericProtocol>(trimResult(protocols, searchResultsLimit), matchingResultsCount);
        }
    }

    /**
     * This method trims the search result.
     * @param result, the result set to be trimmed
     * @param trimSize, the maximum size of the trimmed result set
     * @return the trimmed result set
     */
    protected List<GenericProtocol> trimResult(List<GenericProtocol> result, Integer trimSize) {
        List<GenericProtocol> trimedResult = new ArrayList<GenericProtocol>();
        for (GenericProtocol protocol : result) {
            if (trimedResult.size()< trimSize) {
                trimedResult.add(protocol);
            }
        }
        return trimedResult;
    }

    @Override
    public void validateSearchParameters(Map fieldValues) {
        super.validateSearchParameters(fieldValues);
        Set<String> keys = fieldValues.keySet();
        for (String key : keys) {
            String value = fieldValues.get(key).toString();
            if (key.toUpperCase().indexOf("DATE") > 0) {
                //we have a date, now we need to weed out the calculated params that have '..' or '>=' or '<='
                if(value.indexOf("..") == -1 && value.indexOf(">=") == -1 && value.indexOf("<=") == -1) {
                    boolean valid = validateDate(key, value);
                }
            }
        }
    }

    protected boolean validateDate(String dateFieldName, String dateFieldValue) {
        try{
            CoreApiServiceLocator.getDateTimeService().convertToSqlTimestamp(dateFieldValue);
            return true;
        } catch (ParseException e) {
            GlobalVariables.getMessageMap().putError(dateFieldName, KeyConstants.ERROR_PROTOCOL_SEARCH_INVALID_DATE);
            return false;
        } catch (Exception e) {
            LOG.error(e.getMessage(), e);
            GlobalVariables.getMessageMap().putError(dateFieldName, KeyConstants.ERROR_PROTOCOL_SEARCH_INVALID_DATE);
            return false;
        }
    }

    /**
     *
     * This method returns an instance of a DictionaryValidationService implementation
     * @return
     */
    public DictionaryValidationService getDictionaryValidationService() {
        if (dictionaryValidationService == null) {
            dictionaryValidationService = KNSServiceLocator.getKNSDictionaryValidationService();
        }
        return dictionaryValidationService;
    }

    @Override
    public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) {
        return getCustomActions(businessObject, pkNames);
    }

    protected boolean isParameterTrue(String parameterKey) {
        boolean parameterTrue = false;

        if (getParameters() != null && getParameters().containsKey(parameterKey)) {
            Object parameterObject = getParameters().get(parameterKey);
            if (parameterObject != null) {
                if (parameterObject instanceof Boolean) {
                    parameterTrue = (Boolean) parameterObject;
                }

                if (parameterObject instanceof String) {
                    parameterTrue = Boolean.parseBoolean(parameterObject.toString());
                }

                if (parameterObject instanceof String[]) {
                    String[] parameterObjectStringArray = (String[]) parameterObject;
                    for (String parameterObjectString : parameterObjectStringArray) {
                        if (Boolean.parseBoolean(parameterObjectString)) {
                            parameterTrue = true;
                            break;
                        }
                    }
                }
            }
        }

        return parameterTrue;
    }

    /**
     * Constructs and returns the perform action links.
     * @param businessObject
     * @param actionKey
     * @return
     */
    protected AnchorHtmlData getPerformActionLink(BusinessObject businessObject, String actionKey) {
        AnchorHtmlData htmlData = new AnchorHtmlData();
        htmlData.setDisplayText("perform action");
        Properties parameters = new Properties();
        parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, "performProtocolAction");
        parameters.put(KRADConstants.PARAMETER_COMMAND, KewApiConstants.DOCSEARCH_COMMAND);
        parameters.put(KRADConstants.DOCUMENT_TYPE_NAME, getDocumentTypeName());
        parameters.put("viewDocument", "false");
        parameters.put("docId", ((ProtocolBase) businessObject).getProtocolDocument().getDocumentNumber());
        parameters.put(actionKey, "true");
        String href  = UrlFactory.parameterizeUrl("../" + getHtmlAction(), parameters);
        htmlData.setHref(href);
        return htmlData;
    }

    /**
     * Construct and return edit, view, and copy links.
     * @param businessObject
     * @param pkNames
     */
    protected List<HtmlData> getEditCopyViewLinks(BusinessObject businessObject, List pkNames) {
        List<HtmlData> htmlDataList = new ArrayList<HtmlData>();
        if (kraAuthorizationService.hasPermission(getUserIdentifier(), (ProtocolBase) businessObject, PermissionConstants.MODIFY_PROTOCOL)) {
            //htmlDataList = super.getCustomActionUrls(businessObject, pkNames);
            // Chnage "edit" to edit same document, NOT initializing a new Doc
            AnchorHtmlData editHtmlData = getViewLink(((ProtocolBase) businessObject).getProtocolDocument());
            String href = editHtmlData.getHref();
            href = href.replace("viewDocument=true", "viewDocument=false");
            editHtmlData.setHref(href);
            editHtmlData.setDisplayText("edit");
            htmlDataList.add(editHtmlData);
            AnchorHtmlData htmlData = getUrlData(businessObject, KRADConstants.MAINTENANCE_COPY_METHOD_TO_CALL, pkNames);
            ProtocolDocumentBase document = ((ProtocolBase) businessObject).getProtocolDocument();
            htmlData.setHref("../DocCopyHandler.do?docId=" + document.getDocumentNumber()
                    + "&command=displayDocSearchView&documentTypeName=" + getDocumentTypeName());
            htmlDataList.add(htmlData);
        }
        if (kraAuthorizationService.hasPermission(getUserIdentifier(), (ProtocolBase) businessObject, PermissionConstants.VIEW_PROTOCOL)) {
            htmlDataList.add(getViewLink(((ProtocolBase) businessObject).getProtocolDocument()));
        }
        return htmlDataList;
    }

    /**
     * This override is reset field definition for research area lookup fields & investigator label.
     * @see org.kuali.core.lookup.AbstractLookupableHelperServiceImpl#getRows()
     */
    @SuppressWarnings("deprecation")
    @Override
    public List<Row> getRows() {
        List<Row> rows =  super.getRows();
        for (Row row : rows) {
            for (Field field : row.getFields()) {
                if (field.getPropertyName().equals(ProtocolLookupConstants.Property.RESEARCH_AREA_CODE)) {
                    super.updateLookupField(field,ProtocolLookupConstants.Property.RESEARCH_AREA_CODE,RESEARCH_AREA_CLASS_PATH);
                } else if (field.getPropertyName().equals(ProtocolLookupConstants.Property.PERFORMING_ORGANIZATION_ID)) {
                    super.updateLookupField(field,ProtocolLookupConstants.Property.ORGANIZATION_ID,ORGANIZATION_CLASS_PATH);
                } else if (field.getPropertyName().equals(ProtocolLookupConstants.Property.PROTOCOL_STATUS_CODE) || field.getPropertyName().equals(ProtocolLookupConstants.Property.PROTOCOL_TYPE_CODE)) {
                    // to disable lookup/inquiry display
                    field.setQuickFinderClassNameImpl(KRADConstants.EMPTY_STRING);
                } else if (field.getPropertyName().startsWith("leadUnit")) {
                    // This is to set label for search criteria.
                    if (field.getPropertyName().equals("leadUnitNumber")) {
                        field.setFieldLabel("Unit Number");
                    } else {
                        field.setFieldLabel("Unit Name");
                    }
                }
            }
        }
        return rows;
    }

    /**
     * Sets the KC Person Service.
     * @param kcPersonService the kc person service
     */
    public void setKcPersonService(KcPersonService kcPersonService) {
        this.kcPersonService = kcPersonService;
    }

    /**
     * This method is for several fields that does not have inquiry created by lookup frame work.
     * @see org.kuali.core.lookup.AbstractLookupableHelperServiceImpl#getInquiryUrl(org.kuali.core.bo.BusinessObject, java.lang.String)
     */
    @Override
    public HtmlData getInquiryUrl(BusinessObject bo, String propertyName) {

        BusinessObject inqBo = bo;
        String inqPropertyName = propertyName;
        if (propertyName.equals(ProtocolLookupConstants.Property.LEAD_UNIT_NUMBER)) {
           inqBo = new Unit();
            ((Unit) inqBo).setUnitNumber(((ProtocolBase) bo).getLeadUnitNumber());
            inqPropertyName = ProtocolLookupConstants.Property.UNIT_NUMBER;
        } else if (propertyName.equals(ProtocolLookupConstants.Property.INVESTIGATOR)) {
            GenericProtocol protocol = (GenericProtocol) bo;
            ProtocolPersonBase principalInvestigator = protocol.getPrincipalInvestigator();
            if (principalInvestigator != null) {
                if (StringUtils.isNotBlank(principalInvestigator.getPersonId())) {
                    inqBo = this.kcPersonService.getKcPersonByPersonId(principalInvestigator.getPersonId());
                    inqPropertyName = ProtocolLookupConstants.Property.PERSON_ID;
                } else {
                    if (principalInvestigator.getRolodexId() != null) {
                        inqBo = new Rolodex();
                        ((Rolodex) inqBo).setRolodexId(principalInvestigator.getRolodexId());
                        inqPropertyName = ProtocolLookupConstants.Property.ROLODEX_ID;
                    }
                }
            }
        }
        return super.getInquiryUrl(inqBo, inqPropertyName);
    }

    @Override
    protected String getHtmlAction() {
        return getHtmlActionHook();
    }

    @Override
    protected String getDocumentTypeName() {
        return getDocumentTypeNameHook();
    }

    @Override
    protected String getKeyFieldName() {
        return PROTOCOL_LOOKUP_KEY_FIELD;
    }

    protected String getUserIdentifier() {
         return GlobalVariables.getUserSession().getPrincipalId();
    }

    public void setKraAuthorizationService(KcAuthorizationService kraAuthorizationService) {
        this.kraAuthorizationService = kraAuthorizationService;
    }

    public void setTaskAuthorizationService(TaskAuthorizationService taskAuthorizationService) {
        this.taskAuthorizationService = taskAuthorizationService;
    }

    public void setDocumentService(DocumentService documentService) {
        this.documentService = documentService;
    }

    protected abstract List<? extends BusinessObject> getSearchResultsFilteredByTask(Map<String, String> fieldValues);
    protected abstract Map<String, String> removeExtraFilterParameters(Map<String, String> fieldValues);
    protected abstract List<HtmlData> getCustomActions(BusinessObject businessObject, List pkNames);
    protected abstract ProtocolDao<GenericProtocol> getProtocolDaoHook();
    protected abstract String getDocumentTypeNameHook();
    protected abstract String getHtmlActionHook();
    protected abstract Class<? extends ProtocolBase> getProtocolClassHook();

}


text:
package syncbase

import (
	"github.com/gogo/protobuf/proto"
	"github.com/ligato/cn-infra/datasync"
	"github.com/ligato/cn-infra/logging/logrus"
)

// NewResyncEventDB creates a new instance of ResyncEventDB using the given map of iterators.
func NewResyncEventDB(its map[string]datasync.KeyValIterator) *ResyncEventDB {
	return &ResyncEventDB{
		its:         its,
		DoneChannel: &DoneChannel{make(chan error, 1)},
	}
}

// ResyncEventDB implements the interface datasync.ResyncEvent (see comments in there).
type ResyncEventDB struct {
	its map[string]datasync.KeyValIterator
	*DoneChannel
}

// GetValues returns values of the event.
func (ev *ResyncEventDB) GetValues() map[string]datasync.KeyValIterator {
	return ev.its
}

// ChangeEvent is a simple structure that implements interface datasync.ChangeEvent.
type ChangeEvent struct {
	Changes  []datasync.ProtoWatchResp
	delegate datasync.CallbackResult
}

// GetChanges returns list of changes for the change event.
func (ev *ChangeEvent) GetChanges() []datasync.ProtoWatchResp {
	return ev.Changes
}

// Done propagates call to delegate. If the delegate is nil, then the error is logged (if occurred).
func (ev *ChangeEvent) Done(err error) {
	if ev.delegate != nil {
		ev.delegate.Done(err)
	} else if err != nil {
		logrus.DefaultLogger().Error(err)
	}
}

// ChangeResp represents single change in the change event.
type ChangeResp struct {
	Key        string
	ChangeType datasync.Op
	CurrVal    datasync.LazyValue
	CurrRev    int64
	PrevVal    datasync.LazyValue
}

// GetChangeType returns type of the event.
func (ev *ChangeResp) GetChangeType() datasync.Op {
	return ev.ChangeType
}

// GetKey returns the Key associated with the change.
func (ev *ChangeResp) GetKey() string {
	return ev.Key
}

// GetValue - see the comments in the interface datasync.ChangeEvent
func (ev *ChangeResp) GetValue(val proto.Message) (err error) {
	return ev.CurrVal.GetValue(val)
}

// GetRevision - see the comments in the interface datasync.ChangeEvent
func (ev *ChangeResp) GetRevision() int64 {
	return ev.CurrRev
}

// GetPrevValue returns the value before change.
func (ev *ChangeResp) GetPrevValue(prevVal proto.Message) (prevExists bool, err error) {
	if prevVal != nil && ev.PrevVal != nil {
		return true, ev.PrevVal.GetValue(prevVal)
	}
	return false, err
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="PublishConfigData">
    <serverData>
      <paths name="MaHoster.tk">
        <serverdata>
          <mappings>
            <mapping local="$PROJECT_DIR$" web="/" />
          </mappings>
        </serverdata>
      </paths>
      <paths name="ShmayroDev.tk">
        <serverdata>
          <mappings>
            <mapping local="$PROJECT_DIR$" web="/" />
          </mappings>
        </serverdata>
      </paths>
      <paths name="http://Haroun1.tk">
        <serverdata>
          <mappings>
            <mapping local="$PROJECT_DIR$" web="/" />
          </mappings>
        </serverdata>
      </paths>
    </serverData>
  </component>
</project>


text:
from PyQt5 import QtCore, QtGui, QtQuick

class SquircleRenderer( QtCore.QObject ):
    def __init__( self ):
        super().__init__()

        self.profile = QtGui.QOpenGLVersionProfile()
        self.profile.setVersion( 2, 1 )
        self.gl = None
        self.viewportSize = QtCore.QSize()
        self.t = 0.0
        self.program = None
        self.window = None

    def setT( self, t ):
        self.t = t

    def setViewportSize( self, size ):
        self.viewportSize = size

    def setWindow( self, window ):
        self.window = window

    def initialize( self ):
        if self.window != None:
            self.gl = self.window.openglContext().versionFunctions( self.profile )

            self.program = QtGui.QOpenGLShaderProgram()
            self.program.addCacheableShaderFromSourceCode( QtGui.QOpenGLShader.Vertex, "attribute highp vec4 vertices;varying highp vec2 coords;void main() { gl_Position = vertices; coords = vertices.xy;}" )
            self.program.addCacheableShaderFromSourceCode( QtGui.QOpenGLShader.Fragment, "uniform lowp float t; varying highp vec2 coords; void main() { lowp float i = 1. - (pow(abs(coords.x), 4.) + pow(abs(coords.y), 4.)); i = smoothstep(t - 0.8, t + 0.8, i); i = floor(i * 20.) / 20.; gl_FragColor = vec4(coords * .5 + .5, i, i);}" )
            self.program.bindAttributeLocation( "vertices", 0 )
            self.program.link()

    def render( self ):
        if self.program == None:
            self.initialize()
        self.gl.glClearColor( 0, 0, 0, 1 )
        self.gl.glClear( self.gl.GL_COLOR_BUFFER_BIT )
        self.gl.glDisable( self.gl.GL_DEPTH_TEST )

        values = [ [ -1.0, -1.0 ], [ 1.0, -1.0 ], [ -1.0, 1.0 ], [ 1.0, 1.0 ] ]

        self.program.bind()
        self.program.enableAttributeArray( 0 )
        self.program.setAttributeArray( 0, values )
        self.program.setUniformValue( "t", self.t )

        self.gl.glEnable( self.gl.GL_BLEND )
        self.gl.glBlendFunc( self.gl.GL_SRC_ALPHA, self.gl.GL_ONE )

        self.gl.glDrawArrays( self.gl.GL_TRIANGLE_STRIP, 0, 4 )

        self.program.disableAttributeArray( 0 )
        self.program.release()


text:
public enum TeamSide{
	LEFT, RIGHT
}