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

Description: RSS1 feed description works
Expect: feed.fields.getProperty('rss1:description') == 'a description'

-->
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns="http://purl.org/rss/1.0/"
>
  <channel rdf:about="http://www.xml.com/xml/news.rss">
    <title>Test</title>
    <link>http://xml.com/pub</link>
    <description>a description</description>
  </channel>
</rdf:RDF>

redpajama_set_name: RedPajamaGithub


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <properties>
    <scala.version>2.12.0</scala.version>
    <scala.major.version>2.12</scala.major.version>
    <scala.stm.version>0.8-SNAPSHOT</scala.stm.version>
  </properties>

  <modelVersion>4.0.0</modelVersion>
  <groupId>org.scala-stm</groupId>
  <artifactId>scala-stm-dep-tests-maven</artifactId>
  <version>0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <repositories>
    <repository>
      <id>oss.sonatype.org</id>
      <name>OSS Sonatype Release Repository</name>
      <url>https://oss.sonatype.org/content/repositories/releases</url>
    </repository>
    <repository>
      <id>oss.sonatype.org.snapshots</id>
      <name>OSS Sonatype Snapshot Repository</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
      <snapshots/>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>oss.sonatype.org</id>
      <name>OSS Sonatype Release Repository</name>
      <url>https://oss.sonatype.org/content/repositories/releases</url>
    </pluginRepository>
    <pluginRepository>
      <id>oss.sonatype.org.snapshots</id>
      <name>OSS Sonatype Snapshot Repository</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </pluginRepository>
  </pluginRepositories>

  <dependencies>
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-compiler</artifactId>
      <version>${scala.version}</version>
    </dependency>
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-library</artifactId>
      <version>${scala.version}</version>
    </dependency>
    <dependency>
      <groupId>org.scala-stm</groupId>
      <artifactId>scala-stm_${scala.major.version}</artifactId>
      <version>${scala.stm.version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>
	<version>2.0.2</version>
	<configuration>
          <source>1.6</source>
          <target>1.6</target>
	</configuration>
      </plugin>
      <plugin>
        <groupId>org.scala-tools</groupId>
        <artifactId>maven-scala-plugin</artifactId>
        <version>2.14</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <scalaVersion>${scala.version}</scalaVersion>
          <args>
            <arg>-target:jvm-1.5</arg>
          </args>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>


text:
module Travis
  module Api
    module Serialize
      module V0
        module Worker
          class Job
            class Test < Job
              include Formats

              def data
                {
                  'type' => 'test',
                  # TODO legacy. remove this once workers respond to a 'job' key
                  'build' => job_data,
                  'job' => job_data,
                  'source' => build_data,
                  'repository' => repository_data,
                  'pull_request' => commit.pull_request? ? pull_request_data : false,
                  'config' => job.decrypted_config,
                  'queue' => job.queue,
                  'uuid' => Travis.uuid,
                  'ssh_key' => ssh_key,
                  'env_vars' => env_vars,
                  'timeouts' => timeouts
                }
              end

              def build_data
                {
                  'id' => build.id,
                  'number' => build.number
                }
              end

              def job_data
                data = {
                  'id' => job.id,
                  'number' => job.number,
                  'commit' => commit.commit,
                  'commit_range' => commit.range,
                  'commit_message' => commit.message,
                  'branch' => commit.branch,
                  'ref' => commit.pull_request? ? commit.ref : nil,
                  'state' => job.state.to_s,
                  'secure_env_enabled' => job.secure_env_enabled?
                }
                data['tag'] = request.tag_name if include_tag_name?
                data['pull_request'] = commit.pull_request? ? commit.pull_request_number : false
                data
              end

              def repository_data
                {
                  'id' => repository.id,
                  'slug' => repository.slug,
                  'github_id' => repository.github_id,
                  'vcs_id' => repository.vcs_id,
                  'vcs_type' => repository.vcs_type,
                  'source_url' => repository.source_url,
                  'api_url' => repository.api_url,
                  'last_build_id' => repository.last_build_id,
                  'last_build_number' => repository.last_build_number,
                  'last_build_started_at' => format_date(repository.last_build_started_at),
                  'last_build_finished_at' => format_date(repository.last_build_finished_at),
                  'last_build_duration' => repository.last_build_duration,
                  'last_build_state' => repository.last_build_state.to_s,
                  'description' => repository.description,
                  'default_branch' => repository.default_branch
                }
              end

              def pull_request_data
                {
                  'number' => commit.pull_request_number,
                  'head_repo' => request.head_repo,
                  'base_repo' => request.base_repo,
                  'head_branch' => request.head_branch,
                  'base_branch' => request.base_branch
                }
              end

              def ssh_key
                nil
              end

              def env_vars
                vars = settings.env_vars
                vars = vars.public unless job.secure_env_enabled?

                vars.map do |var|
                  {
                    'name' => var.name,
                    'value' => var.value.decrypt,
                    'public' => var.public
                  }
                end
              end

              def timeouts
                { 'hard_limit' => timeout(:hard_limit), 'log_silence' => timeout(:log_silence) }
              end

              def timeout(type)
                timeout = settings.send(:"timeout_#{type}")
                timeout = timeout * 60 if timeout # worker handles timeouts in seconds
                timeout
              end

              def include_tag_name?
                Travis.config.include_tag_name_in_worker_payload && request.tag_name.present?
              end

              def settings
                repository.settings
              end
            end
          end
        end
      end
    end
  end
end


text:
d1\_test.replication\_tester package
====================================

.. automodule:: d1_test.replication_tester
   :members:
   :undoc-members:
   :show-inheritance:

Submodules
----------

d1\_test.replication\_tester.replication\_error module
------------------------------------------------------

.. automodule:: d1_test.replication_tester.replication_error
   :members:
   :undoc-members:
   :show-inheritance:

d1\_test.replication\_tester.replication\_server module
-------------------------------------------------------

.. automodule:: d1_test.replication_tester.replication_server
   :members:
   :undoc-members:
   :show-inheritance:

d1\_test.replication\_tester.replication\_tester module
-------------------------------------------------------

.. automodule:: d1_test.replication_tester.replication_tester
   :members:
   :undoc-members:
   :show-inheritance:

d1\_test.replication\_tester.run\_replication\_tester module
------------------------------------------------------------

.. automodule:: d1_test.replication_tester.run_replication_tester
   :members:
   :undoc-members:
   :show-inheritance:


text:
<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\ArrayHelper;
use core\models\Group;
use theme\widgets\InputFile;

/**
 * @var yii\web\View $this
 * @var core\models\Administrator $model
 * @var yii\widgets\ActiveForm $form
 */
if(!$model->hasErrors()) {
    $model->new_password = '';
    $model->new_password_repeat = '';
}
?>

    <?php $form = ActiveForm::begin([
        'enableClientValidation' => false,
        'validateOnSubmit' => false,
        'validateOnChange' => false,
    ]); ?>

    <?= $form->field($model, 'Group_id')->dropDownList(ArrayHelper::map(Group::find()->asArray()->all(), 'id', 'name'), ['prompt' => '', 'class' => 'select2']) ?>

    <?= $form->field($model, 'email')->textInput(['maxlength' => 255]) ?>

    <?= $form->field($model, 'new_password')->passwordInput(['maxlength' => 255, 'autocomplete' => 'off']) ?>

    <?= $form->field($model, 'new_password_repeat')->passwordInput(['maxlength' => 255]) ?>

    <?= $form->field($model, 'firstname')->textInput(['maxlength' => 255]) ?>

    <?= $form->field($model, 'lastname')->textInput(['maxlength' => 255]) ?>

    <?= $form->field($model, 'picture')->widget(InputFile::classname()) ?>

    <?= $form->field($model, 'phone')->textInput(['maxlength' => 255]) ?>

    <?= $form->field($model, 'mobile')->textInput(['maxlength' => 255]) ?>

        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

    <?php ActiveForm::end(); ?>


text:
{% extends "base.html" %}
{% block title %}パスワード変更{% endblock %}

{% block main %}

パスワード変更

{% include 'includes/messages.html' %}
<form method="post">
    {% csrf_token %}
    {% include 'includes/form.html' %}
    <button type="submit" class="btn btn-primary">変更</button>
</form>
{% endblock %}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Boost.Geometry (aka GGL, Generic Geometry Library)</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">

Main Page

Related Pages

Modules

Namespaces

Classes

Files

Examples

Functions

intersection: calculate new geometry

Functions

template<typename Geometry1 , typename Geometry2 , typename GeometryOut >

bool 	boost::geometry::intersection (Geometry1 const &geometry1, Geometry2 const &geometry2, GeometryOut &geometry_out)

 	Calculate the intersection of two geometries.

Function Documentation

template<typename Geometry1 , typename Geometry2 , typename GeometryOut >

          bool boost::geometry::intersection
          (
          Geometry1 const &
          geometry1,

          Geometry2 const &
          geometry2,

          GeometryOut &
          geometry_out

          )

Calculate the intersection of two geometries.

The free function intersection calculates the spatial set theoretic intersection of two geometries.

Template Parameters:

Geometry1	Any type fulfilling a Geometry Concept

Geometry2	Any type fulfilling a Geometry Concept

GeometryOut	Collection of geometries (e.g. std::vector, std::deque, boost::geometry::multi*) of which the value_type fulfills a Point, LineString or Polygon concept, or it is the output geometry (e.g. for a box)

Parameters:

geometry1	A model of the specified concept

geometry2	A model of the specified concept

geometry_out	The output geometry, either a multi_point, multi_polygon, multi_linestring, or a box (for intersection of two boxes)

Examples:

02_linestring_example.cpp, and 03_polygon_example.cpp.

April 2, 2011

Copyright © 2007-2011 Barend Gehrels, Amsterdam, the Netherlands

Copyright © 2008-2011 Bruno Lalande, Paris, France

Copyright © 2009-2010 Mateusz Loskot, London, UK

<address style="text-align: right;">
Documentation is generated by Doxygen
</address>


text:
import mysql.connector
from model.group import Group
from model.contact import Contact
class DbFixture:

    def __init__(self, host, name, user, password):
        self.host = host
        self.name = name
        self.user = user
        self.password = password
        self.connection = mysql.connector.connect(host=host, database = name, user = user, password =password)
        self.connection.autocommit = True

    def get_group_list(self):
        list = []
        cursor = self.connection.cursor()
        try:
            cursor.execute("select group_id, group_name, group_header, group_footer from group_list")
            for row in cursor:
                (id, name, header, footer) = row
                list.append(Group(id = str(id), name = name, header = header, footer = footer))
        finally:
                cursor.close()
        return list

    def get_contact_list(self):
        list = []
        cursor = self.connection.cursor()
        try:
            cursor.execute("select id, firstname, lastname from addressbook where deprecated='0000-00-00 00:00:00'")
            for row in cursor:
                (id, firstname, lastname) = row
                list.append(Contact(id = str(id), firstname = firstname, lastname = lastname))
        finally:
                cursor.close()
        return list

    def destroy(self):
        self.connection.close()


text:
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
	<id>bin</id>
	<formats>
		<format>zip</format>
	</formats>
	<includeBaseDirectory>false</includeBaseDirectory>
	<files>
		<file>
			<source>target/rds-loader-${snapshot.version}.jar</source>
			<outputDirectory>/System/Jar</outputDirectory>
		</file>
		<file>
			<source>src/main/resources/loader.sh</source>
			<outputDirectory>/</outputDirectory>
		</file>
	</files>
	<dependencySets>
		<dependencySet>
			<unpack>false</unpack>
			<outputDirectory>/System/Jar</outputDirectory>
		</dependencySet>
	</dependencySets>
</assembly>


text:
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-styles/paper-styles.html">

<link rel="import" href="../interact-wrapper.html">

<dom-module id="interact-test1">
  <template>

    <template id='templatezones' is='dom-repeat' items='{{dropzones}}'>

    </template>

      Drag Me

  </template>

</dom-module>


text:
<?xml version="1.0" encoding="UTF-8" ?>
<!--
< Copyright (c) 2009 International Business Machines Corporation and others. All rights reserved.
-->
<!DOCTYPE ldml SYSTEM "http://www.unicode.org/cldr/dtd/1.7/ldml.dtd">
<ldml>
    <identity>
        <version number="$Revision: 1.1 $"/>
        <generation date="$Date: 2009/03/24 17:39:37 $"/>
        <language type="fa"/>
        <territory type="AF"/>
    </identity>
</ldml>


text:
import argparse
import os
import shutil
import subprocess

def perform_build(args, swiftbuild_path, config, binary_name, opt_flag):
    assert config in ["debug", "release"]
    assert binary_name in ["Benchmark_O", "Benchmark_Osize", "Benchmark_Onone"]
    assert opt_flag in ["-O", "-Osize", "-Onone"]

    inner_build_dir = os.path.join(args.build_path, binary_name)
    swiftbuild_args = [
        swiftbuild_path,
        "--package-path",
        args.package_path,
        "--build-path",
        inner_build_dir,
        "--configuration",
        config,
        "-Xswiftc",
        "-Xllvm",
        "-Xswiftc",
        "-align-module-to-page-size",
        "-Xswiftc",
        opt_flag,
    ]
    if args.verbose:
        swiftbuild_args.append("--verbose")
    subprocess.call(swiftbuild_args)

    # Copy the benchmark file into the final ./bin directory.
    binpath = os.path.join(inner_build_dir, config, "SwiftBench")
    finalpath = os.path.join(args.build_path, "bin", binary_name)
    shutil.copy(binpath, finalpath)

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--verbose", "-v", action="store_true")
    parser.add_argument("--package-path", type=str, required=True)
    parser.add_argument("--build-path", type=str, required=True)
    parser.add_argument("--toolchain", type=str, required=True)

    args = parser.parse_args()

    # Create our bin directory so we can copy in the binaries.
    bin_dir = os.path.join(args.build_path, "bin")
    if not os.path.isdir(bin_dir):
        os.makedirs(bin_dir)

    swiftbuild_path = os.path.join(args.toolchain, "usr", "bin", "swift-build")
    perform_build(args, swiftbuild_path, "debug", "Benchmark_Onone", "-Onone")
    perform_build(args, swiftbuild_path, "release", "Benchmark_Osize", "-Osize")
    perform_build(args, swiftbuild_path, "release", "Benchmark_O", "-O")

if __name__ == "__main__":
    main()


text:
/*	$Id: ppp_defs.h,v 1.2 1994/09/21 01:31:06 paulus Exp $	*/

/*
 * ppp_defs.h - PPP definitions.
 *
 * Copyright (c) 1994 The Australian National University.
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation is hereby granted, provided that the above copyright
 * notice appears in all copies.  This software is provided without any
 * warranty, express or implied. The Australian National University
 * makes no representations about the suitability of this software for
 * any purpose.
 *
 * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
 * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
 * OF SUCH DAMAGE.
 *
 * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
 * OR MODIFICATIONS.
 */

/*
 *  ==FILEVERSION 20000114==
 *
 *  NOTE TO MAINTAINERS:
 *     If you modify this file at all, please set the above date.
 *     ppp_defs.h is shipped with a PPP distribution as well as with the kernel;
 *     if everyone increases the FILEVERSION number above, then scripts
 *     can do the right thing when deciding whether to install a new ppp_defs.h
 *     file.  Don't change the format of that line otherwise, so the
 *     installation script can recognize it.
 */

#ifndef _PPP_DEFS_H_
#define _PPP_DEFS_H_

/*
 * The basic PPP frame.
 */
#define PPP_HDRLEN	4	/* octets for standard ppp header */
#define PPP_FCSLEN	2	/* octets for FCS */
#define PPP_MRU		1500	/* default MRU = max length of info field */

#define PPP_ADDRESS(p)	(((__u8 *)(p))[0])
#define PPP_CONTROL(p)	(((__u8 *)(p))[1])
#define PPP_PROTOCOL(p)	((((__u8 *)(p))[2] << 8) + ((__u8 *)(p))[3])

/*
 * Significant octet values.
 */
#define	PPP_ALLSTATIONS	0xff	/* All-Stations broadcast address */
#define	PPP_UI		0x03	/* Unnumbered Information */
#define	PPP_FLAG	0x7e	/* Flag Sequence */
#define	PPP_ESCAPE	0x7d	/* Asynchronous Control Escape */
#define	PPP_TRANS	0x20	/* Asynchronous transparency modifier */

/*
 * Protocol field values.
 */
#define PPP_IP		0x21	/* Internet Protocol */
#define PPP_AT		0x29	/* AppleTalk Protocol */
#define PPP_IPX		0x2b	/* IPX protocol */
#define	PPP_VJC_COMP	0x2d	/* VJ compressed TCP */
#define	PPP_VJC_UNCOMP	0x2f	/* VJ uncompressed TCP */
#define PPP_MP		0x3d	/* Multilink protocol */
#define PPP_IPV6	0x57	/* Internet Protocol Version 6 */
#define PPP_COMPFRAG	0xfb	/* fragment compressed below bundle */
#define PPP_COMP	0xfd	/* compressed packet */
#define PPP_MPLS_UC	0x0281	/* Multi Protocol Label Switching - Unicast */
#define PPP_MPLS_MC	0x0283	/* Multi Protocol Label Switching - Multicast */
#define PPP_IPCP	0x8021	/* IP Control Protocol */
#define PPP_ATCP	0x8029	/* AppleTalk Control Protocol */
#define PPP_IPXCP	0x802b	/* IPX Control Protocol */
#define PPP_IPV6CP	0x8057	/* IPv6 Control Protocol */
#define PPP_CCPFRAG	0x80fb	/* CCP at link level (below MP bundle) */
#define PPP_CCP		0x80fd	/* Compression Control Protocol */
#define PPP_MPLSCP	0x80fd	/* MPLS Control Protocol */
#define PPP_LCP		0xc021	/* Link Control Protocol */
#define PPP_PAP		0xc023	/* Password Authentication Protocol */
#define PPP_LQR		0xc025	/* Link Quality Report protocol */
#define PPP_CHAP	0xc223	/* Cryptographic Handshake Auth. Protocol */
#define PPP_CBCP	0xc029	/* Callback Control Protocol */

/*
 * Values for FCS calculations.
 */

#define PPP_INITFCS	0xffff	/* Initial FCS value */
#define PPP_GOODFCS	0xf0b8	/* Good final FCS value */

#ifdef __KERNEL__
#include <linux/crc-ccitt.h>
#define PPP_FCS(fcs, c) crc_ccitt_byte(fcs, c)
#endif

/*
 * Extended asyncmap - allows any character to be escaped.
 */

typedef __u32		ext_accm[8];

/*
 * What to do with network protocol (NP) packets.
 */
enum NPmode {
    NPMODE_PASS,		/* pass the packet through */
    NPMODE_DROP,		/* silently drop the packet */
    NPMODE_ERROR,		/* return an error */
    NPMODE_QUEUE		/* save it up for later. */
};

/*
 * Statistics for LQRP and pppstats
 */
struct pppstat	{
    __u32	ppp_discards;	/* # frames discarded */

    __u32	ppp_ibytes;	/* bytes received */
    __u32	ppp_ioctects;	/* bytes received not in error */
    __u32	ppp_ipackets;	/* packets received */
    __u32	ppp_ierrors;	/* receive errors */
    __u32	ppp_ilqrs;	/* # LQR frames received */

    __u32	ppp_obytes;	/* raw bytes sent */
    __u32	ppp_ooctects;	/* frame bytes sent */
    __u32	ppp_opackets;	/* packets sent */
    __u32	ppp_oerrors;	/* transmit errors */
    __u32	ppp_olqrs;	/* # LQR frames sent */
};

struct vjstat {
    __u32	vjs_packets;	/* outbound packets */
    __u32	vjs_compressed;	/* outbound compressed packets */
    __u32	vjs_searches;	/* searches for connection state */
    __u32	vjs_misses;	/* times couldn't find conn. state */
    __u32	vjs_uncompressedin; /* inbound uncompressed packets */
    __u32	vjs_compressedin;   /* inbound compressed packets */
    __u32	vjs_errorin;	/* inbound unknown type packets */
    __u32	vjs_tossed;	/* inbound packets tossed because of error */
};

struct compstat {
    __u32	unc_bytes;	/* total uncompressed bytes */
    __u32	unc_packets;	/* total uncompressed packets */
    __u32	comp_bytes;	/* compressed bytes */
    __u32	comp_packets;	/* compressed packets */
    __u32	inc_bytes;	/* incompressible bytes */
    __u32	inc_packets;	/* incompressible packets */

    /* the compression ratio is defined as in_count / bytes_out */
    __u32       in_count;	/* Bytes received */
    __u32       bytes_out;	/* Bytes transmitted */

    double	ratio;		/* not computed in kernel. */
};

struct ppp_stats {
    struct pppstat	p;	/* basic PPP statistics */
    struct vjstat	vj;	/* VJ header compression statistics */
};

struct ppp_comp_stats {
    struct compstat	c;	/* packet compression statistics */
    struct compstat	d;	/* packet decompression statistics */
};

/*
 * The following structure records the time in seconds since
 * the last NP packet was sent or received.
 */
struct ppp_idle {
    time_t xmit_idle;		/* time since last NP packet sent */
    time_t recv_idle;		/* time since last NP packet received */
};

#endif /* _PPP_DEFS_H_ */


text:
@class JIRProjectAvatarUrls;

@interface JIRProject : NSObject <NSCoding> {

    JIRProjectAvatarUrls *avatarUrls;
    NSString *jIRProjectId;
    NSString *key;
    NSString *name;
    NSString *selfUrl;

}

@property (nonatomic, strong) JIRProjectAvatarUrls *avatarUrls;
@property (nonatomic, copy) NSString *jIRProjectId;
@property (nonatomic, copy) NSString *key;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *selfUrl;

+ (JIRProject *)instanceFromDictionary:(NSDictionary *)aDictionary;
- (void)setAttributesFromDictionary:(NSDictionary *)aDictionary;

- (NSDictionary *)dictionaryRepresentation;

@end


text:
#region License Header

#endregion License Header

using Xunit;

namespace Quantler.Tests.Core.Broker
{
    /// <summary>
    /// TODO: set unit tests
    /// </summary>
    public class SpreadModelTests
    {
        #region Public Methods

        [Fact(Skip = "TODO")]
        [Trait("Quantler.Core.Broker", "SpreadModels")]
        //General test to check on spread model
        public void FloatingMarketSpreadModel_GeneralTest()
        {
        }

        #endregion Public Methods
    }
}


text:
package org.tensorflow;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Unit tests for {@link org.tensorflow.OperationBuilder}. */
@RunWith(JUnit4.class)
public class OperationBuilderTest {
  // TODO(ashankar): Restore this test once the C API gracefully handles mixing graphs and
  // operations instead of segfaulting.
  @Test
  @Ignore
  public void failWhenMixingOperationsOnDifferentGraphs() {
    try (Graph g1 = new Graph();
        Graph g2 = new Graph()) {
      Output c1 = TestUtil.constant(g1, "C1", 3);
      Output c2 = TestUtil.constant(g2, "C2", 3);
      TestUtil.addN(g1, c1, c1);
      try {
        TestUtil.addN(g2, c1, c2);
      } catch (Exception e) {
        fail(e.toString());
      }
    }
  }

  @Test
  public void failOnUseAfterBuild() {
    try (Graph g = new Graph();
        Tensor t = Tensor.create(1)) {
      OperationBuilder b =
          g.opBuilder("Const", "Const").setAttr("dtype", t.dataType()).setAttr("value", t);
      b.build();
      try {
        b.setAttr("dtype", t.dataType());
      } catch (IllegalStateException e) {
        // expected exception.
      }
    }
  }

  @Test
  public void failOnUseAfterGraphClose() {
    OperationBuilder b = null;
    try (Graph g = new Graph();
        Tensor t = Tensor.create(1)) {
      b = g.opBuilder("Const", "Const").setAttr("dtype", t.dataType()).setAttr("value", t);
    }
    try {
      b.build();
    } catch (IllegalStateException e) {
      // expected exception.
    }
  }

  @Test
  public void setAttr() {
    // The effect of setting an attribute may not easily be visible from the other parts of this
    // package's API. Thus, for now, the test simply executes the various setAttr variants to see
    // that there are no exceptions. If an attribute is "visible", test for that in a separate test
    // (like setAttrShape).
    //
    // This is a bit of an awkward test since it has to find operations with attributes of specific
    // types that aren't inferred from the input arguments.
    try (Graph g = new Graph()) {
      // dtype, tensor attributes.
      try (Tensor t = Tensor.create(1)) {
        g.opBuilder("Const", "DataTypeAndTensor")
            .setAttr("dtype", DataType.INT32)
            .setAttr("value", t)
            .build()
            .output(0);
        assertTrue(hasNode(g, "DataTypeAndTensor"));
      }
      // string, bool attributes.
      g.opBuilder("Abort", "StringAndBool")
          .setAttr("error_msg", "SomeErrorMessage")
          .setAttr("exit_without_error", false)
          .build();
      assertTrue(hasNode(g, "StringAndBool"));
      // int (TF "int" attributes are 64-bit signed, so a Java long).
      g.opBuilder("RandomUniform", "Int")
          .addInput(TestUtil.constant(g, "RandomUniformShape", new int[]{1}))
          .setAttr("seed", 10)
          .setAttr("dtype", DataType.FLOAT)
          .build();
      assertTrue(hasNode(g, "Int"));
      // list(int)
      g.opBuilder("MaxPool", "IntList")
          .addInput(TestUtil.constant(g, "MaxPoolInput", new float[2][2][2][2]))
          .setAttr("ksize", new long[] {1, 1, 1, 1})
          .setAttr("strides", new long[] {1, 1, 1, 1})
          .setAttr("padding", "SAME")
          .build();
      assertTrue(hasNode(g, "IntList"));
      // list(float)
      g.opBuilder("FractionalMaxPool", "FloatList")
          .addInput(TestUtil.constant(g, "FractionalMaxPoolInput", new float[2][2][2][2]))
          .setAttr("pooling_ratio", new float[] {1.0f, 1.44f, 1.73f, 1.0f})
          .build();
      assertTrue(hasNode(g, "FloatList"));
      // Missing tests: float, list(dtype), list(tensor), list(string), list(bool)
    }
  }

  @Test
  public void setAttrShape() {
    try (Graph g = new Graph()) {
      Output n =
          g.opBuilder("Placeholder", "unknown")
              .setAttr("dtype", DataType.FLOAT)
              .setAttr("shape", Shape.unknown())
              .build()
              .output(0);
      assertEquals(-1, n.shape().numDimensions());
      assertEquals(DataType.FLOAT, n.dataType());

      n =
          g.opBuilder("Placeholder", "batch_of_vectors")
              .setAttr("dtype", DataType.FLOAT)
              .setAttr("shape", Shape.make(-1, 784))
              .build()
              .output(0);
      assertEquals(2, n.shape().numDimensions());
      assertEquals(-1, n.shape().size(0));
      assertEquals(784, n.shape().size(1));
      assertEquals(DataType.FLOAT, n.dataType());
    }
  }

  @Test
  public void addControlInput() {
    try (Graph g = new Graph();
         Session s = new Session(g);
         Tensor yes = Tensor.create(true);
         Tensor no = Tensor.create(false)) {
      Output placeholder = TestUtil.placeholder(g, "boolean", DataType.BOOL);
      Operation check = g.opBuilder("Assert", "assert")
          .addInput(placeholder)
          .addInputList(new Output[]{placeholder})
          .build();
      Operation noop = g.opBuilder("NoOp", "noop")
          .addControlInput(check)
          .build();

      // No problems when the Assert check succeeds
      s.runner().feed(placeholder, yes).addTarget(noop).run();

      // Exception thrown by the execution of the Assert node
      try {
        s.runner().feed(placeholder, no).addTarget(noop).run();
        fail("Did not run control operation.");
      } catch (IllegalArgumentException e) {
        // expected
      }
    }
  }

  private static boolean hasNode(Graph g, String name) {
    return g.operation(name) != null;
  }
}


text:
=================
General Functions
=================

position() - Returns tuple of integers: (x, y) for the current position of the mouse cursor.

size() - Returns tuple of integers: (width, height) for size of the main monitor. TODO - add multi monitor support.


text:
package jp.fieldnotes.hatunatu.util.xml;

import javax.xml.XMLConstants;
import javax.xml.validation.SchemaFactory;

/**
 * {@link SchemaFactory}のためのユーティリティ・クラスです。
 *
 * @author koichik
 */
public abstract class SchemaFactoryUtil {

    /**
     * W3C XML Schemaのための{@link SchemaFactory}を生成します。
     *
     * @return W3C XML Schemaのための{@link SchemaFactory}
     */
    public static SchemaFactory newW3cXmlSchemaFactory() {
        return SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    }

    /**
     * RELAX NGのための{@link SchemaFactory}を生成します。
     *
     * @return RELAX NGのための{@link SchemaFactory}
     */
    public static SchemaFactory newRelaxNgSchemaFactory() {
        return SchemaFactory.newInstance(XMLConstants.RELAXNG_NS_URI);
    }

}


text:
package tw.com.unit;

import static org.junit.Assert.*;

import java.util.LinkedList;
import java.util.List;

import org.junit.Test;

import tw.com.EnvironmentSetupForTests;
import tw.com.entity.InstanceSummary;

import software.amazon.awssdk.services.ec2.model.Tag;

public class TestInstanceSummary {

	@Test
	public void testShouldSummariseTags() {
		List<Tag> tags = new LinkedList<>();

		tags.add(EnvironmentSetupForTests.createEc2Tag("tag1", "valueA"));
		tags.add(EnvironmentSetupForTests.createEc2Tag("tag2", "valueB"));
		tags.add(EnvironmentSetupForTests.createEc2Tag("tag3", "valueC"));

		InstanceSummary summary = new InstanceSummary("id", "10.0.0.99", tags);

		String results = summary.getTags();

		assertEquals("tag1=valueA,tag2=valueB,tag3=valueC", results);
	}

	@Test
	public void shouldReturnCorrectValues() {
		List<Tag> tags = new LinkedList<>();
		InstanceSummary summary = new InstanceSummary("id", "10.0.0.99", tags);

		assertEquals("id", summary.getInstance());
		assertEquals("10.0.0.99", summary.getPrivateIP());

	}

}


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.08.09 at 06:44:50 PM IST
//

package org.ieee.ltsc.lom.manifest;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
import javax.xml.bind.annotation.XmlType;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CopyrightAndOtherRestrictions.Type", propOrder = {
    "sourcesAndValues"
})
public class CopyrightAndOtherRestrictionsType {

    @XmlElementRefs({
        @XmlElementRef(name = "source", namespace = "http://ltsc.ieee.org/xsd/apipv1p0/LOM/manifest", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "value", namespace = "http://ltsc.ieee.org/xsd/apipv1p0/LOM/manifest", type = JAXBElement.class, required = false)
    })
    protected List<JAXBElement<String>> sourcesAndValues;

    /**
     * Gets the value of the sourcesAndValues property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the sourcesAndValues property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getSourcesAndValues().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link JAXBElement }{@code <}{@link String }{@code >}
     * {@link JAXBElement }{@code <}{@link String }{@code >}
     *
     *
     */
    public List<JAXBElement<String>> getSourcesAndValues() {
        if (sourcesAndValues == null) {
            sourcesAndValues = new ArrayList<JAXBElement<String>>();
        }
        return this.sourcesAndValues;
    }

}


text:
A collection of groovy scripts used to controll my home automation.
Groovy is the language used for the smartthings controller.
Some automation may be existing on an outer topography, using IFTTT combined with other services.
Will also include any additional resources (e.g. images) or APIs to control services, such as voice control.

* Smarthings Dashboard: https://graph.api.smartthings.com
* Smartthings & Groovy Documentation: http://docs.smartthings.com/en/latest/index.html

## Devices
* HomeHub - Smartthings Hub 2.0
* OfficeHub - Smartthings Hub 1.0
* AquariumFWStrip - Aeon SmartStrip
* AquariumSWStrip - Aeon SmartStrip
* BedroomBulb1 - Aeon Bulb
* BedroomBulb2 - Aeon Bulb
* BedroomMultisensor - Aeon Multisensor
* GPSAndrea - Virtual Switch
* GPSBenHome - Virtual Switch
* GPSBenOffice - Virtual Switch
* GPSButler - Virtual Switch
* GPSChef - Virtual Switch
* GPSDriver - Virtual Switch
* GPSGardener - Virtual Switch
* GPSGuard - Virtual Switch
* GPSIzzy - Virtual Switch
* GPSMaid - Virtual Switch
* GPSMarcus - Virtual Switch
* GPSTrainer - Virtual Switch
* MixingWaterPump - Z-Wave Metering Switch

## IFTTT Recipes
* If Ben enters home area, then Switch on GPSBenHome
* If Ben exits home area, then switch off GPSBenHome
* If Ben connects to YoungNetwork, then Switch on GPSBenHome
* If Ben disconnects from YoungNetwork, then switch off GPSBenHome
* If Marcus enters home area, then Switch on GPSMarcus
* If Marcus exits home area, then switch off GPSMarcus
* If Marcus connects to YoungNetwork, then Switch on GPSMarcus
* If Marcus disconnects from YoungNetwork, then switch off GPSMarcus
* If Ben enters office area, then Switch on GPSBenOffice
* If Ben exits office area, then switch off GPSBenOffice
* If Ben connects to Work's Network, then Switch on GPSBenOffice
* If Ben disconnects from Work's Network, then switch off GPSBenOffice


text:
<?php

namespace Sabre\VObject\Property\ICalendar;

use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\Component\VEvent;

class DurationTest extends \PHPUnit_Framework_TestCase {

    function testGetDateInterval() {

        $vcal = new VCalendar();
        $event = $vcal->add('VEVENT', array('DURATION' => array('PT1H')));

        $this->assertEquals(
            new \DateInterval('PT1H'),
            $event->{'DURATION'}->getDateInterval()
        );
    }
}


text:
*Issue #862*

**Author:**
- Vivek Mhatre

## The Problem

Although we have a urdf model of Swervi, we have no way of controlling Swervi in simulation. It is essential to have a way to control the swerve modules on Swervi in gazebo so we can actually test our new code for Swervi. The end goal of this project is to have a node that is able to control all four swerve modules in simulation.

## Proposed Solution

1. Setup a new joint controller configuration for the swerve modules on Swervi.
2. Create a new message type to control the swerve modules.
 - The existing `velocity_pair` message only works for differential drive. Need to create a new message type for swerve modules.
3. Write a new gazebo control node for Swervi that uses the new message type to control Swervi in simulation.

## Questions & Research

- How will the new joint controller work with two degrees of movement? (spinning and moving forward)
- How should the new message type be structured?
- How should the firmware be rewritten to interface with the new swerve modules?

## Overall Scope

### Affected Packages

- The `igvc_gazebo`, `igvc_msgs`, and the `igvc_description` packages will be affected.


text:
import org.junit.*;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.List;

import static org.junit.Assert.*;

public class TESTIntegrationTest {
    Client client;
    Server mainServer, failoverServer;
    List<InetSocketAddress> serverList;

    @Before
    public void setUp() throws Exception {
        serverList = Utils.getTestServerList();
        client = new Client(serverList);
        mainServer = Utils.setupNewTestServer(serverList, 0);
        failoverServer = Utils.setupNewTestServer(serverList, 1);
    }

    @After
    public void tearDown() throws Exception {
        mainServer.shutDown();
        failoverServer.shutDown();

    }

    @Test
    public void testReserve() throws Exception {
        String name = "Beth";
        String seat = "1";
        String expectedResponse = client.responses.get("AssignedSeat") + seat;
        String response = reserve(name);

        assertEquals(expectedResponse, response);
    }

    @Test
    public void testBookSeat() throws Exception {
        String name = "Beth";
        String seat = "2";
        String expectedResponse = client.responses.get("AssignedSeat") + seat;
        String response = bookSeat(name, seat);

        assertEquals(expectedResponse, response);
    }

    @Test
    public void testSearch() throws Exception {
        String name = "Beth";
        String seat = "2";
        String expectedResponse = client.responses.get("Seat") + seat + client.responses.get("IsAssigned") + name;
        bookSeat(name, seat);
        String response = search(name);

        assertEquals(expectedResponse, response);
    }

    @Test
    public void testDelete() throws Exception {
        String name = "Beth";
        String seat = "2";
        String expectedResponse = client.responses.get("Deleting") + seat + client.responses.get("AssignedTo") + name;
        bookSeat(name, seat);
        String response = delete(name);

        assertEquals(expectedResponse, response);
    }

    @Test
    public void testReserveAtCapacity() throws Exception {
        String name = "Beth";
        String expectedResponse = client.responses.get("SoldOut");
        for (int i = 0; i < 5; i++){
            reserve(name + " " + Integer.toString(i));
        }
        String response = reserve(name);

        assertEquals(expectedResponse, response);
    }

    @Test
    public void testReserveDuplicate() throws Exception {
        String name = "Beth";
        String expectedResponse = client.responses.get("Existing");
        reserve(name);
        String response = reserve(name);

        assertEquals(expectedResponse, response);
    }

    @Test
    public void testBookSeatUnavailble() throws Exception {
        String name = "Beth";
        String name2 = "Neel";
        String seat = "2";
        String expectedResponse = seat + client.responses.get("NotAvailable");
        bookSeat(name, seat);
        String response = bookSeat(name2, seat);

        assertEquals(expectedResponse, response);
    }

    @Test
    public void testSearchNotFound() throws Exception {
        String name = "Beth";
        String expectedResponse = client.responses.get("NotFound") + name;
        String response = search(name);

        assertEquals(expectedResponse, response);
    }

    @Test
    public void testDeleteNotFound() throws Exception {
        String name = "Beth";
        String expectedResponse = client.responses.get("NotFound") + name;
        String response = delete(name);

        assertEquals(expectedResponse, response);
    }

    @Test
    public void testFailover() throws InterruptedException, IOException {
        mainServer.shutDown();

        String name = "Beth";
        String seat = "1";
        String expectedResponse = client.responses.get("AssignedSeat") + seat;
        String response = reserve(name);

        assertEquals(failoverServer.server, client.server);
        assertEquals(expectedResponse, response);
    }

    @Test
    public void testRecovery() throws InterruptedException, IOException {
        mainServer.shutDown();

        reserve("Beth");
        reserve("Neel");
        reserve("Jake");
        reserve("Ashley");

        mainServer = Utils.setupNewTestServer(serverList, 0);

        assertEquals(failoverServer.seatingChart, mainServer.seatingChart);
    }

    public String bookSeat(String name, String seat){
        return client.getResponse(client.bookSeat(name, seat));
    }

    public String reserve(String name){
        return client.getResponse(client.reserve(name));
    }

    public String search(String name){
        return client.getResponse(client.search(name));
    }

    public String delete(String name){
        return client.getResponse(client.delete(name));
    }

}


text:
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from operator import itemgetter
import sys

if len(sys.argv) != 2:
    print "Usage: findtimewarpers.py height"
    exit(1)

# have a local running instance of zcashd
api = AuthServiceProxy("http://username:password@127.0.0.1:8232")

print "height,timestamp,miner,warplen,warpdelta"

maxheight = int(sys.argv[1])

warpcount = 0
impactedcount = 0
prevtimestamp = 0
t_list = []
miners = {}
maxwarplen = 0
maxwarpdelta = 0

# from block 0 to n (inclusive)
for h in xrange(0, maxheight+1):
    blockhash = api.getblockhash(h)
    block = api.getblock(blockhash)
    timestamp = block["time"]
    t_list.append(timestamp)

    if timestamp <= prevtimestamp:
        txid = block["tx"][0]
        tx = api.getrawtransaction(txid,1)
        vout = tx["vout"][0]
        miner = vout["scriptPubKey"]["addresses"][0]

        # how many previous blocks affected by this block?
        warplen = 0
        for j in xrange(h-1, 0, -1):
            if timestamp <= t_list[j]:
                warplen = warplen + 1
            else:
                break

        impactedcount = impactedcount + warplen
        warpdelta = abs(timestamp - prevtimestamp)
        if warplen > maxwarplen:
            maxwarplen = warplen
        if warpdelta > maxwarpdelta:
            maxwarpdelta = warpdelta
        warpcount = warpcount + 1
        miners[miner] = miners.get(miner,0) + 1

        print "%d,%d,%s,%d,%d" % (h, timestamp, miner, warplen, warpdelta)

    prevtimestamp = timestamp

print "number of time warp blocks       = %d (%.2f%%)" % (warpcount, 100.0 * warpcount / maxheight)
print "number of affected blocks        = %d (%.2f%%)" % (impactedcount, 100.0 * impactedcount / maxheight)
print "longest chain of blocks warped   = %d" % maxwarplen
print "longest warp interval (secs)     = %d" % maxwarpdelta
print "miners and number of warp blocks = "
for k, v in sorted(miners.items(), key=itemgetter(1), reverse=True):
    print "%s,%d" % (k,v)


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

    <string name="app_name">Client Server Communication</string>
    <string name="action_settings">Settings</string>
    <string name="server">SERVER</string>
    <string name="client">CLIENT</string>
    <string name="message_from_server">Message from Server</string>
    <string name="server_address">Server Address</string>
    <string name="server_port">Server Port</string>
    <string name="display_message">Display Message</string>

</resources>


text:
Mozilla Chrome Tests
====================

Install files into privileged chrome for testing.
-------------------------------------------------

A Mozilla Toolkit extension for testing projects that require chrome privileges
in Mozilla Platform applications.  This is useful for Mozilla JavaScript
modules, XULRunner applications, and Firefox and Thunderbird extensions among
others.

My name is Kris Walker. Contact me with questions.

Licensed under The MIT License
------------------------------

Copyright (c) 2009 - 2010 Fireworks Technology Projects Inc.
[www.fireworksproject.com](http://www.fireworksproject.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

 [1]: http://en.wikipedia.org/wiki/Monad_%28functional_programming%29
 [2]: http://www.haskell.org/haskellwiki/Monad_tutorials_timeline
 [3]: http://importantshock.wordpress.com/2009/01/18/jquery-is-a-monad/
 [4]: http://www.haskell.org/all_about_monads/html/analogy.html


text:
package margo_pkg

import (
	"go/ast"
	"go/build"
	"go/parser"
	"gosublime/margo"
	"gosublime/margo/meth/importpaths"
	"path/filepath"
)

type mImportPaths struct {
	Fn            string
	Src           string
	Env           map[string]string
	InstallSuffix string
}

type mImportPathsDecl struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

func (m *mImportPaths) Call() (interface{}, string) {
	imports := []mImportPathsDecl{}
	_, af, err := parseAstFile(m.Fn, m.Src, parser.ImportsOnly)
	if err != nil {
		return M{}, err.Error()
	}

	if m.Fn != "" || m.Src != "" {
		for _, decl := range af.Decls {
			if gdecl, ok := decl.(*ast.GenDecl); ok && len(gdecl.Specs) > 0 {
				for _, spec := range gdecl.Specs {
					if ispec, ok := spec.(*ast.ImportSpec); ok {
						sd := mImportPathsDecl{
							Path: unquote(ispec.Path.Value),
						}
						if ispec.Name != nil {
							sd.Name = ispec.Name.String()
						}
						imports = append(imports, sd)
					}
				}
			}
		}
	}

	bctx := build.Default
	bctx.GOROOT = orString(m.Env["GOROOT"], bctx.GOROOT)
	bctx.GOPATH = orString(m.Env["GOPATH"], bctx.GOPATH)
	bctx.InstallSuffix = m.InstallSuffix
	srcDir, _ := filepath.Split(m.Fn)

	res := M{
		"imports": imports,
		"paths":   margo.Options().ImportPaths(srcDir, &bctx),
	}
	return res, ""
}

func init() {
	margo.Configure(func(o *margo.Opts) {
		if o.ImportPaths == nil {
			o.ImportPaths = importpaths.MakeImportPathsFunc(importpaths.PathFilter)
		}
	})

	registry.Register("import_paths", func(_ *Broker) Caller {
		return &mImportPaths{
			Env: map[string]string{},
		}
	})
}


text:
package org.opencb.opencga.app.cli.analysis;

import com.beust.jcommander.*;
import com.beust.jcommander.converters.CommaParameterSplitter;
import org.opencb.biodata.models.variant.VariantSource;
import org.opencb.commons.utils.CommandLineUtils;
import org.opencb.opencga.app.cli.GeneralCliOptions;
import org.opencb.opencga.core.common.GitRepositoryState;
import org.opencb.opencga.storage.core.variant.VariantStorageManager;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * Created by imedina on 02/03/15.
 */
public class AnalysisCliOptionsParser {

    private final JCommander jCommander;

    private final GeneralCliOptions.GeneralOptions generalOptions;
    private final AnalysisCommonCommandOptions commonCommandOptions;

    private ExpressionCommandOptions expressionCommandOptions;
    private FunctionalCommandOptions functionalCommandOptions;
    private VariantCommandOptions variantCommandOptions;
    private ToolsCommandOptions toolsCommandOptions;
    private AlignmentCommandOptions alignmentCommandOptions;

    public AnalysisCliOptionsParser() {
        generalOptions = new GeneralCliOptions.GeneralOptions();

        jCommander = new JCommander(generalOptions);
        jCommander.setProgramName("opencga-analysis.sh");

        commonCommandOptions = new AnalysisCommonCommandOptions();

        expressionCommandOptions = new ExpressionCommandOptions();
        jCommander.addCommand("expression", expressionCommandOptions);
        JCommander auditSubCommands = jCommander.getCommands().get("expression");
        auditSubCommands.addCommand("diff", expressionCommandOptions.diffExpressionCommandOptions);
        auditSubCommands.addCommand("clustering", expressionCommandOptions.clusteringExpressionCommandOptions);

        functionalCommandOptions = new FunctionalCommandOptions();
        jCommander.addCommand("functional", functionalCommandOptions);
        JCommander usersSubCommands = jCommander.getCommands().get("functional");
        usersSubCommands.addCommand("fatigo", functionalCommandOptions.fatigoFunctionalCommandOptions);
        usersSubCommands.addCommand("gene-set", functionalCommandOptions.genesetFunctionalCommandOptions);

        variantCommandOptions = new VariantCommandOptions();
        jCommander.addCommand("variant", variantCommandOptions);
        JCommander variantSubCommands = jCommander.getCommands().get("variant");
        variantSubCommands.addCommand("index", variantCommandOptions.indexVariantCommandOptions);
        variantSubCommands.addCommand("stats", variantCommandOptions.statsVariantCommandOptions);
        variantSubCommands.addCommand("annotate", variantCommandOptions.annotateVariantCommandOptions);
        variantSubCommands.addCommand("query", variantCommandOptions.queryVariantCommandOptions);
        variantSubCommands.addCommand("export-frequencies", variantCommandOptions.exportVariantStatsCommandOptions);
        variantSubCommands.addCommand("ibs", variantCommandOptions.ibsVariantCommandOptions);

        alignmentCommandOptions = new AlignmentCommandOptions();
        jCommander.addCommand("alignment", alignmentCommandOptions);
        JCommander alignmentSubCommands = jCommander.getCommands().get("alignment");
        alignmentSubCommands.addCommand("index", alignmentCommandOptions.indexAlignmentCommandOptions);
        alignmentSubCommands.addCommand("query", alignmentCommandOptions.queryAlignmentCommandOptions);
//        alignmentSubCommands.addCommand("stats", alignmentCommandOptions.statsVariantCommandOptions);
//        alignmentSubCommands.addCommand("annotate", alignmentCommandOptions.annotateVariantCommandOptions);

        toolsCommandOptions = new ToolsCommandOptions();
        jCommander.addCommand("tools", toolsCommandOptions);
        JCommander toolsSubCommands = jCommander.getCommands().get("tools");
        toolsSubCommands.addCommand("install", toolsCommandOptions.installToolCommandOptions);
        toolsSubCommands.addCommand("list", toolsCommandOptions.listToolCommandOptions);
        toolsSubCommands.addCommand("show", toolsCommandOptions.showToolCommandOptions);
    }

    public void parse(String[] args) throws ParameterException {
        jCommander.parse(args);
    }

    public String getCommand() {
        return (jCommander.getParsedCommand() != null) ? jCommander.getParsedCommand() : "";
    }

    public String getSubCommand() {
        String parsedCommand = jCommander.getParsedCommand();
        if (jCommander.getCommands().containsKey(parsedCommand)) {
            String subCommand = jCommander.getCommands().get(parsedCommand).getParsedCommand();
            return subCommand != null ? subCommand: "";
        } else {
            return null;
        }
    }

    public boolean isHelp() {
        String parsedCommand = jCommander.getParsedCommand();
        if (parsedCommand != null) {
            JCommander jCommander2 = jCommander.getCommands().get(parsedCommand);
            List<Object> objects = jCommander2.getObjects();
            if (!objects.isEmpty() && objects.get(0) instanceof GeneralCliOptions.CommonCommandOptions) {
                return ((GeneralCliOptions.CommonCommandOptions) objects.get(0)).help;
            }
        }
        return commonCommandOptions.help;
    }

    /**
     * This class contains all those parameters available for all 'commands'
     */
    public class CommandOptions {

        @Parameter(names = {"-h", "--help"},  description = "This parameter prints this help", help = true)
        public boolean help;

        public JCommander getSubCommand() {
            return jCommander.getCommands().get(getCommand()).getCommands().get(getSubCommand());
        }

        public String getParsedSubCommand() {
            String parsedCommand = jCommander.getParsedCommand();
            if (jCommander.getCommands().containsKey(parsedCommand)) {
                String subCommand = jCommander.getCommands().get(parsedCommand).getParsedCommand();
                return subCommand != null ? subCommand: "";
            } else {
                return "";
            }
        }
    }

    /**
     * This class contains all those common parameters available for all 'subcommands'
     */
    public class AnalysisCommonCommandOptions extends GeneralCliOptions.CommonCommandOptions {

        @Parameter(names = {"--sid", "--session-id"}, description = "Token session id", arity = 1)
        public String sessionId;

        @Parameter(names = {"-u", "--user"}, description = "User name", arity = 1)
        public String user;

        @Parameter(names = {"-p", "--password"}, description = "User password", password = true, arity = 0)
        public String password;

        @DynamicParameter(names = "-D", description = "Storage engine specific parameters go here comma separated, ie. -Dmongodb" +
                ".compression=snappy", hidden = false)
        public Map<String, String> params = new HashMap<>(); //Dynamic parameters must be initialized

    }

    /*
     * Expression CLI options
     */
    @Parameters(commandNames = {"expression"}, commandDescription = "Implement gene expression analysis tools")
    public class ExpressionCommandOptions extends CommandOptions {

        DiffExpressionCommandOptions diffExpressionCommandOptions;
        ClusteringExpressionCommandOptions clusteringExpressionCommandOptions;

        AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        public ExpressionCommandOptions() {
            this.diffExpressionCommandOptions = new DiffExpressionCommandOptions();
            this.clusteringExpressionCommandOptions = new ClusteringExpressionCommandOptions();
        }
    }

    /*
     * Functional CLI options
     */
    @Parameters(commandNames = {"functional"}, commandDescription = "Implement functional genomic analysis tools")
    public class FunctionalCommandOptions extends CommandOptions {

        FatigoFunctionalCommandOptions fatigoFunctionalCommandOptions;
        GenesetFunctionalCommandOptions genesetFunctionalCommandOptions;

        AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        public FunctionalCommandOptions() {
            this.fatigoFunctionalCommandOptions = new FatigoFunctionalCommandOptions();
            this.genesetFunctionalCommandOptions = new GenesetFunctionalCommandOptions();
        }
    }

    /*
     * Variant CLI options
     */
    @Parameters(commandNames = {"variant"}, commandDescription = "Implement several tools for the genomic variant analysis")
    public class VariantCommandOptions extends CommandOptions {

        final IndexVariantCommandOptions indexVariantCommandOptions;
        final StatsVariantCommandOptions statsVariantCommandOptions;
        final AnnotateVariantCommandOptions annotateVariantCommandOptions;
        final QueryVariantCommandOptions queryVariantCommandOptions;
        final ExportVariantStatsCommandOptions exportVariantStatsCommandOptions;
        final IbsVariantCommandOptions ibsVariantCommandOptions;
        final DeleteVariantCommandOptions deleteVariantCommandOptions;

        AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        public VariantCommandOptions() {
            this.indexVariantCommandOptions = new IndexVariantCommandOptions();
            this.statsVariantCommandOptions = new StatsVariantCommandOptions();
            this.annotateVariantCommandOptions = new AnnotateVariantCommandOptions();
            this.queryVariantCommandOptions = new QueryVariantCommandOptions();
            this.exportVariantStatsCommandOptions = new ExportVariantStatsCommandOptions();
            this.ibsVariantCommandOptions = new IbsVariantCommandOptions();
            this.deleteVariantCommandOptions = new DeleteVariantCommandOptions();
        }
    }

    /*
     * Alignment CLI options
     */
    @Parameters(commandNames = {"alignment"}, commandDescription = "Implement several tools for the genomic alignment analysis")
    public class AlignmentCommandOptions extends CommandOptions {

        final IndexAlignmentCommandOptions indexAlignmentCommandOptions;
        final QueryAlignmentCommandOptions queryAlignmentCommandOptions;
//        final StatsVariantCommandOptions statsVariantCommandOptions;
//        final AnnotateVariantCommandOptions annotateVariantCommandOptions;
//        final DeleteVariantCommandOptions deleteVariantCommandOptions;

        AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        public AlignmentCommandOptions() {
            this.indexAlignmentCommandOptions = new IndexAlignmentCommandOptions();
            this.queryAlignmentCommandOptions = new QueryAlignmentCommandOptions();
        }
    }

    /*
     * Tools CLI options
     */
    @Parameters(commandNames = {"tools"}, commandDescription = "Implements different tools for working with tools")
    public class ToolsCommandOptions extends CommandOptions {

        InstallToolCommandOptions installToolCommandOptions;
        ListToolCommandOptions listToolCommandOptions;
        ShowToolCommandOptions showToolCommandOptions;

        AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        public ToolsCommandOptions() {
            this.installToolCommandOptions = new InstallToolCommandOptions();
            this.listToolCommandOptions = new ListToolCommandOptions();
            this.showToolCommandOptions = new ShowToolCommandOptions();
        }
    }

    /**
     * Auxiliary class for Database connection.
     */
    class CatalogDatabaseCommandOptions {

    }

    /*
     * EXPRESSION SUB-COMMANDS
     */
    @Parameters(commandNames = {"diff"}, commandDescription = "Query audit data from Catalog database")
    public class DiffExpressionCommandOptions extends CatalogDatabaseCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        @Parameter(names = {"--filter"}, description = "Query filter for data")
        public String filter;
    }

    @Parameters(commandNames = {"clustering"}, commandDescription = "Print summary stats for an user")
    public class ClusteringExpressionCommandOptions extends CatalogDatabaseCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;
    }

    /*
     * USER SUB-COMMANDS
     */

    @Parameters(commandNames = {"fatigo"}, commandDescription = "Create a new user in Catalog database and the workspace")
    public class FatigoFunctionalCommandOptions extends CatalogDatabaseCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        @Parameter(names = {"--user-id"}, description = "Full name of the study where the file is classified", required = true, arity = 1)
        public String userId;

    }

    @Parameters(commandNames = {"gene-set"}, commandDescription = "Delete the user Catalog database entry and the workspace")
    public class GenesetFunctionalCommandOptions extends CatalogDatabaseCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        @Parameter(names = {"--user-id"}, description = "Full name of the study where the file is classified", required = true, arity = 1)
        public String userId;

    }

    public class JobCommand {
        @Parameter(names = {"--queue"}, description = "Enqueue the job. Do not execute", required = false, arity = 0)
        public boolean queue = false;

        @Parameter(names = {"--job-id"}, description = "Job id", hidden = true,required = false, arity = 1)
        public String jobId = null;
    }

    /*
     *  Variant SUB-COMMANDS
     */

    @Parameters(commandNames = {"index"}, commandDescription = "Index variants file")
    public class IndexVariantCommandOptions extends CatalogDatabaseCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        @ParametersDelegate
        public JobCommand job = new JobCommand();

//
//        @Parameter(names = {"-i", "--input"}, description = "File to index in the selected backend", required = true, variableArity = true)
//        public List<String> input;

//        @Parameter(names = {"-o", "--outdir"}, description = "Directory where output files will be saved (optional)", arity = 1, required = false)
//        public String outdir;

//        @Parameter(names = {"--file-id"}, description = "Unique ID for the file", required = true, arity = 1)
//        public String fileId;

        @Parameter(names = {"--transform"}, description = "If present it only runs the transform stage, no load is executed")
        public boolean transform = false;

        @Parameter(names = {"--load"}, description = "If present only the load stage is executed, transformation is skipped")
        public boolean load = false;

//        @Parameter(names = {"--overwrite"}, description = "Reset the database if exists before installing")
//        public boolean overwrite;

//        @Parameter(names = {"--study-id"}, description = "Unque ID for the study", arity = 1)
//        public long studyId;

        @Parameter(names = {"--file-id"}, description = "CSV of file ids to be indexed", required = true, arity = 1)
        public String fileId = null;

        @Parameter(names = {"--transformed-files"}, description = "CSV of paths corresponding to the location of the transformed files.",
                required = false, arity = 1)
        public String transformedPaths = null;

        @Parameter(names = {"-o", "--outdir"}, description = "Output directory outside catalog boundaries.", required = true, arity = 1)
        public String outdir = null;

        @Parameter(names = {"--path"}, description = "Path within catalog boundaries where the results will be stored. If not present, "
                + "transformed files will not be registered in catalog.", required = false, arity = 1)
        public String catalogPath = null;

        @Parameter(names = {"--exclude-genotypes"}, description = "Index excluding the genotype information")
        public boolean excludeGenotype = false;

        @Parameter(names = {"--include-extra-fields"}, description = "Index including other genotype fields [CSV]")
        public String extraFields = "";

        @Parameter(names = {"--aggregated"}, description = "Select the type of aggregated VCF file: none, basic, EVS or ExAC", arity = 1)
        public VariantSource.Aggregation aggregated = VariantSource.Aggregation.NONE;

        @Parameter(names = {"--aggregation-mapping-file"}, description = "File containing population names mapping in an aggregated VCF " +
                "file")
        public String aggregationMappingFile = null;

        @Parameter(names = {"--gvcf"}, description = "The input file is in gvcf format")
        public boolean gvcf;

        @Parameter(names = {"--bgzip"}, description = "[PENDING] The input file is in bgzip format")
        public boolean bgzip;

        @Parameter(names = {"--calculate-stats"}, description = "Calculate indexed variants statistics after the load step")
        public boolean calculateStats = false;

        @Parameter(names = {"--annotate"}, description = "Annotate indexed variants after the load step")
        public boolean annotate = false;

        @Parameter(names = {"--annotator"}, description = "Annotation source {cellbase_rest, cellbase_db_adaptor}")
        public org.opencb.opencga.storage.core.variant.annotation.VariantAnnotationManager.AnnotationSource annotator = null;

        @Parameter(names = {"--overwrite-annotations"}, description = "Overwrite annotations in variants already present")
        public boolean overwriteAnnotations;

    }

    @Parameters(commandNames = {"stats"}, commandDescription = "Create and load stats into a database.")
    public class StatsVariantCommandOptions extends CatalogDatabaseCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        @ParametersDelegate
        public JobCommand job = new JobCommand();

//        @Parameter(names = {"--create"}, description = "Run only the creation of the stats to a file")
//        public boolean create = false;
//
//        @Parameter(names = {"--load"}, description = "Load the stats from an already existing FILE directly into the database. FILE is a "
//                + "prefix with structure <INPUT_FILENAME>.<TIME>")
//        public boolean load = false;

        @Parameter(names = {"--overwrite-stats"}, description = "[PENDING] Overwrite stats in variants already present")
        public boolean overwriteStats = false;

        @Parameter(names = {"--region"}, description = "Region to calculate.")
        public String region;

        @Parameter(names = {"--update-stats"}, description = "Calculate stats just for missing positions. "
                + "Assumes that existing stats are correct")
        public boolean updateStats = false;

        @Parameter(names = {"-s", "--study-id"}, description = "Unique ID for the study where the file is classified", required = true,
                arity = 1)
        public String studyId;

        @Parameter(names = {"-f", "--file-id"}, description = "Calculate stats only for the selected file", required = false, arity = 1)
        public String fileId;

        @Parameter(names = {"--cohort-ids"}, description = "Cohort Ids for the cohorts to be calculated.")
        String cohortIds;

        // FIXME: Hidden?
        @Parameter(names = {"--output-filename"}, description = "Output file name. Default: database name", required = false, arity = 1)
        public String fileName;

//        @Parameter(names = {"--outdir-id"}, description = "Output directory", required = false, arity = 1)
//        public String outdirId;

        @Parameter(names = {"-o", "--outdir"}, description = "Output directory outside catalog boundaries.", required = true, arity = 1)
        public String outdir = null;

        @Parameter(names = {"--path"}, description = "Path within catalog boundaries where the results will be stored. If not present, "
                + "transformed files will not be registered in catalog.", required = false, arity = 1)
        public String catalogPath = null;

//        @Parameter(names = {"-o", "--outdir"}, description = "Output directory.", required = false, arity = 1)
//        public String outdir = ".";

        @Parameter(names = {"--aggregated"}, description = "Aggregated VCF File: basic or EVS (optional)", arity = 1)
        VariantSource.Aggregation aggregated = VariantSource.Aggregation.NONE;

        @Parameter(names = {"--aggregation-mapping-file"}, description = "File containing population names mapping in an aggregated VCF file")
        public String aggregationMappingFile;

    }

    @Parameters(commandNames = {"annotate"}, commandDescription = "Create and load variant annotations into the database")
    public class AnnotateVariantCommandOptions extends CatalogDatabaseCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        @ParametersDelegate
        public JobCommand job = new JobCommand();

        @Parameter(names = {"-s", "--study-id"}, description = "Unique ID for the study where the file is classified", required = true,
                arity = 1)
        public String studyId;

        @Parameter(names = {"-o", "--outdir-id"}, description = "Output directory", required = false, arity = 1)
        public String outdirId;

        @Parameter(names = {"--create"}, description = "Run only the creation of the annotations to a file (specified by --output-filename)")
        public boolean create = false;

        @Parameter(names = {"--load"}, description = "Run only the load of the annotations into the DB from FILE")
        public String load = null;

        @Parameter(names = {"--custom-name"}, description = "Provide a name to the custom annotation")
        public String customAnnotationKey = null;

        @Parameter(names = {"--annotator"}, description = "Annotation source {cellbase_rest, cellbase_db_adaptor}")
        public org.opencb.opencga.storage.core.variant.annotation.VariantAnnotationManager.AnnotationSource annotator;

        @Parameter(names = {"--overwrite-annotations"}, description = "Overwrite annotations in variants already present")
        public boolean overwriteAnnotations = false;

        @Parameter(names = {"--output-filename"}, description = "Output file name. Default: dbName", required = false, arity = 1)
        public String fileName;

        @Parameter(names = {"--species"}, description = "Species. Default hsapiens", required = false, arity = 1)
        public String species = "hsapiens";

        @Parameter(names = {"--assembly"}, description = "Assembly. Default GRCh37", required = false, arity = 1)
        public String assembly = "GRCh37";

        @Parameter(names = {"--filter-region"}, description = "Comma separated region filters", splitter = CommaParameterSplitter.class)
        public List<String> filterRegion;

        @Parameter(names = {"--filter-chromosome"}, description = "Comma separated chromosome filters", splitter = CommaParameterSplitter.class)
        public List<String> filterChromosome;

        @Parameter(names = {"--filter-gene"}, description = "Comma separated gene filters", splitter = CommaParameterSplitter.class)
        public String filterGene;

        @Parameter(names = {"--filter-annot-consequence-type"}, description = "Comma separated annotation consequence type filters",
                splitter = CommaParameterSplitter.class)
        public List filterAnnotConsequenceType = null; // TODO will receive CSV, only available when create annotations

    }

    @Parameters(commandNames = {"query"}, commandDescription = "Search over indexed variants")
    public class QueryVariantCommandOptions extends QueryCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        @Parameter(names = {"--id"}, description = "CSV list of variant ids", required = false)
        public String id;

        @Parameter(names = {"--group-by"}, description = "Group by gene, ensemblGene or consequence_type", required = false)
        public String groupBy;

        @Parameter(names = {"--rank"}, description = "Rank variants by gene, ensemblGene or consequence_type", required = false)
        public String rank;

        @Parameter(names = {"-s", "--study"}, description = "A comma separated list of studies to be used as filter", required = false)
        public String study;

        @Parameter(names = {"--sample-genotype"}, description = "A comma separated list of samples from the SAME study, example: " +
                "NA0001:0/0,0/1;NA0002:0/1", required = false, arity = 1)
        public String sampleGenotype;

        @Deprecated
        @Parameter(names = {"-f", "--file"}, description = "A comma separated list of files to be used as filter", required = false, arity = 1)
        public String file;

        @Parameter(names = {"-t", "--type"}, description = "Whether the variant is a: SNV, INDEL or SV", required = false)
        public String type;

//        @Parameter(names = {"--include-annotations"}, description = "Add variant annotation to the INFO column", required = false,
// arity = 0)
//        public boolean includeAnnotations;

        @Parameter(names = {"--annotations"}, description = "Set variant annotation to return in the INFO column. " +
                "Accepted values include 'all', 'default' aor a comma-separated list such as 'gene,biotype,consequenceType'", required = false, arity = 1)
        public String annotations;

        @Parameter(names = {"--ct", "--consequence-type"}, description = "Consequence type SO term list. example: SO:0000045,SO:0000046",
                required = false, arity = 1)
        public String consequenceType;

        @Parameter(names = {"--biotype"}, description = "Biotype CSV", required = false, arity = 1)
        public String biotype;

        @Parameter(names = {"--pf", "--population-frequency"}, description = "Alternate Population Frequency: " +
                "{study}:{population}[<|>|<=|>=]{number}", required = false, arity = 1)
        public String populationFreqs;

        @Parameter(names = {"--pmaf", "--population-maf"}, description = "Population minor allele frequency: " +
                "{study}:{population}[<|>|<=|>=]{number}", required = false, arity = 1)
        public String populationMaf;

        @Parameter(names = {"--conservation"}, description = "Conservation score: {conservation_score}[<|>|<=|>=]{number} example: " +
                "phastCons>0.5,phylop<0.1", required = false, arity = 1)
        public String conservation;

        @Parameter(names = {"--transcript-flag"}, description = "List of transcript annotation flags. e.g. CCDS, basic, cds_end_NF, mRNA_end_NF, cds_start_NF, mRNA_start_NF, seleno", required = false, arity = 1)
        public String flags;

        @Parameter(names = {"--gene-trait-id"}, description = "List of gene trait association names. e.g. \"Cardiovascular Diseases\"", required = false, arity = 1)
        public String geneTraitId;

        @Parameter(names = {"--gene-trait-name"}, description = "List of gene trait association id. e.g. \"umls:C0007222\" , \"OMIM:269600\"", required = false, arity = 1)
        public String geneTraitName;

        @Parameter(names = {"--hpo"}, description = "List of HPO terms. e.g. \"HP:0000545\" , \"HP:0002812\"", required = false, arity = 1)
        public String hpo;

        @Parameter(names = {"--go"}, description = "List of GO (Genome Ontology) terms. e.g. \"GO:0002020\"", required = false, arity = 1)
        public String go;

        @Parameter(names = {"--expression"}, description = "List of tissues of interest. e.g. \"tongue\"", required = false, arity = 1)
        public String expression;

        @Parameter(names = {"--protein-keywords"}, description = "List of protein variant annotation keywords", required = false, arity = 1)
        public String proteinKeywords;

        @Parameter(names = {"--drug"}, description = "List of drug names", required = false, arity = 1)
        public String drugs;

        @Parameter(names = {"--ps", "--protein-substitution"}, description = "Protein substitution score. [<|>|<=|>=]{number} or [~=|=|]{description} e.g. <=0.9,benign", required = false, arity = 1)
        public String proteinSubstitution;

        @Parameter(names = {"--gwas"}, description = "[PENDING]", required = false, arity = 1)
        public String gwas;

        @Parameter(names = {"--cosmic"}, description = "[PENDING]", required = false, arity = 1)
        public String cosmic;

        @Parameter(names = {"--clinvar"}, description = "[PENDING]", required = false, arity = 1)
        public String clinvar;

        @Deprecated
        @Parameter(names = {"--stats"}, description = " [CSV]", required = false)
        public String stats;

        @Parameter(names = {"--maf"}, description = "Take a <STUDY>:<COHORT> and filter by Minor Allele Frequency, example: 1000g:all>0.4", required = false)
        public String maf;

        @Parameter(names = {"--mgf"}, description = "Take a <STUDY>:<COHORT> and filter by Minor Genotype Frequency, example: " +
                "1000g:all<=0.4", required = false)
        public String mgf;

        @Parameter(names = {"--missing-allele"}, description = "Take a <STUDY>:<COHORT> and filter by number of missing alleles, example:" +
                " 1000g:all=5", required = false)
        public String missingAlleleCount;

        @Parameter(names = {"--missing-genotype"}, description = "Take a <STUDY>:<COHORT> and filter by number of missing genotypes, " +
                "example: 1000g:all!=0", required = false)
        public String missingGenotypeCount;

        @Parameter(names = {"--dominant"}, description = "[PENDING] Take a family in the form of: FATHER,MOTHER,CHILD and specifies if is" +
                " affected or not to filter by dominant segregation, example: 1000g:NA001:aff,1000g:NA002:unaff,1000g:NA003:aff",
                required = false)
        public String dominant;

        @Parameter(names = {"--recessive"}, description = "[PENDING] Take a family in the form of: FATHER,MOTHER,CHILD and specifies if " +
                "is affected or not to filter by recessive segregation, example: 1000g:NA001:aff,1000g:NA002:unaff,1000g:NA003:aff",
                required = false)
        public String recessive;

        @Parameter(names = {"--ch", "--compound-heterozygous"}, description = "[PENDING] Take a family in the form of: FATHER,MOTHER," +
                "CHILD and specifies if is affected or not to filter by compound heterozygous, example: 1000g:NA001:aff," +
                "1000g:NA002:unaff,1000g:NA003:aff", required = false)
        public String compoundHeterozygous;

        @Parameter(names = {"--return-study"}, description = "A comma separated list of studies to be returned", required = false)
        public String returnStudy;

        @Parameter(names = {"--return-sample"}, description = "A comma separated list of samples from the SAME study to be returned", required = false)
        public String returnSample;

        @Parameter(names = {"--unknown-genotype"}, description = "Returned genotype for unknown genotypes. Common values: [0/0, 0|0, ./.]", required = false)
        public String unknownGenotype = "./.";

        @Parameter(names = {"--of", "--output-format"}, description = "Output format: vcf, vcf.gz, json or json.gz", required = false, arity = 1)
        public String outputFormat = "vcf";

    }

    class QueryCommandOptions {

        @Parameter(names = {"-o", "--output"}, description = "Output file. [STDOUT]", required = false, arity = 1)
        public String output;

        @Parameter(names = {"-r", "--region"}, description = "CSV list of regions: {chr}[:{start}-{end}]. example: 2,3:1000000-2000000",
                required = false)
        public String region;

        @Parameter(names = {"--region-file"}, description = "GFF File with regions", required = false)
        public String regionFile;

        @Parameter(names = {"-g", "--gene"}, description = "CSV list of genes", required = false)
        public String gene;

        @Parameter(names = {"-i", "--include"}, description = "", required = false, arity = 1)
        public String include;

        @Parameter(names = {"-e", "--exclude"}, description = "", required = false, arity = 1)
        public String exclude;

        @Parameter(names = {"--skip"}, description = "Skip some number of elements.", required = false, arity = 1)
        public int skip;

        @Parameter(names = {"--limit"}, description = "Limit the number of returned elements.", required = false, arity = 1)
        public int limit;

        @Parameter(names = {"--sort"}, description = "Sort the output variants.")
        public boolean sort;

        @Parameter(names = {"--count"}, description = "Count results. Do not return elements.", required = false, arity = 0)
        public boolean count;

    }

    @Parameters(commandNames = {"export-frequencies"}, commandDescription = "Export calculated variant stats and frequencies")
    public class ExportVariantStatsCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        @ParametersDelegate
        public QueryCommandOptions queryOptions = new QueryCommandOptions();

        @Parameter(names = {"--of", "--output-format"}, description = "Output format: vcf, vcf.gz, tsv, tsv.gz, cellbase, cellbase.gz, json or json.gz", required = false, arity = 1)
        public String outputFormat = "tsv";

        @Parameter(names = {"-s", "--study"}, description = "A comma separated list of studies to be returned", required = false)
        public String studies;

    }

    @Parameters(commandNames = {"ibs"}, commandDescription = "[PENDING] ")
    public class IbsVariantCommandOptions extends CatalogDatabaseCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

    }

    @Parameters(commandNames = {"delete"}, commandDescription = "[PENDING] Delete an indexed file from the Database")
    public class DeleteVariantCommandOptions extends CatalogDatabaseCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        @Parameter(names = {"--file-id"}, description = "File to delete")
        public boolean reset;
    }

    /*
     *  ALIGNMENT SUB-COMMANDS
     */

    @Parameters(commandNames = {"index-alignments"}, commandDescription = "Index alignment file")
    public class IndexAlignmentCommandOptions extends CatalogDatabaseCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        @ParametersDelegate
        public JobCommand job = new JobCommand();

        @Parameter(names = {"-i", "--file-id"}, description = "Unique ID for the file", required = true, arity = 1)
        public String fileId;

        @Parameter(names = "--calculate-coverage", description = "Calculate coverage while indexing")
        public boolean calculateCoverage = true;

        @Parameter(names = "--mean-coverage", description = "Specify the chunk sizes to calculate average coverage. Only works if flag " +
                "\"--calculate-coverage\" is also given. Please specify chunksizes as CSV: --mean-coverage 200,400", required = false)
        public List<String> meanCoverage;

        @Parameter(names = {"-o", "--outdir-id"}, description = "Directory where output files will be saved (optional)", arity = 1, required = false)
        public String outdirId;

        @Parameter(names = {"--transform"}, description = "If present it only runs the transform stage, no load is executed")
        boolean transform = false;

        @Parameter(names = {"--load"}, description = "If present only the load stage is executed, transformation is skipped")
        boolean load = false;

    }

    @Parameters(commandNames = {"query"}, commandDescription = "Search over indexed alignments")
    public class QueryAlignmentCommandOptions extends QueryCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        @Parameter(names = {"-s", "--study"}, description = "A comma separated list of studies to be used as filter", required = false)
        public String study;

        @Parameter(names = {"--file-id"}, description = "File unique ID.", required = false, arity = 1)
        public String fileId;
//
//        @Parameter(names = {"--file-path"}, description = "", required = false, arity = 1)
//        public String filePath;

        @Parameter(names = {"--include-coverage"}, description = " [CSV]", required = false)
        public boolean coverage = false;

        @Parameter(names = {"-H", "--histogram"}, description = " ", required = false, arity = 1)
        public boolean histogram = false;

        @Parameter(names = {"--view-as-pairs"}, description = " ", required = false)
        public boolean asPairs;

        @Parameter(names = {"--process-differences"}, description = " ", required = false)
        public boolean processDifferences;

        @Parameter(names = {"-S", "--stats-filter"}, description = " [CSV]", required = false)
        public List<String> stats = new LinkedList<>();
    }

    /*
     *  Tools SUB-COMMANDS
     */

    @Parameters(commandNames = {"install"}, commandDescription = "Install and check a new tool")
    public class InstallToolCommandOptions extends CatalogDatabaseCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        @Parameter(names = {"-i", "--input"}, description = "File with the new tool to be installed", required = true, arity = 1)
        public String study;

    }

    @Parameters(commandNames = {"list"}, commandDescription = "Print a summary list of all tools")
    public class ListToolCommandOptions extends CatalogDatabaseCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        @Parameter(names = {"--filter"}, description = "Some kind of filter", arity = 1)
        public String study;

    }

    @Parameters(commandNames = {"show"}, commandDescription = "Show a summary of the tool")
    public class ShowToolCommandOptions extends CatalogDatabaseCommandOptions {

        @ParametersDelegate
        public AnalysisCommonCommandOptions commonOptions = AnalysisCliOptionsParser.this.commonCommandOptions;

        @Parameter(names = {"--tool-id"}, description = "Full name of the study where the file is classified", arity = 1)
        public String study;

    }

    public void printUsage() {
        String parsedCommand = getCommand();
        if (parsedCommand.isEmpty()) {
            System.err.println("");
            System.err.println("Program:     OpenCGA (OpenCB)");
            System.err.println("Version:     " + GitRepositoryState.get().getBuildVersion());
            System.err.println("Git commit:  " + GitRepositoryState.get().getCommitId());
            System.err.println("Description: Big Data platform for processing and analysing NGS data");
            System.err.println("");
            System.err.println("Usage:       opencga-analysis.sh [-h|--help] [--version] <command> [options]");
            System.err.println("");
            System.err.println("Commands:");
            printMainUsage();
            System.err.println("");
        } else {
            String parsedSubCommand = getSubCommand();
            if (parsedSubCommand.isEmpty()) {
                System.err.println("");
                System.err.println("Usage:   opencga-analysis.sh " + parsedCommand + " <subcommand> [options]");
                System.err.println("");
                System.err.println("Subcommands:");
                printCommands(jCommander.getCommands().get(parsedCommand));
                System.err.println("");
            } else {
                System.err.println("");
                System.err.println("Usage:   opencga-analysis.sh " + parsedCommand + " " + parsedSubCommand + " [options]");
                System.err.println("");
                System.err.println("Options:");
                CommandLineUtils.printCommandUsage(jCommander.getCommands().get(parsedCommand).getCommands().get(parsedSubCommand));
                System.err.println("");
            }
        }
    }

    private void printMainUsage() {
        for (String s : jCommander.getCommands().keySet()) {
            System.err.printf("%14s  %s\n", s, jCommander.getCommandDescription(s));
        }
    }

    private void printCommands(JCommander commander) {
        for (Map.Entry<String, JCommander> entry : commander.getCommands().entrySet()) {
            System.err.printf("%14s  %s\n", entry.getKey(), commander.getCommandDescription(entry.getKey()));
        }
    }

    public GeneralCliOptions.GeneralOptions getGeneralOptions() {
        return generalOptions;
    }

    public AnalysisCommonCommandOptions getCommonOptions() {
        return commonCommandOptions;
    }

    public VariantCommandOptions getVariantCommandOptions() {
        return variantCommandOptions;
    }

    public FunctionalCommandOptions getFunctionalCommandOptions() {
        return functionalCommandOptions;
    }

    public ExpressionCommandOptions getExpressionCommandOptions() {
        return expressionCommandOptions;
    }

    public ToolsCommandOptions getToolsCommandOptions() {
        return toolsCommandOptions;
    }

    public AlignmentCommandOptions getAlignmentCommandOptions() {
        return alignmentCommandOptions;
    }

}