import ceylon.language.meta.declaration { Module }
import ceylon.test { test, assertEquals }
import ceylon.build.runner { findTopLevelAnnotatedGoals, findAnnotatedIncludes }
import mock.ceylon.build.runner.mock4 { include1, include2 }
import mock.ceylon.build.runner.mock4.subpackage { include3 }

test void shouldNotFindIncludeAnnotatedValuesIfNoPackage() {
    Module mod = `module mock.ceylon.build.runner.mock1`;
    value results = findTopLevelAnnotatedGoals(mod);
    assertEquals(results, []);
}

test void shouldNotFindIncludeAnnotatedValuesInEmptyPackages() {
    Module mod = `module mock.ceylon.build.runner.mock2`;
    value results = findTopLevelAnnotatedGoals(mod);
    assertEquals(results, []);
}

test void shouldNotFindIncludeAnnotatedValuesIfNoValuesAnnotatedWithIt() {
    Module mod = `module mock.ceylon.build.runner.mock3`;
    value results = findTopLevelAnnotatedGoals(mod);
    assertEquals(results, []);
}

test void shouldFindIncludeAnnotatedValues() {
    Module mod = `module mock.ceylon.build.runner.mock4`;
    value results = [].chain(findAnnotatedIncludes(mod));
    value expected = [`value include1`, `value include2`, `value include3`];
    assertEquals(results, expected);
}

Fix unstable test by not checking collections order

import ceylon.build.runner {
	findTopLevelAnnotatedGoals,
	findAnnotatedIncludes
}
import ceylon.collection {
	HashSet
}
import ceylon.language.meta.declaration {
	Module,
	ValueDeclaration
}
import ceylon.test {
	test,
	assertEquals
}

import mock.ceylon.build.runner.mock4 {
	include1,
	include2
}
import mock.ceylon.build.runner.mock4.subpackage {
	include3
}

test void shouldNotFindIncludeAnnotatedValuesIfNoPackage() {
    Module mod = `module mock.ceylon.build.runner.mock1`;
    value results = findTopLevelAnnotatedGoals(mod);
    assertEquals(results, []);
}

test void shouldNotFindIncludeAnnotatedValuesInEmptyPackages() {
    Module mod = `module mock.ceylon.build.runner.mock2`;
    value results = findTopLevelAnnotatedGoals(mod);
    assertEquals(results, []);
}

test void shouldNotFindIncludeAnnotatedValuesIfNoValuesAnnotatedWithIt() {
    Module mod = `module mock.ceylon.build.runner.mock3`;
    value results = findTopLevelAnnotatedGoals(mod);
    assertEquals(results, []);
}

test void shouldFindIncludeAnnotatedValues() {
    Module mod = `module mock.ceylon.build.runner.mock4`;
    value results = [].chain(findAnnotatedIncludes(mod));
    value expected = [`value include1`, `value include2`, `value include3`];
    containSameElements(results, expected);
}

void containSameElements({ValueDeclaration*} actual, {ValueDeclaration*} expected) {
    assertEquals(HashSet { elements = actual; } , HashSet { elements = expected; });
}


{FormattingOption+} formattingOptions = {
    FormattingOption {
    	"The indentation mode of the formatter.";
    	"IndentMode"; "indentMode"; /* = */ "Spaces(4)";
    }
};

Add a "maxLineLength" formatting option.

{FormattingOption+} formattingOptions = {
    FormattingOption {
        "The indentation mode.";
        "IndentMode"; "indentMode"; /* = */ "Spaces(4)";
    },
    FormattingOption {
        "The maximum line length, or `null` for unlimited line length.";
        "Integer?"; "maxLineLength"; /* = */ "null";
    }
};


interface SecondOrder<Box>
        given Box<Value> {
    shared formal Box<Float> createBox(Float float);
}
void takesCallableParamWithTypeParam(T f<T>(T t)) {}

Add test for named arg funs with type params

interface SecondOrder<Box>
        given Box<Value> {
    shared formal Box<Float> createBox(Float float);
}
void takesCallableParamWithTypeParam(T f<T>(T t)) {}
value namedArgsInvocWithFunctionArgWithTypeParam = f {
    function f<T>(T t) {
        return t;
    }
};


import check {...}

void test_outer_inner_safety() {
  class Outer() {
    shared class Inner() { }
  }
  Outer? o = null;
  Outer.Inner? i1 = o?.Inner();
  Outer.Inner? cons() = o?.Inner();
  if (exists i1) {
    fail("i1 should be null");
  }
  check(className(cons)=="ceylon.language::JsCallable", "cons is Callable");
  Outer.Inner|Nothing i2 = cons();
  if (exists i2) {
    fail("i2 should not exist");
  }
}

Print obtained classname in error message

import check {...}

void test_outer_inner_safety() {
  class Outer() {
    shared class Inner() { }
  }
  Outer? o = null;
  Outer.Inner? i1 = o?.Inner();
  Outer.Inner? cons() = o?.Inner();
  if (exists i1) {
    fail("i1 should be null");
  }
  check(className(cons)=="ceylon.language::JsCallable", "cons is Callable, " className(cons) "");
  Outer.Inner|Nothing i2 = cons();
  if (exists i2) {
    fail("i2 should not exist");
  }
}


public class SimpleList<T> (T? head, SimpleList<T>? tail)
    satisfies Iterable<T>
{
    public T? car = head;
    public SimpleList<T> ? cdr = tail;

    public Iterator<T> iterator() {
        return SimpleIterator<T>(this);
    }

   public class SimpleIterator<T> (SimpleList<T> ? l)
       satisfies Iterator<T>
   {
        SimpleList<T> ? list = l;

        T? head() {
            if (exists list) {
                return list.car;
            } else {
                return null;
            }
        }

        Iterator<T> tail() {
            if (exists list) {
                return SimpleIterator<T>(list.cdr);
            } else {
                return SimpleIterator<T>(null);
            }
        }
    }
}

Fix optional types in back-end.

public class SimpleList<T> (T? head, SimpleList<T>? tail)
    satisfies Iterable<T>
{
    public Iterator<T> iterator() {
        return SimpleIterator<T>(this);
    }

   public class SimpleIterator<T> (SimpleList<T> ? list)
       satisfies Iterator<T>
   {
        T? head() {
            if (exists list) {
                return list.head;
            } else {
                return null;
            }
        }

        Iterator<T> tail() {
            if (exists list) {
                return SimpleIterator<T>(list.tail);
            } else {
                return SimpleIterator<T>(null);
            }
        }
    }
}


import ceylon.language.meta { modules }
import ceylon.language.meta.declaration { ClassDeclaration }

shared final annotation class TestAnnotation()
        satisfies OptionalAnnotation<TestAnnotation, ClassDeclaration> {
}

@test
shared void bug347() {
    for (value m in modules.list) {
        if(m.name.startsWith("org.apache")
            || m.name.startsWith("com.redhat.ceylon.maven-support")
            || m.name.startsWith("org.jboss.jandex")){
            continue;
        }
        for (value member in m.members) {
            value components = member.annotatedMembers<ClassDeclaration, TestAnnotation>();
            assert(components == []);
        }
    }
}

Make tests handle antlr module debug package

import ceylon.language.meta { modules }
import ceylon.language.meta.declaration { ClassDeclaration }

shared final annotation class TestAnnotation()
        satisfies OptionalAnnotation<TestAnnotation, ClassDeclaration> {
}

@test
shared void bug347() {
    for (value m in modules.list) {
        if(m.name.startsWith("org.apache")
            || m.name.startsWith("com.redhat.ceylon.maven-support")
            || m.name.startsWith("org.antlr")
            || m.name.startsWith("org.jboss.jandex")){
            continue;
        }
        for (value member in m.members) {
            value components = member.annotatedMembers<ClassDeclaration, TestAnnotation>();
            assert(components == []);
        }
    }
}


import ceylon.ast.core {
    Annotations,
    ValueDeclaration,
    DynamicModifier,
    LIdentifier,
    Type
}
import ceylon.ast.redhat {
    RedHatTransformer,
    valueDeclarationToCeylon,
    compileValueDeclaration
}
import com.redhat.ceylon.compiler.typechecker.tree {
    Tree {
        JAttributeDeclaration=AttributeDeclaration
    }
}

shared object valueDeclaration satisfies ConcreteTest<ValueDeclaration,JAttributeDeclaration> {

    String->ValueDeclaration construct(String->LIdentifier name, String->Type|DynamicModifier type, String->Annotations annotations)
            => "``annotations.key`` ``type.key`` ``name.key``;"->ValueDeclaration(name.item, type.item, annotations.item);

    shared String->ValueDeclaration lidValueDeclaration = construct(identifier.lidLIdentifier, dynamicModifier.dynamicModifier, annotations.emptyAnnotations);
    shared String->ValueDeclaration annotatedByValueDeclaration = construct(identifier.byLIdentifier, unionType.stringOrIntegerOrFloatUnionType, annotations.helloSharedByLucasAnnotations);

    compile = compileValueDeclaration;
    fromCeylon = RedHatTransformer.transformValueDeclaration;
    toCeylon = valueDeclarationToCeylon;
    codes = [lidValueDeclaration, annotatedByValueDeclaration];
}

Add tests for variadic value declaration

import ceylon.ast.core {
    Annotations,
    ValueDeclaration,
    DynamicModifier,
    LIdentifier,
    Type,
    VariadicType
}
import ceylon.ast.redhat {
    RedHatTransformer,
    valueDeclarationToCeylon,
    compileValueDeclaration
}
import com.redhat.ceylon.compiler.typechecker.tree {
    Tree {
        JAttributeDeclaration=AttributeDeclaration
    }
}

shared object valueDeclaration satisfies ConcreteTest<ValueDeclaration,JAttributeDeclaration> {

    String->ValueDeclaration construct(String->LIdentifier name, String->Type|VariadicType|DynamicModifier type, String->Annotations annotations)
            => "``annotations.key`` ``type.key`` ``name.key``;"->ValueDeclaration(name.item, type.item, annotations.item);

    shared String->ValueDeclaration lidValueDeclaration = construct(identifier.lidLIdentifier, dynamicModifier.dynamicModifier, annotations.emptyAnnotations);
    shared String->ValueDeclaration annotatedByValueDeclaration = construct(identifier.byLIdentifier, unionType.stringOrIntegerOrFloatUnionType, annotations.helloSharedByLucasAnnotations);
    shared String->ValueDeclaration variadicValueDeclaration = construct(identifier.lidLIdentifier, variadicType.iterableOfStringPlusType, annotations.emptyAnnotations);

    compile = compileValueDeclaration;
    fromCeylon = RedHatTransformer.transformValueDeclaration;
    toCeylon = valueDeclarationToCeylon;
    codes = [lidValueDeclaration, annotatedByValueDeclaration];
}


import assert { ... }

Element? find<Element>(Array<Element> a, Boolean f(Element x)) {
  for (Element e in a) {
    if (f(e)) {
      return e;
    }
  }
  return null;
}

void testAnonymous() {
  print("Testing anonymous functions...");
  value nums = array(1,2,3,4,5);
  //Test positional argument call
  variable value found := find(nums, (Integer i) i%2==0);
  if (exists i=found) {
    assert(i == 2, "anonfunc positional");
  } else { fail("anonfunc positional"); }
  //Named argument call
  found := find{
    function f(Integer i) {
      return i%2==0;
    }
    a=nums;
  };
  if (exists i=found) {
    assert(i == 2, "anonfunc named");
  } else { fail("anonfunc named"); }
}

Add Gavin's tests for the 3 styles of higher-order function calling

import assert { ... }

Element? find<Element>(Array<Element> a, Boolean f(Element x)) {
  for (Element e in a) {
    if (f(e)) {
      return e;
    }
  }
  return null;
}

void testAnonymous() {
  print("Testing anonymous functions...");
  value nums = array(1,2,3,4,5);
  //Test positional argument call
  variable value found := find(nums, (Integer i) i%2==0);
  if (exists i=found) {
    assert(i == 2, "anonfunc positional");
  } else { fail("anonfunc positional"); }
  //Named argument call
  found := find{
    function f(Integer i) {
      return i%2==0;
    }
    a=nums;
  };
  if (exists i=found) {
    assert(i == 2, "anonfunc named");
  } else { fail("anonfunc named"); }

  //Gavin's test
   void callFunction(String f(Integer i)) {
       print(f(0));
   }

   function f(Integer i) {
       return (i+12).string;
   }
   callFunction(f);

   callFunction((Integer i) (i*3).string);

   callFunction {
       function f(Integer i) {
           return (i**2).string;
       }
   };

}


import ceylon.language.meta.model {
    Attribute,
    Type
}
import ceylon.language.meta.declaration {
    ValueDeclaration,
    TypeParameter
}

"Contract for flattening the state of an instance of a class.
 This interface is implemented by a serialization library."
shared interface Deconstructor {

    "Adds the given type argument of the given type parameter to the flattened state."
    throws (`class AssertionError`,
        "if there is already a value for the given type argument")
    shared formal void putTypeArgument(TypeParameter typeParameter, Type typeArgument);

    "Adds the value of the given attribute to the flattened state."
    throws (`class AssertionError`,
        "if there is already a value for the given attribute")
    shared formal void putValue<Type>(ValueDeclaration attribute, Type referenced);
}

"The flattened state of an instance of a class.
 This interface is implemented by a serialization library."
shared interface Deconstructed
        satisfies {[ValueDeclaration, Anything]*} {

    "Get the type argument of the given type parameter"
    throws (`class AssertionError`,
        "if the type argument is missing")
    shared formal Type getTypeArgument(TypeParameter typeParameter);

    "Get the value of the given attribute."
    throws (`class AssertionError`,
        "if the value is missing")
    shared formal Type|Reference<Type> getValue<Type>(ValueDeclaration attribute);
}

Add support for persisting arrays.

import ceylon.language.meta.model {
    Attribute,
    Type
}
import ceylon.language.meta.declaration {
    ValueDeclaration,
    TypeParameter
}

"Contract for flattening the state of an instance of a class.
 This interface is implemented by a serialization library."
shared interface Deconstructor {

    "Adds the given type argument of the given type parameter to the flattened state."
    throws (`class AssertionError`,
        "if there is already a value for the given type argument")
    shared formal void putTypeArgument(TypeParameter typeParameter, Type typeArgument);

    "Adds the value of the given attribute to the flattened state."
    throws (`class AssertionError`,
        "if there is already a value for the given attribute")
    shared formal void putValue<Type>(ValueDeclaration attribute, Type referenced);

    shared formal void putArray<Element>(ValueDeclaration attribute, Array<Element> array);
}

"The flattened state of an instance of a class.
 This interface is implemented by a serialization library."
shared interface Deconstructed
        satisfies {[ValueDeclaration, Anything]*} {

    "Get the type argument of the given type parameter"
    throws (`class AssertionError`,
        "if the type argument is missing")
    shared formal Type getTypeArgument(TypeParameter typeParameter);

    "Get the value of the given attribute."
    throws (`class AssertionError`,
        "if the value is missing")
    shared formal Type|Reference<Type> getValue<Type>(ValueDeclaration attribute);

    shared formal Array<Element> array
    getArray<Element>(ValueDeclaration attribute);
}


"A formatter for the Ceylon programming language."
module ceylon.formatter "1.0.0" {
    shared import java.base "7";
    shared import com.redhat.ceylon.typechecker "1.0.0";
    shared import org.antlr.runtime "3.4";
    import ceylon.time "1.0.0";
    import ceylon.interop.java "1.0.0";
    import ceylon.collection "1.0.0";
    import ceylon.file "1.0.0";
}

Update import of ANTLR runtime

"A formatter for the Ceylon programming language."
module ceylon.formatter "1.0.0" {
    shared import java.base "7";
    shared import com.redhat.ceylon.typechecker "1.0.0";
    shared import 'org.antlr-runtime' "3.4";
    import ceylon.time "1.0.0";
    import ceylon.interop.java "1.0.0";
    import ceylon.collection "1.0.0";
    import ceylon.file "1.0.0";
}


"Module that allows developping the Ceylon IDE in Ceylon"
by("David Festal")
module com.redhat.ceylon.eclipse.ui "1.1.1" {
    shared import com.redhat.ceylon.typechecker "1.1.1";
    shared import com.redhat.ceylon.model "1.1.1";
    shared import ceylon.collection "1.1.1";
    import ceylon.interop.java "1.1.1";
    shared import java.base "7";
}

Add the required native annotation

"Module that allows developping the Ceylon IDE in Ceylon"
by("David Festal")
native("java")
module com.redhat.ceylon.eclipse.ui "1.1.1" {
    shared import com.redhat.ceylon.typechecker "1.1.1";
    shared import com.redhat.ceylon.model "1.1.1";
    shared import ceylon.collection "1.1.1";
    import ceylon.interop.java "1.1.1";
    shared import java.base "7";
}


"Given two streams, form a new stream by applying a
 function to the arguments in the given streams. The
 length of the resulting stream is the length of
 the shorter of the two given streams.

 Thus:

     mapPairs(xs,ys,fun)[i]==fun(xs[i],ys[i])

 for every `0<=i<min({xs.size,ys.size})`."
shared {Result*} mapPairs<Result,FirstArgument,SecondArgument>(
    Result collecting(FirstArgument firstArg, SecondArgument secondArg),
    {FirstArgument*} firstArguments,
    {SecondArgument*} secondArguments
) {
    object iterable satisfies {Result*} {
        shared actual Iterator<Result> iterator() {
            value first = firstArguments.iterator();
            value second = secondArguments.iterator();
            object iterator satisfies Iterator<Result> {
                shared actual Result|Finished next() {
                    if (!is Finished firstArg=first.next(),
                        !is Finished secondArg=second.next()) {
                        return collecting(firstArg,secondArg);
                    }
                    else {
                        return finished;
                    }
                }
            }
            return iterator;
        }
    }
    return iterable;
}

Fix wrong order of arguments in doc

"Given two streams, form a new stream by applying a
 function to the arguments in the given streams. The
 length of the resulting stream is the length of
 the shorter of the two given streams.

 Thus:

     mapPairs(fun,xs,ys)[i]==fun(xs[i],ys[i])

 for every `0<=i<min({xs.size,ys.size})`."
shared {Result*} mapPairs<Result,FirstArgument,SecondArgument>(
    Result collecting(FirstArgument firstArg, SecondArgument secondArg),
    {FirstArgument*} firstArguments,
    {SecondArgument*} secondArguments
) {
    object iterable satisfies {Result*} {
        shared actual Iterator<Result> iterator() {
            value first = firstArguments.iterator();
            value second = secondArguments.iterator();
            object iterator satisfies Iterator<Result> {
                shared actual Result|Finished next() {
                    if (!is Finished firstArg=first.next(),
                        !is Finished secondArg=second.next()) {
                        return collecting(firstArg,secondArg);
                    }
                    else {
                        return finished;
                    }
                }
            }
            return iterator;
        }
    }
    return iterable;
}


import ceylon.buffer.codec {
    buildCodecLookup
}

"A mapping of all supported character sets.

 Currently this lists contains:

 - ASCII
 - ISO 8859 1
 - UTF-8
 - UTF-16
 "
shared Map<String,Charset> charsetsByAlias = buildCodecLookup {
    utf8
};

Add missing charsets to charsetsByAlias

import ceylon.buffer.codec {
    buildCodecLookup
}

"A mapping of all supported character sets.

 Currently this lists contains:

 - ASCII
 - ISO 8859 1
 - UTF-8
 - UTF-16
 "
shared Map<String,Charset> charsetsByAlias = buildCodecLookup {
    utf8,
    utf16,
    iso_8859_1,
    ascii
};


doc "Creates a `Map` that contains the `Iterable`'s
     elements, grouped in `Sequence`s under the
     keys provided by the grouping function."
shared Map<Group, {Element+}> group<Group, Element>({Element*} elements,
    "A function that returns the key under which to group the
     specified element."
    Group grouping(Element element)) given Group satisfies Object {

    /*
    We've no idea how long the iterable is, nor how selective the grouping
    function is, so it's really had to accurately estimate the size of the
    HashMap.
    */
    value map = HashMap<Group, SequenceBuilder<Element>>() ;

    for (Element element in elements) {
        Group group = grouping(element);

        value sb = map.get(group);
        if (is SequenceBuilder<Element> sb) {
            sb.append(element);
        } else {
            map.put(group, SequenceBuilder<Element>().append(element));
        }
    }

    print(map);

    Sequence<Element> fn(Group key, SequenceBuilder<Element> item) {
        value sequence = item.sequence;
        assert(is Sequence<Element> sequence);
        return sequence;
    }

    return map.mapItems(fn);

}

Remove accidental call to print()

doc "Creates a `Map` that contains the `Iterable`'s
     elements, grouped in `Sequence`s under the
     keys provided by the grouping function."
shared Map<Group, {Element+}> group<Group, Element>({Element*} elements,
    "A function that returns the key under which to group the
     specified element."
    Group grouping(Element element)) given Group satisfies Object {

    /*
    We've no idea how long the iterable is, nor how selective the grouping
    function is, so it's really had to accurately estimate the size of the
    HashMap.
    */
    value map = HashMap<Group, SequenceBuilder<Element>>() ;

    for (Element element in elements) {
        Group group = grouping(element);

        value sb = map.get(group);
        if (is SequenceBuilder<Element> sb) {
            sb.append(element);
        } else {
            map.put(group, SequenceBuilder<Element>().append(element));
        }
    }

    Sequence<Element> fn(Group key, SequenceBuilder<Element> item) {
        value sequence = item.sequence;
        assert(is Sequence<Element> sequence);
        return sequence;
    }

    return map.mapItems(fn);

}


import check { ... }

shared class AliasingClass() {
    shared interface AliasingIface {
        shared Boolean aliasingIface() { return true; }
    }
    shared class AliasingInner() {
        shared Boolean aliasingInner() { return true; }
    }
}

class AliasingSubclass() extends AliasingClass() {
    shared class InnerAlias() = AliasingInner;
    shared class SubAlias() extends InnerAlias() {}

    shared Boolean aliasingSubclass() {
        return SubAlias().aliasingInner();
    }
    shared interface AliasedIface = AliasingIface;
}

class AliasingSub2() extends AliasingSubclass() {
    shared AliasedIface iface {
        object aliased satisfies AliasedIface {
        }
        return aliased;
    }
}

void testAliasing() {
    print("testing type aliases");
    check(AliasingSubclass().aliasingSubclass(), "Aliased member class");
    class InnerSubalias() = AliasingSubclass;
    check(InnerSubalias().aliasingSubclass(), "Aliased top-level class");
    interface AliasedIface2 = AliasingClass.AliasingIface;
    Boolean use(AliasedIface2 aif) { return aif.aliasingIface(); }
    check(use(AliasingSub2().iface), "Aliased member interface");

}

Add simple test for type alias

import check { ... }

alias Strinteger = String|Integer;

shared class AliasingClass() {
    shared interface AliasingIface {
        shared Boolean aliasingIface() { return true; }
    }
    shared class AliasingInner() {
        shared Boolean aliasingInner() { return true; }
    }
}

class AliasingSubclass() extends AliasingClass() {
    shared class InnerAlias() = AliasingInner;
    shared class SubAlias() extends InnerAlias() {}

    shared Boolean aliasingSubclass() {
        return SubAlias().aliasingInner();
    }
    shared interface AliasedIface = AliasingIface;
}

class AliasingSub2() extends AliasingSubclass() {
    shared AliasedIface iface {
        object aliased satisfies AliasedIface {
        }
        return aliased;
    }
}

void testAliasing() {
    print("testing type aliases");
    check(AliasingSubclass().aliasingSubclass(), "Aliased member class");
    class InnerSubalias() = AliasingSubclass;
    check(InnerSubalias().aliasingSubclass(), "Aliased top-level class");
    interface AliasedIface2 = AliasingClass.AliasingIface;
    Boolean use(AliasedIface2 aif) { return aif.aliasingIface(); }
    check(use(AliasingSub2().iface), "Aliased member interface");
    Strinteger xxxxx = 5;
    check(is Integer xxxxx, "Type alias");
}


interface SecondOrder<Box>
        given Box<Value> {
    shared formal Box<Float> createBox(Float float);
}
void takesCallableParamWithTypeParam(T f<T>(T t)) {}
value namedArgsInvocWithFunctionArgWithTypeParam = f {
    function f<T>(T t) {
        return t;
    }
};

Add test for generic anonymous functions

interface SecondOrder<Box>
        given Box<Value> {
    shared formal Box<Float> createBox(Float float);
}
void takesCallableParamWithTypeParam(T f<T>(T t)) {}
value namedArgsInvocWithFunctionArgWithTypeParam = f {
    function f<T>(T t) {
        return t;
    }
};
value anonymousGenericFunction = <T>(T t) => t;


import ceylon.html {
	Head,
	Body,
	Html
}
import ceylon.markdown.core {
	Document
}

"Render Markdown as a complete HTML document. This method returns an [[Html]] object.

     value html = renderCompleteHtml(tree);"
shared Html renderCompleteHtml(Document document) => Html {
	Head { },
	Body {
		children = HtmlVisitor().visitDocument(document);
	}
};

"Render Markdown as a list of HTML elements. This method returns a sequence.

     value nodes = renderPartialHtml(tree);"
shared HtmlChildren[] renderPartialHtml(Document document)
		=> HtmlVisitor().visitDocument(document);

Use the `utf-8` charset for html

import ceylon.html {
	Head,
	Body,
	Html,
	Meta
}
import ceylon.markdown.core {
	Document
}

"Render Markdown as a complete HTML document. This method returns an [[Html]] object
 using the `utf-8` charset.

     value html = renderCompleteHtml(tree);"
shared Html renderCompleteHtml(Document document) => Html {
	Head {
		Meta { charset="utf-8"; }
	},
	Body {
		children = HtmlVisitor().visitDocument(document);
	}
};

"Render Markdown as a list of HTML elements. This method returns a sequence.

     value nodes = renderPartialHtml(tree);"
shared HtmlChildren[] renderPartialHtml(Document document)
		=> HtmlVisitor().visitDocument(document);


void decLiterals() {
    value clM = `module ceylon.language`;
    value clP = `package ceylon.language`;
    value stringC = `class String`;
    value iterableI = `interface Iterable`;
    value aliasA = `alias Alias`;
    value givenG = `given Given`;
    value nullV = `value null`;
    value identityF = `function identity`;
    value newN = `new Constructor`;

    value currentM = `module`;
    value currentP = `package`;
    value currentC = `class`;
    value currentI = `interface`;
}

Add test for backtick-less meta literals

void decLiterals() {
    value clM = `module ceylon.language`;
    value clP = `package ceylon.language`;
    value stringC = `class String`;
    value iterableI = `interface Iterable`;
    value aliasA = `alias Alias`;
    value givenG = `given Given`;
    value nullV = `value null`;
    value identityF = `function identity`;
    value newN = `new Constructor`;

    value currentM = `module`;
    value currentP = `package`;
    value currentC = `class`;
    value currentI = `interface`;
}

void decLiteralsWithoutBackticks() {
    value clM = module ceylon.language;
    value clP = package ceylon.language;
    value stringC = class String;
    value iterableI = interface Iterable;
    value aliasA = alias Alias;
    value givenG = given Given;
    value nullV = value null;
    value identityF = function identity;
    value newN = new Constructor;

    value currentM = module;
    value currentP = package;
    value currentC = class;
    value currentI = interface;
}


interface SecondOrder<Box>
        given Box<Value> {
    shared formal Box<Float> createBox(Float float);
}
void takesCallableParamWithTypeParam(T f<T>(T t)) {}
value namedArgsInvocWithFunctionArgWithTypeParam = f {
    function f<T>(T t) {
        return t;
    }
};
value anonymousGenericFunction = <T>(T t) => t;

Add test for parameterized exprs with type params

interface SecondOrder<Box>
        given Box<Value> {
    shared formal Box<Float> createBox(Float float);
}
void takesCallableParamWithTypeParam(T f<T>(T t)) {}
value namedArgsInvocWithFunctionArgWithTypeParam = f {
    function f<T>(T t) {
        return t;
    }
};
value anonymousGenericFunction = <T>(T t) => t;
class C() {
    parameterizedExpressionWithTypeParams<T>(T t) => t;
}


import ceylon.build.task { Goal, GoalSet }
import ceylon.collection { LinkedList }

"An interactive console."
void console({<Goal|GoalSet>+} goals) {
    value exitMessages = LazyMap<Integer, String>({
        exitCodes.success->"Success",
        exitCodes.dependencyCycleFound->"Dependency Cycle Found",
        exitCodes.invalidGoalFound->"Invalid goal found",
        exitCodes.duplicateGoalsFound->"Duplicate goals found",
        exitCodes.noGoalToRun->"No goal to run",
        exitCodes.errorOnTaskExecution->"Error on task execution"
    });
    print("Available goals: ``mergeGoalSetsWithGoals(goals)``");
    print("Enter Ctrl + D to quit");
    while (true) {
        process.write("> ");
        String? rawLine = process.readLine(); // workaround for https://github.com/ceylon/ceylon.language/issues/372
        if (is Null rawLine) {
            process.writeLine();
            return;
        }
        assert(exists rawLine);
        String line = rawLine.trimmed;
        value result = runEngine(goals,"",line.split().sequence);
        assert(exists msg = exitMessages[result.exitCode]);
        print(msg);
    }
}

Use HashMap instead of LazyMap

import ceylon.build.task { Goal, GoalSet }
import ceylon.collection { HashMap }

"An interactive console."
void console({<Goal|GoalSet>+} goals) {
    value exitMessages = HashMap<Integer, String>({
        exitCodes.success->"Success",
        exitCodes.dependencyCycleFound->"Dependency Cycle Found",
        exitCodes.invalidGoalFound->"Invalid goal found",
        exitCodes.duplicateGoalsFound->"Duplicate goals found",
        exitCodes.noGoalToRun->"No goal to run",
        exitCodes.errorOnTaskExecution->"Error on task execution"
    });
    print("Available goals: ``mergeGoalSetsWithGoals(goals)``");
    print("Enter Ctrl + D to quit");
    while (true) {
        process.write("> ");
        String? rawLine = process.readLine(); // workaround for https://github.com/ceylon/ceylon.language/issues/372
        if (is Null rawLine) {
            process.writeLine();
            return;
        }
        assert(exists rawLine);
        String line = rawLine.trimmed;
        value result = runEngine(goals,"",line.split().sequence);
        assert(exists msg = exitMessages[result.exitCode]);
        print(msg);
    }
}


import check {...}

shared void test() {
    Boolean a = true;
    Boolean b = false;
    variable value count := 0;
    if (a && b) {
        fail("WTF?");
    } else if (a || b) {
        check(a||b, "boolean 1");
        count++;
    }
    String? c = "X";
    String? d = null;
    if (exists c && exists d) {
        fail("WTF exists");
    } else if (exists c1=c, exists c1[0]) {
        check(c1 == "X", "exists");
        count++;
    }
    String|Integer e = 1;
    if (is Integer e && exists d) {
        fail("WTF is");
    } else if (is Integer e, exists c) {
        check(e>0, "is");
        count++;
    }
    String[] f = {"a","b","c"};
    Integer[] g = {};
    if (nonempty f && nonempty g) {
        fail("WTF nonempty");
    } else if (nonempty f, nonempty f.first) {
        check(f.first.uppercased=="A", "nonempty");
        count++;
    }
    check(count==4, "some conditions were not met: " count " instead of 4");
    results();
}

Test condition list with comprehensions

import check {...}

shared void test() {
    Boolean a = true;
    Boolean b = false;
    variable value count := 0;
    if (a && b) {
        fail("WTF?");
    } else if (a || b) {
        check(a||b, "boolean 1");
        count++;
    }
    String? c = "X";
    String? d = null;
    if (exists c && exists d) {
        fail("WTF exists");
    } else if (exists c1=c, exists c1[0]) {
        check(c1 == "X", "exists");
        count++;
    }
    String|Integer e = 1;
    if (is Integer e && exists d) {
        fail("WTF is");
    } else if (is Integer e, exists c) {
        check(e>0, "is");
        count++;
    }
    String[] f = {"a","b","c"};
    Integer[] g = {};
    if (nonempty f && nonempty g) {
        fail("WTF nonempty");
    } else if (nonempty f, nonempty f.first) {
        check(f.first.uppercased=="A", "nonempty");
        count++;
    }
    check(count==4, "some conditions were not met: " count " instead of 4");
    Void zz = 1;
    assert(is Integer zz2=zz, zz2 > 0);
    check(zz2==1, "special -> boolean");
    //and now some comprehensions
    Sequence<Integer?> seq1 = { 1, 2, 3, null, 4, 5, null, 6, 7, null, 10};
    check({ for (i in seq1) if (exists i, i%2==0) i*10 }=={20,40,60,100},"comprehension [1]");
    results();
}


interface SecondOrder<Box>
        given Box<Value> {
    shared formal Box<Float> createBox(Float float);
}
void takesCallableParamWithTypeParam(T f<T>(T t)) {}
value namedArgsInvocWithFunctionArgWithTypeParam = f {
    function f<T>(T t) {
        return t;
    }
};
value anonymousGenericFunction = <T>(T t) => t;
class C() {
    parameterizedExpressionWithTypeParams<T>(T t) => t;
}

Add test for anon functions with type constraints

interface SecondOrder<Box>
        given Box<Value> {
    shared formal Box<Float> createBox(Float float);
}
void takesCallableParamWithTypeParam(T f<T>(T t)) {}
value namedArgsInvocWithFunctionArgWithTypeParam = f {
    function f<T>(T t) {
        return t;
    }
};
value anonymousGenericFunction = <T>(T t) given T satisfies Anything => t;
class C() {
    parameterizedExpressionWithTypeParams<T>(T t) => t;
}


void characters() {
    value c = `a`;
    assert(c.lowercase, "lowercase char");
    assert(!c.uppercase, "lowercase char");
    assert(`A`.uppercase, "uppercase char");
    assert(!`A`.lowercase, "uppercase char");
    assert(c.uppercased==`A`, "uppercased char");
    assert(`A`.lowercased==`a`, "lowercased char");
    assert(c.string=="a", "character string");
    assert(!c.whitespace, "character not whitespace");
    assert(!c.digit, "character not whitespace");
    assert(` `.whitespace, "character whitespace");
    assert(`1`.digit, "character digt");
    assert(`a`<`z`, "char order");
    assert(`a`.successor==`b`, "char successor");
    assert(`Z`.predecessor==`Y`, "char predecessor");

    variable value i:=0;
    for (x in `a`..`z`) {
        i:=i+1;
        assert(x>=`a`&&x<=`z`, "character range");
    }
    assert(i==26, "character range");

    assert(c.integer.character==c, "integer/character conversion");
    assert(69.character.integer==69, "integer/character conversion");

}

Add tests for escaped character literals

void characters() {
    value c = `a`;
    assert(c.lowercase, "lowercase char");
    assert(!c.uppercase, "lowercase char");
    assert(`A`.uppercase, "uppercase char");
    assert(!`A`.lowercase, "uppercase char");
    assert(c.uppercased==`A`, "uppercased char");
    assert(`A`.lowercased==`a`, "lowercased char");
    assert(c.string=="a", "character string");
    assert(!c.whitespace, "character not whitespace");
    assert(!c.digit, "character not whitespace");
    assert(` `.whitespace, "character whitespace");
    assert(`1`.digit, "character digt");
    assert(`a`<`z`, "char order");
    assert(`a`.successor==`b`, "char successor");
    assert(`Z`.predecessor==`Y`, "char predecessor");
    assert(`\t`.integer==9, "escaped characters 1");
    assert(`\\`.integer==92, "escaped characters 2");
    assert(`\``.integer==96, "escaped characters 3");

    variable value i:=0;
    for (x in `a`..`z`) {
        i:=i+1;
        assert(x>=`a`&&x<=`z`, "character range");
    }
    assert(i==26, "character range");

    assert(c.integer.character==c, "integer/character conversion");
    assert(69.character.integer==69, "integer/character conversion");

}


import java.nio {
    JByteBuffer=ByteBuffer
}
import java.lang {
    ByteArray
}

shared {Byte*} toBytes(JByteBuffer[] jByteBufferArray) =>
     jByteBufferArray.flatMap((JByteBuffer element) => collectBytes(element));

{Byte*} collectBytes(JByteBuffer jByteBuffer) {
    ByteArray array = ByteArray(jByteBuffer.remaining()); //TODO can we do without new array?
    jByteBuffer.get(array);
    return array.iterable;
}

Remove creation of new array.

import java.nio {
    JByteBuffer=ByteBuffer
}
import java.lang {
    ByteArray
}

shared {Byte*} toBytes(JByteBuffer[] jByteBufferArray) =>
     jByteBufferArray.flatMap((JByteBuffer element) => collectBytes(element));

{Byte*} collectBytes(JByteBuffer jByteBuffer) {
    return jByteBuffer.array().iterable;
}


/*
 * Copyright 2011 Red Hat Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
void run(){
    print("Look, Ma! No module!");
}

Fix for the JS backend: made run method shared

/*
 * Copyright 2011 Red Hat Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
shared void run(){
    print("Look, Ma! No module!");
}


"Something that can go through a transition and is meant to
 be be fulfilled or rejected."
by("Julien Viet")
shared interface Resolver<in Value> {

    "Fulfills the promise with a value or a promise to the
     value."
    shared formal void fulfill(Value|Promise<Value> val);

    "Rejects the promise with a reason."
    shared formal void reject(Throwable reason);

    "Either fulfill or reject the promise"
    shared void resolve(Value|Promise<Value>|Throwable val) {
      if (is Value|Promise<Value> val) {
        fulfill(val);
      } else {
        assert(is Throwable val);
        reject(val);
      }
    }
}

Make run with latest ceylon

"Something that can go through a transition and is meant to
 be be fulfilled or rejected."
by("Julien Viet")
shared interface Resolver<in Value> {

    "Fulfills the promise with a value or a promise to the
     value."
    shared formal void fulfill(Value|Promise<Value> val);

    "Rejects the promise with a reason."
    shared formal void reject(Throwable reason);

    "Either fulfill or reject the promise"
    shared void resolve(Value|Promise<Value>|Throwable val) {
      if (is Value|Promise<Value> val) {
        fulfill(val);
      } else {
        reject(val);
      }
    }
}


//Array tests
void testArrays() {
    assert(!nonempty arrayOfNone(), "arrayOfNone");
    value a1 = arrayOfSome({1});
    //assert(nonempty a1, "nonempty array");
    assert(a1.size==1, "array.size");
    assert(a1[0] exists, "array[0]");
    assert(!a1.empty, "array.empty");
    assert(a1.hash==1, "array.hash");
    a1.setItem(0,10);
    if (exists i=a1[0]) {
        assert(i==10, "array.setItem");
    } else { fail("array.setItem"); }
    a1.setItem(0,null);
    if (exists i=a1[0]) {
        fail("array.setItem (null)");
    }
}

Complete the array tests (which now pass with flying colors)

//Array tests
void testArrays() {
    assert(!nonempty array(), "arrayOfNone");
    value a1 = array(1);
    assert(nonempty a1, "nonempty array");
    assert(a1.size==1, "array.size");
    assert(a1[0] exists, "array[0]");
    assert(!a1.empty, "array.empty");
    assert(a1.hash==1, "array.hash");
    a1.setItem(0,10);
    if (exists i=a1[0]) {
        assert(i==10, "array.setItem");
    } else { fail("array.setItem"); }
    a1.setItem(0,null);
    if (exists i=a1[0]) {
        fail("array.setItem (null)");
    }
    value a2=array(1,2,3);
    value a3=arrayOfSome({1,2,3});
    assert(a2==a3, "array.equals");
    assert(a2.size==a3.size, "array.size");
    assert(nonempty a2, "nonempty array 2");
    a2.setItem(0,10);
    a3.setItem(0,null);
    if (exists i=a2[0]) {
        assert(i==10, "array.setItem 2");
    } else { fail("array.setItem 2"); }
    if (exists i=a3[0]) {
        fail("array.setItem (null) 2");
    }
}


by ("Stéphane Épardaud", "Alex Szczuczko")
module ceylon.buffer "1.2.1" {
    import ceylon.collection "1.2.1";
    native ("jvm") import java.base "7";
    native ("jvm") import java.tls "7";
    native ("jvm") import ceylon.interop.java "1.2.1";
}

Remove java.tls import from ceylon.buffer

"This module defines character sets, for encoding and decoding bytes to
 strings, as well as buffers of bytes and characters for input/output."
by ("Stéphane Épardaud", "Alex Szczuczko")
module ceylon.buffer "1.2.1" {
    import ceylon.collection "1.2.1";
    native ("jvm") import java.base "7";
    native ("jvm") import ceylon.interop.java "1.2.1";
}


Anything ifExpression =
        if (true || false)
        then 1
        else 2;
void ifExpr() {
    print(if (true) then 1 else 0);
}

Update if expressions test for changed indentation


import ceylon.ast.core {
    Annotations,
    ConstructorDefinition,
    Declaration,
    ExtendedType,
    Parameter,
    Parameters,
    Statement
}

"""Creates a constructor definition.

   Usage example:

       TODO"""
shared ConstructorDefinition constructorDefinition(
    name,
    parameters = Parameters(),
    block = [],
    extendedType = null,
    annotations = Annotations()) {

    IdentifierIsh name;
    Parameters|{Parameter*} parameters;
    {Declaration|Statement*} block;
    ExtendedType? extendedType;
    Annotations annotations;

    return ConstructorDefinition {
        name = lidentifier(name);
        block = package.block(block);
        parameters = parameters_internal(parameters);
        extendedType = extendedType;
        annotations = annotations;
    };
}

Add missing usage example for constructorDefinition

import ceylon.ast.core {
    Annotations,
    ConstructorDefinition,
    Declaration,
    ExtendedType,
    Parameter,
    Parameters,
    Statement
}

"""Creates a constructor definition.

   Usage example:

       constructorDefinition {
           name = "rgb";
           parameters = {
               ValueParameter {
                   type = baseType("Integer");
                   name = lidentifier("rgb");
               }
           };
           annotations = annotations {
               "Constructs a color, taking the red, green, and blue values
                from the argument integer.";
               "shared"
           };

           ValueSpecification {
               qualifier = This();
               name = lidentifier("rgb");
               specifier = Specifier(baseExpression("rgb"));
           }
       }"""
shared ConstructorDefinition constructorDefinition(
    name,
    parameters = Parameters(),
    block = [],
    extendedType = null,
    annotations = Annotations()) {

    IdentifierIsh name;
    Parameters|{Parameter*} parameters;
    {Declaration|Statement*} block;
    ExtendedType? extendedType;
    Annotations annotations;

    return ConstructorDefinition {
        name = lidentifier(name);
        block = package.block(block);
        parameters = parameters_internal(parameters);
        extendedType = extendedType;
        annotations = annotations;
    };
}


"Date and Time library for Ceylon language SDK.

 This library is loosely modeled/inspired by the JodaTime/JSR-310 date/time library.
 "
by ("Diego Coronel", "Roland Tepp")
module ceylon.time "1.2.3" {
    import ceylon.collection "1.2.3";
}

Remove unused dependency on ceylon.collection

"Date and Time library for Ceylon language SDK.

 This library is loosely modeled/inspired by the JodaTime/JSR-310 date/time library.
 "
by ("Diego Coronel", "Roland Tepp")
module ceylon.time "1.2.3" {
}


native("jvm") module org.otherone.vhostproxy.vertx "4" {
    shared import io.vertx.ceylon.core "3.3.2";
    //shared import "io.vertx:vertx-lang-ceylon" "3.3.0-SNAPSHOT";
    //shared import "io.vertx.lang.ceylon" "3.3.0-SNAPSHOT";
    import ceylon.regex "1.2.2";
    import ceylon.logging "1.2.2";
    //import ceylon.time "1.2.1";
    import java.base "7";
    //import "it.zero11:acme-client" "0.1.2";
    import ceylon.file "1.2.2";
    import ceylon.buffer "1.2.2";
}

Update to ceylon 1.3.1 + vertx 3.3.3

native("jvm") module org.otherone.vhostproxy.vertx "4" {
    shared import io.vertx.ceylon.core "3.3.3";
    //shared import "io.vertx:vertx-lang-ceylon" "3.3.0-SNAPSHOT";
    //shared import "io.vertx.lang.ceylon" "3.3.0-SNAPSHOT";
    import ceylon.regex "1.3.1";
    import ceylon.logging "1.3.1";
    //import ceylon.time "1.2.1";
    import java.base "7";
    //import "it.zero11:acme-client" "0.1.2";
    import ceylon.file "1.3.1";
    import ceylon.buffer "1.3.1";
}


import ceylon.collection {
    MutableList,
    ArrayList
}
"Run the module `source_gen.ceylon.ast`.

 See [this gist](https://gist.github.com/lucaswerkmeister/a4da0fa5d9d5b14cc3e9)."
shared void run() {
    if (exists first = process.arguments.first, first == "--help") {
        print("https://gist.github.com/lucaswerkmeister/a4da0fa5d9d5b14cc3e9");
        return;
    }
    assert (exists type = process.arguments[0], exists superType = process.arguments[1]);
    variable Integer i = 2;
    MutableList<String->String> params = ArrayList<String->String>();
    while (i < process.arguments.size) {
        assert (exists paramType = process.arguments[i++]);
        assert (exists paramName = process.arguments[i++]);
        params.add(paramType->paramName);
    }
    variable String? line = process.readLine();
    StringBuilder doc = StringBuilder();
    while (exists l = line) {
        doc.append(l);
        line = process.readLine();
    }
    Generator(type, superType, params.sequence(), doc.string).run();
}

Fix source-gen bug: doc would be missing line breaks

import ceylon.collection {
    MutableList,
    ArrayList
}
"Run the module `source_gen.ceylon.ast`.

 See [this gist](https://gist.github.com/lucaswerkmeister/a4da0fa5d9d5b14cc3e9)."
shared void run() {
    if (exists first = process.arguments.first, first == "--help") {
        print("https://gist.github.com/lucaswerkmeister/a4da0fa5d9d5b14cc3e9");
        return;
    }
    assert (exists type = process.arguments[0], exists superType = process.arguments[1]);
    variable Integer i = 2;
    MutableList<String->String> params = ArrayList<String->String>();
    while (i < process.arguments.size) {
        assert (exists paramType = process.arguments[i++]);
        assert (exists paramName = process.arguments[i++]);
        params.add(paramType->paramName);
    }
    variable String? line = process.readLine();
    StringBuilder doc = StringBuilder();
    while (exists l = line) {
        doc.append(l);
        doc.appendNewline();
        line = process.readLine();
    }
    Generator(type, superType, params.sequence(), doc.string).run();
}


doc "Components for JDBC-based database connectivity."
by "Enrique Zamudio"
license "Apache Software License 2.0"
module ceylon.dbc '0.1' {
    import ceylon.math '0.3.2';
}

Update doc and ceylon.math version

doc "This module offers some components for JDBC-based
     database connectivity. The main component is simply
     called Sql and is meant to be used with a `DataSource`
     that has been already been configured. "
by "Enrique Zamudio"
license "Apache Software License 2.0"
module ceylon.dbc '0.1' {
    import ceylon.math '0.3.3';
}


"A formatter for the Ceylon programming language."
by ("Lucas Werkmeister <mail@lucaswerkmeister.de>")
license("http://www.apache.org/licenses/LICENSE-2.0.html")
module ceylon.formatter "1.1.0" {
    shared import java.base "7";
    shared import com.redhat.ceylon.typechecker "1.1.0";
    shared import com.redhat.ceylon.common "1.1.0";
    shared import ceylon.file "1.1.0";
    import ceylon.interop.java "1.1.0";
    import ceylon.collection "1.1.0";
    optional import ceylon.test "1.1.0"; // for tests only, remove for release!
}

Format source code (ws in license annotation)

"A formatter for the Ceylon programming language."
by ("Lucas Werkmeister <mail@lucaswerkmeister.de>")
license ("http://www.apache.org/licenses/LICENSE-2.0.html")
module ceylon.formatter "1.1.0" {
    shared import java.base "7";
    shared import com.redhat.ceylon.typechecker "1.1.0";
    shared import com.redhat.ceylon.common "1.1.0";
    shared import ceylon.file "1.1.0";
    import ceylon.interop.java "1.1.0";
    import ceylon.collection "1.1.0";
    optional import ceylon.test "1.1.0"; // for tests only, remove for release!
}


"A formatter for the Ceylon programming language."
module ceylon.formatter "1.0.0" {
    shared import java.base "7";
    shared import com.redhat.ceylon.typechecker "1.0.0";
    shared import ceylon.file "1.0.0";
    import ceylon.time "1.0.0";
    import ceylon.interop.java "1.0.0";
    import ceylon.collection "1.0.0";
}

Update for Ceylon 1.1 (typechecker version)

"A formatter for the Ceylon programming language."
module ceylon.formatter "1.0.0" {
    shared import java.base "7";
    shared import com.redhat.ceylon.typechecker "1.1.0";
    shared import ceylon.file "1.0.0";
    import ceylon.time "1.0.0";
    import ceylon.interop.java "1.0.0";
    import ceylon.collection "1.0.0";
}


"Tests for the [[ceylon.ast module|module ceylon.ast]]"
by ("Lucas Werkmeister <mail@lucaswerkmeister.de>")
license("http://www.apache.org/licenses/LICENSE-2.0.html")
module test.ceylon.ast.api "1.1.0" {
    shared import ceylon.test "1.1.0";
    import ceylon.ast.api "1.1.0";
}

Fix ceylon.ast(.api) link in test.ceylon.ast.api doc

"Tests for the [[ceylon.ast.api module|module ceylon.ast.api]]"
by ("Lucas Werkmeister <mail@lucaswerkmeister.de>")
license("http://www.apache.org/licenses/LICENSE-2.0.html")
module test.ceylon.ast.api "1.1.0" {
    shared import ceylon.test "1.1.0";
    import ceylon.ast.api "1.1.0";
}


@test
shared void bug713() {
    value t = `Array<String>.OfSize` == `Array<String>.OfSize`;
}

Fix a test for Array.ofSize

@test
shared void bug713() {
    value t = `Array<String>.ofSize` == `Array<String>.ofSize`;
}


import ceylon.ast.core {
    Parameter,
    Parameters
}

"Converts a stream of [[parameters]] to a [[Parameters]] object."
Parameters parameters_internal(Parameters|{Parameter*} parameters) {
    if (is Parameters parameters) {
        return parameters;
    } else {
        assert (is {Parameter*} parameters);
        return Parameters(parameters.sequence());
    }
}

Add create parameter lists internal function

import ceylon.ast.core {
    Parameter,
    Parameters
}

"Converts a stream of [[parameters]] to a [[Parameters]] object."
Parameters parameters_internal(Parameters|{Parameter*} parameters) {
    if (is Parameters parameters) {
        return parameters;
    } else {
        assert (is {Parameter*} parameters);
        return Parameters(parameters.sequence());
    }
}

[Parameters+] parameterLists_internal({Parameters+}|Parameters|{Parameter*} parameters) {
    if (is Parameters parameters) {
        return [parameters];
    } else if (is {Parameters+} parameters) {
        assert (nonempty ret = parameters.sequence());
        return ret;
    } else {
        assert (is {Parameter*} parameters);
        return [parameters_internal(parameters)];
    }
}


import ceylon.ast.core {
    Annotations,
    Artifact,
    Module,
    ModuleImport,
    ModuleSpecifier,
    Repository,
    StringLiteral
}
import ceylon.ast.redhat {
    RedHatTransformer,
    moduleImportToCeylon,
    parseModuleImport
}
import com.redhat.ceylon.compiler.typechecker.tree {
    Tree {
        JImportModule=ImportModule
    }
}

shared object moduleImport satisfies ConcreteTest<ModuleImport,JImportModule> {

    String->ModuleImport construct(String->Module|ModuleSpecifier name, String->StringLiteral version, String->Annotations annotations = package.annotations.emptyAnnotations)
            => "``annotations.key`` import ``name.key`` ``version.key``;" -> ModuleImport(name.item, version.item, annotations.item);

    shared String->ModuleImport ceylonAstCore100ModuleImport = construct(fullPackageName.ceylonAstCorePackageName, stringLiteral._100VersionStringLiteral, annotations.sharedAnnotations);
    shared String->ModuleImport mavenCommonsCodecModuleImport = construct(moduleSpecifier.mavenCommonsCodecModuleSpecifier, stringLiteral._14VersionStringLiteral, annotations.emptyAnnotations);

    parse = parseModuleImport;
    fromCeylon = RedHatTransformer.transformModuleImport;
    toCeylon = moduleImportToCeylon;
    codes = [ceylonAstCore100ModuleImport, mavenCommonsCodecModuleImport];
}

Remove unused imports in tests

import ceylon.ast.core {
    Annotations,
    Module,
    ModuleImport,
    ModuleSpecifier,
    StringLiteral
}
import ceylon.ast.redhat {
    RedHatTransformer,
    moduleImportToCeylon,
    parseModuleImport
}
import com.redhat.ceylon.compiler.typechecker.tree {
    Tree {
        JImportModule=ImportModule
    }
}

shared object moduleImport satisfies ConcreteTest<ModuleImport,JImportModule> {

    String->ModuleImport construct(String->Module|ModuleSpecifier name, String->StringLiteral version, String->Annotations annotations = package.annotations.emptyAnnotations)
            => "``annotations.key`` import ``name.key`` ``version.key``;" -> ModuleImport(name.item, version.item, annotations.item);

    shared String->ModuleImport ceylonAstCore100ModuleImport = construct(fullPackageName.ceylonAstCorePackageName, stringLiteral._100VersionStringLiteral, annotations.sharedAnnotations);
    shared String->ModuleImport mavenCommonsCodecModuleImport = construct(moduleSpecifier.mavenCommonsCodecModuleSpecifier, stringLiteral._14VersionStringLiteral, annotations.emptyAnnotations);

    parse = parseModuleImport;
    fromCeylon = RedHatTransformer.transformModuleImport;
    toCeylon = moduleImportToCeylon;
    codes = [ceylonAstCore100ModuleImport, mavenCommonsCodecModuleImport];
}


import ceylon.ast.core {
    thisInstance,
    ArgumentList,
    PositionalArguments,
    SpreadArgument
}
import ceylon.ast.create {
    createBaseExpression=baseExpression,
    createPositionalArguments=positionalArguments
}
import ceylon.test {
    test,
    assertEquals
}

test
shared void positionalArgumentsFunction() {
    assertEquals {
        actual = createPositionalArguments();
        expected = PositionalArguments(ArgumentList());
    };
    assertEquals {
        actual = createPositionalArguments(thisInstance, SpreadArgument(createBaseExpression("others")));
        expected = PositionalArguments(ArgumentList([thisInstance], SpreadArgument(createBaseExpression("others"))));
    };
}

Fix name of create positional arguments test

import ceylon.ast.core {
    thisInstance,
    ArgumentList,
    PositionalArguments,
    SpreadArgument
}
import ceylon.ast.create {
    createBaseExpression=baseExpression,
    createPositionalArguments=positionalArguments
}
import ceylon.test {
    test,
    assertEquals
}

test
shared void positionalArguments() {
    assertEquals {
        actual = createPositionalArguments();
        expected = PositionalArguments(ArgumentList());
    };
    assertEquals {
        actual = createPositionalArguments(thisInstance, SpreadArgument(createBaseExpression("others")));
        expected = PositionalArguments(ArgumentList([thisInstance], SpreadArgument(createBaseExpression("others"))));
    };
}


"The Ceylon language module containing the core definitions
 referred to by the [language specification][spec], along
 with some basic functionality of use to most programs:

 - The [[root package|package ceylon.language]] defines
   general-purpose functionality including support for
   [[numbers|Numeric]] and [[character strings|String]],
   [[streams|Iterable]] and [[sequences|Sequential]],
   [[exceptions|Throwable]], and [[null values|Null]].
 - The Ceylon _metamodel_ is defined in
   [[package ceylon.language.meta]] and its subpackages
   [[package ceylon.language.meta.model]] and
   [[package ceylon.language.meta.declaration]], which
   define interfaces for interacting with applied types and
   unapplied type declarations respectively.

 This module defines an abstraction over the basic
 facilities of the Java or JavaScript virtual machine,
 containing only functionality that can be easily
 implemented on both platforms. Thus, certain functionality,
 for example, concurrency, for which there is no common
 virtual machine-agnostic model, is not covered by the
 langauge module.

 The language module is an implicit dependency of every
 other Ceylon module, and may not be explicitly imported.

 [spec]: http://ceylon-lang.org/documentation/current/spec"
by ("Gavin King", "Tom Bentley", "Tako Schotanus",
   "Stephane Epardaud", "Enrique Zamudio")
license ("http://www.apache.org/licenses/LICENSE-2.0.html")
module ceylon.language "1.1.0" {}

Fix doc typo: langauge -> language

"The Ceylon language module containing the core definitions
 referred to by the [language specification][spec], along
 with some basic functionality of use to most programs:

 - The [[root package|package ceylon.language]] defines
   general-purpose functionality including support for
   [[numbers|Numeric]] and [[character strings|String]],
   [[streams|Iterable]] and [[sequences|Sequential]],
   [[exceptions|Throwable]], and [[null values|Null]].
 - The Ceylon _metamodel_ is defined in
   [[package ceylon.language.meta]] and its subpackages
   [[package ceylon.language.meta.model]] and
   [[package ceylon.language.meta.declaration]], which
   define interfaces for interacting with applied types and
   unapplied type declarations respectively.

 This module defines an abstraction over the basic
 facilities of the Java or JavaScript virtual machine,
 containing only functionality that can be easily
 implemented on both platforms. Thus, certain functionality,
 for example, concurrency, for which there is no common
 virtual machine-agnostic model, is not covered by the
 language module.

 The language module is an implicit dependency of every
 other Ceylon module, and may not be explicitly imported.

 [spec]: http://ceylon-lang.org/documentation/current/spec"
by ("Gavin King", "Tom Bentley", "Tako Schotanus",
   "Stephane Epardaud", "Enrique Zamudio")
license ("http://www.apache.org/licenses/LICENSE-2.0.html")
module ceylon.language "1.1.0" {}


import ceylon.language.meta.declaration {
    AnnotatedDeclaration
}

"A key by which a [[Node]]’s additional information
 can be accessed."
shared class Key<Type>(name)
        given Type satisfies Object {
    "The name of this key. To avoid collisions
     with other keys, some use-site ID should be
     included, e. g. the name of the module that
     uses this key."
    see (`class ScopedKey`)
    String name;
    "A unique ID of this key, composed of
     the [[name]] argument and the [[Type]] type argument."
    shared String id = "`` `Type`.string ``:::``name``";
    string => id;
    shared actual Boolean equals(Object that) {
        if (is Key<Type> that) {
            return id == that.id;
        } else {
            return false;
        }
    }
    hash => id.hash;
}

"A [[Key]] with an explicitly provided scope, to avoid name collisions."
shared class ScopedKey<Type>(scope, name)
        extends Key<Type>("``scope.string``:::``name.string``")
        given Type satisfies Object {
    "The scope of this key, that is, the declaration
     of the program element that uses it.

     Most commonly the declaration of the enclosing
     class, package or module."
    AnnotatedDeclaration scope;
    "The name of this key.

     Unlike [[Key.name]], this name shouldn’t include some
     use-site ID, because that’s already provided by [[scope]]."
    String name;
}

Add usage example to ScopedKey documentation

import ceylon.language.meta.declaration {
    AnnotatedDeclaration
}

"A key by which a [[Node]]’s additional information
 can be accessed."
shared class Key<Type>(name)
        given Type satisfies Object {
    "The name of this key. To avoid collisions
     with other keys, some use-site ID should be
     included, e. g. the name of the module that
     uses this key."
    see (`class ScopedKey`)
    String name;
    "A unique ID of this key, composed of
     the [[name]] argument and the [[Type]] type argument."
    shared String id = "`` `Type`.string ``:::``name``";
    string => id;
    shared actual Boolean equals(Object that) {
        if (is Key<Type> that) {
            return id == that.id;
        } else {
            return false;
        }
    }
    hash => id.hash;
}

"A [[Key]] with an explicitly provided scope, to avoid name collisions.

 Usage example:

     shared Key<Token[]> tokensKey
             = ScopedKey<Token[]>(`class CeylonParser`, \"tokens\");"
shared class ScopedKey<Type>(scope, name)
        extends Key<Type>("``scope.string``:::``name.string``")
        given Type satisfies Object {
    "The scope of this key, that is, the declaration
     of the program element that uses it.

     Most commonly the declaration of the enclosing
     class, package or module."
    AnnotatedDeclaration scope;
    "The name of this key.

     Unlike [[Key.name]], this name shouldn’t include some
     use-site ID, because that’s already provided by [[scope]]."
    String name;
}


interface SecondOrder<Box>
        given Box<Value> {
    shared formal Box<Float> createBox(Float float);
}

Add test for callable parameters with type parameters

interface SecondOrder<Box>
        given Box<Value> {
    shared formal Box<Float> createBox(Float float);
}
void takesCallableParamWithTypeParam(T f<T>(T t)) {}


import ceylon.io.impl {
    InputStreamAdapter,
    OutputStreamAdapter
}

import java.lang {
    System {
        javaIn=\iin,
        javaOut=\iout,
        javaErr=err
    }
}

"A [[ReadableFileDescriptor]] for the virtual machine's standard input"
ReadableFileDescriptor stdin = InputStreamAdapter(javaIn);

"A [[WritableFileDescriptor]] for the virtual machine's standard output stream."
WritableFileDescriptor stdout = OutputStreamAdapter(javaOut);

"A [[WritableFileDescriptor]] for the virtual machine's standard error stream."
WritableFileDescriptor stderr = OutputStreamAdapter(javaErr);

Fix typo in doc text

import ceylon.io.impl {
    InputStreamAdapter,
    OutputStreamAdapter
}

import java.lang {
    System {
        javaIn=\iin,
        javaOut=\iout,
        javaErr=err
    }
}

"A [[ReadableFileDescriptor]] for the virtual machine's standard input stream."
ReadableFileDescriptor stdin = InputStreamAdapter(javaIn);

"A [[WritableFileDescriptor]] for the virtual machine's standard output stream."
WritableFileDescriptor stdout = OutputStreamAdapter(javaOut);

"A [[WritableFileDescriptor]] for the virtual machine's standard error stream."
WritableFileDescriptor stderr = OutputStreamAdapter(javaErr);


import ceylon.ast.api {
    Type
}
import com.redhat.ceylon.compiler.typechecker.tree {
    Tree {
        JGroupedType=GroupedType,
        JSimpleType=SimpleType,
        JStaticType=StaticType
    }
}
import ceylon.ast.redhat {
    groupedTypeToCeylon,
    createParser,
    simpleTypeToCeylon
}

"Converts a RedHat AST [[StaticType|JStaticType]] to a `ceylon.ast` [[Type]]."
shared Type typeToCeylon(JStaticType type) {
    switch (type)
    case (is JSimpleType) { return simpleTypeToCeylon(type); }
    case (is JGroupedType) { return groupedTypeToCeylon(type); }
    else {
        throw Error("Not yet implemented!"); // TODO
    }
}

"Compiles the given [[code]] for a Type
 into a [[Type]] using the Ceylon compiler
 (more specifically, the rule for a `type`)."
shared Type? compileType(String code) {
    if (exists jType = createParser(code).type()) {
        return typeToCeylon(jType);
    } else {
        return null;
    }
}

Add missing switch type cases to typeToCeylon

import ceylon.ast.api {
    Type
}
import com.redhat.ceylon.compiler.typechecker.tree {
    Tree {
        JGroupedType=GroupedType,
        JIterableType=IterableType,
        JOptionalType=OptionalType,
        JSequenceType=SequenceType,
        JSimpleType=SimpleType,
        JStaticType=StaticType,
        JTupleType=TupleType
    }
}
import ceylon.ast.redhat {
    groupedTypeToCeylon,
    createParser,
    simpleTypeToCeylon
}

"Converts a RedHat AST [[StaticType|JStaticType]] to a `ceylon.ast` [[Type]]."
shared Type typeToCeylon(JStaticType type) {
    switch (type)
    case (is JSimpleType) { return simpleTypeToCeylon(type); }
    case (is JTupleType) { return tupleTypeToCeylon(type); }
    case (is JIterableType) { return iterableTypeToCeylon(type); }
    case (is JGroupedType) { return groupedTypeToCeylon(type); }
    case (is JOptionalType) { return optionalTypeToCeylon(type); }
    case (is JSequenceType) { return sequentialTypeToCeylon(type); }
    else {
        throw Error("Not yet implemented!"); // TODO
    }
}

"Compiles the given [[code]] for a Type
 into a [[Type]] using the Ceylon compiler
 (more specifically, the rule for a `type`)."
shared Type? compileType(String code) {
    if (exists jType = createParser(code).type()) {
        return typeToCeylon(jType);
    } else {
        return null;
    }
}


import ceylon.file { ... }

import java.nio.file { JPath=Path,
                       Files { movePath=move,
                               newDirectoryStream } }

class ConcreteDirectory(JPath jpath)
        extends ConcreteExistingResource(jpath)
        satisfies Directory {
    shared actual Iterable<Path> childPaths(String filter) {
        //TODO: efficient impl
        value sb = SequenceBuilder<Path>();
        value stream = newDirectoryStream(jpath, filter);
        value iter = stream.iterator();
        while (iter.hasNext()) {
            sb.append(ConcretePath(iter.next()));
        }
        stream.close();
        return sb.sequence;
    }
    shared actual Iterable<ExistingResource> children(String filter) {
        return elements { for (p in childPaths(filter))
                 if (is ExistingResource r=p.resource) r };
    }
    shared actual Iterable<File> files(String filter) {
        return elements { for (p in childPaths(filter))
                 if (is File r=p.resource) r };
    }
    shared actual Iterable<Directory> childDirectories(String filter) {
        return elements { for (p in childPaths(filter))
                 if (is Directory r=p.resource) r };
    }
    shared actual Resource childResource(Path|String subpath) {
        return path.childPath(subpath).resource;
    }
    shared actual Directory move(Nil target) {
        return ConcreteDirectory( movePath(jpath, asJPath(target.path)) );
    }
}

Fix for sequenced args and iterables

import ceylon.file { ... }

import java.nio.file { JPath=Path,
                       Files { movePath=move,
                               newDirectoryStream } }

class ConcreteDirectory(JPath jpath)
        extends ConcreteExistingResource(jpath)
        satisfies Directory {
    shared actual Iterable<Path> childPaths(String filter) {
        //TODO: efficient impl
        value sb = SequenceBuilder<Path>();
        value stream = newDirectoryStream(jpath, filter);
        value iter = stream.iterator();
        while (iter.hasNext()) {
            sb.append(ConcretePath(iter.next()));
        }
        stream.close();
        return sb.sequence;
    }
    shared actual Iterable<ExistingResource> children(String filter) {
        return elements { {for (p in childPaths(filter))
                 if (is ExistingResource r=p.resource) r}... };
    }
    shared actual Iterable<File> files(String filter) {
        return elements { {for (p in childPaths(filter))
                 if (is File r=p.resource) r}... };
    }
    shared actual Iterable<Directory> childDirectories(String filter) {
        return elements { {for (p in childPaths(filter))
                 if (is Directory r=p.resource) r}... };
    }
    shared actual Resource childResource(Path|String subpath) {
        return path.childPath(subpath).resource;
    }
    shared actual Directory move(Nil target) {
        return ConcreteDirectory( movePath(jpath, asJPath(target.path)) );
    }
}


import ceylon.test { test }
import ceylon.formatter { FormattingWriter, maxDesire }
import ceylon.formatter.options { parseLineBreakStrategy, FormattingOptions, LineBreakStrategy }
import ceylon.file { Writer }

test
shared void testDumbLineBreaks() {
    object writer satisfies Writer {
        shared actual void destroy() {}
        shared actual void flush() {}
        shared actual void write(String string) {}
        shared actual void writeLine(String line) {}
    }
    FormattingWriter w = FormattingWriter(null, writer, FormattingOptions());

    LineBreakStrategy? dumbLineBreaks = parseLineBreakStrategy("dumb");
    assert (exists dumbLineBreaks);

    assert(exists location1 = dumbLineBreaks.lineBreakLocation([
        w.Token("breakHere", false, 1, maxDesire, maxDesire),
        *{
            for (i in 1..10)
                w.Token("noBreakHere``i``", true, null, maxDesire, maxDesire)
        }], 0, 20), location1 == 1);

    assert(is Null n = dumbLineBreaks.lineBreakLocation([
        for (i in 1..10)
            w.Token("noBreakHere``i``", false, null, maxDesire, maxDesire)
        ], 0, 20));

    SequenceBuilder<FormattingWriter.QueueElement> s = SequenceBuilder<FormattingWriter.QueueElement>();
    for (i in 1..10) {
        s.append(w.Token("noBreakHere``i``", false, null, maxDesire, maxDesire));
    }
    s.append(w.LineBreak());
    assert(exists location2 = dumbLineBreaks.lineBreakLocation(s.sequence, 0, 20), location2 == 10);
}


Add in stub for Cython demo Jupyter notebook


version https://git-lfs.github.com/spec/v1
oid sha256:eef49fd96b60b5aa50e4ae498c57bd0249cf5221f6a37c9fa80542305d52b6df
size 680100

Add command demo for reading object location/rotation.

version https://git-lfs.github.com/spec/v1
oid sha256:bd0c4a31b148895541be44708ebf2e99c6ebe29357c8ba03cdc9aae62a12ad58
size 954767


Copy with only calculations (as best as possible) taken from the clean_copy and adding things from the original master


Test jupyter notebook within sphinx documentation.

# Try to incorporate jupyter notebook into sphinx


def m_init(pos):
x = pos[0]
return (x, 0, 0)


Add initial commit for 'Disentangled Representations for Manipulation of Sentiment in Text'

# Disentangled Representations for Manipulation of Sentiment in Text


{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Fader Networks: Manipulating Images by Sliding Attributes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Main Idea"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Method"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Observations"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".pyenv",
   "language": "python",
   "name": ".pyenv"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}

Add main idea for 'Fader Networks: Manipulating Images by Sliding Attributes'

The authors attempt to disentangle facial features from images and re-generate images after tuning (fader knobs) certain continuous-valued attributes of the image like age, expression, gender etc. This is an encoder-decoder architecture.


{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- COCO (COmparing Continuous Optimisers): http://coco.gforge.inria.fr/\n",
    "- B-BOB\n",
    "    - http://deap.readthedocs.io/en/master/tutorials/advanced/benchmarking.html\n",
    "- https://www.cs.cmu.edu/afs/cs/project/jair/pub/volume24/ortizboyer05a-html/node6.html\n",
    "- Objective functions: http://www-optima.amp.i.kyoto-u.ac.jp/member/student/hedar/Hedar_files/TestGO.htm\n",
    "- ..."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}

Fix the ASCII encoding issue with the clean script.


Add a basic test notebook for nbval testing

<style>
.cm-s-ipython span.cm-variable-3 {
color: #208ffb;
font-weight: bold;
}
</style>

stdout

C++ stdout/stderr capturing has been turned ON

C++ stdout/stderr capturing has been turned OFF

C++ stdout/stderr capturing has been turned ON

C++ stdout/stderr capturing has been turned OFF

C++ stdout/stderr capturing has been turned ON

C++ stdout/stderr capturing has been turned OFF

%pybind11_capture
%pybind11_capture
%pybind11_capture on
%pybind11_capture off
%pybind11_capture 1
%pybind11_capture 0


eng_ones = kampala[kampala['ENG'] == '1']

math_ones = kampala[kampala['MATH'] == '1']

sci_ones = kampala[kampala['SCI'] == '1']

sst_ones = kampala[kampala['SST'] == '1']


Add an example of using db.py for filtering

# automatically reload imports when their files have changed

#adds folder to the search path for 'import'

tree = db.getpasses('allpasses.db', gs='KB9JHU')

# '%' character in SQL means 'any 0 or more characters'

# lazy way instead of using the exact full string

tree = db.getpasses('allpasses.db', gs='KB9JHU', sat='%AO-7%')


Add a new directory for risk score learning.


Add empty notebook for tutorials/phase so sphinx won't complain


Save list of users and numer of emails in csv

from bigbang.archive import load as load_archive

users_count_f = open('../users_count.csv', "wb")

'kimberly.carlson at icann.org (Kimberly Carlson)'


{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- Iris data set: https://en.wikipedia.org/wiki/Iris_flower_data_set\n",
    "- ..."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}

Fix the ASCII encoding issue with the clean script.


Create IPython file for code and tutorial


1.00000e-29 *
2.7413
[torch.FloatTensor of size 1]


Add minimal example using the Cython magic

%%cython -lm
from libc.math cimport sin
print 'sin(1)=', sin(1)


# Fast Fourier Transform (FFT)
[back to main page](index.ipynb)

<img src="http://i.creativecommons.org/p/zero/1.0/88x31.png" style="border-style: none;" alt="CC0" />

has waived all copyright and related or neighboring rights to


2. [Command line tools](command_line_tools/Index.ipynb)


from ipyleaflet import Map, Velocity, TileLayer

m = Map(center=center, zoom=zoom, interpolation='nearest')

wind = Velocity(data=data, max_velocity=15, display_options=display_options)


Add simple IPyNotebook demonstrating execution times of algos.

Input: from sorting import bubble_sort, insertion_sort, merge_sort, quicksort

Input: from time import time

Input: from random import randint

Input: import matplotlib.pyplot as plt

Input: # generate array of random integers

Input: xs = [randint(0, 1e6) for i in range(100000)]

Input: # sort using different methods

Input: times = []

Input: # 1. bubble sort

Input: start = time()

Input: stop = time()

Input: times += [stop - start]

Input: # 2. insertion sort

Input: start = time()

Input: stop = time()

Input: times += [stop - start]

Input: # 3. merge sort

Input: start = time()

Input: stop = time()

Input: times += [stop - start]

Input: # 4. quicksort

Input: start = time()

Input: quicksort(xs)

Input: stop = time()

Input: times += [stop - start]

Input: # plot results

Input: labels = ['bubble', 'insertion', 'merge', 'quicksort']

Input: x = [1,2,3,4]

Input: plt.plot(x, times, 'ro')

Input: _ = plt.xticks(x, labels, rotation=45)

Input: plt.ylabel('Execution time, [sec]')

Input: plt.grid()


Add the ability to specify whether a tensor you send is searchable publicly


Input: # Copyright 2013 Quantopian, Inc.

Input: # Licensed under the Apache License, Version 2.0 (the "License");

Input: # you may not use this file except in compliance with the License.

Input: # You may obtain a copy of the License at

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

Input: # Unless required by applicable law or agreed to in writing, software

Input: # distributed under the License is distributed on an "AS IS" BASIS,

Input: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Input: # See the License for the specific language governing permissions and

Input: # limitations under the License.

Input:
%load_ext autoreload
%autoreload 2

Input:
import datetime
import pandas as pd
from IPython.display import HTML
import answer_key
ANSWER_KEY = answer_key.ANSWER_KEY

Input:
print 'Period Returns Index'
print ANSWER_KEY.RETURNS


Name: dask

Version: 2.12.0

Summary: Parallel PyData with Task Scheduling

Home-page: https://github.com/dask/dask/

Author: None

Author-email: None

License: BSD

Location: /Users/NothingToLose/clepy/myvenv/lib/python3.8/site-packages

Requires:

Required-by:

Name: pandas

Version: 1.0.1

Summary: Powerful data structures for data analysis, time series, and statistics

Home-page: https://pandas.pydata.org

Author: None

Author-email: None

License: BSD

Location: /Users/NothingToLose/clepy/myvenv/lib/python3.8/site-packages

Requires: python-dateutil, numpy, pytz

Required-by:

import pandas as pd
from dask import dataframe as dd


Add another notebook about dates and time (this initial version is almost empty).

2016-01-21 10:55:08.586366


Add notebook for aromatic adjlists in thermo libraries

from rmgpy.data.thermo import ThermoDatabase

from rmgpy.molecule.resonance import generate_aromatic_resonance_structures

databasePath = os.path.join(rmgpy.settings['database.directory'], 'thermo')

database.load(databasePath, libraries=['C10H11', 'Lai_Hexylbenzene', 'Fulvene_H', 'naphthalene_H'])

for name, library in database.libraries.iteritems():

for label, entry in library.entries.iteritems():


ML_100K_FILENAME = ML_100K_URL.rsplit('/', 1)[1]

print('Downloading %s to %s...' % (ML_100K_URL, ML_100K_FILENAME))

print('Extracting %s to %s...' % (ML_100K_FILENAME, ML_100K_FOLDER))


Add notebook for simulations for Fig 3(b) with Nx=200.

Input: !date

Input: from tools import batch_launch

Input: kPluses = np.logspace(0, 4, 20)[[10, 12, 14, 16]][::-1]

Input: kMinuses = np.logspace(6, 9, 20)[[9, 10, 14, 19]]

Input: reason = "Figure 3(b) Nx=200"

Input: for kPlus in kPluses:

Input: for kMinus in kMinuses:

Input: kPlus=kPlus,

Input: kMinus=kMinus,

Input: rboundary=50e-6 / np.sqrt(np.pi),

Fri Nov  1 19:18:50 EDT 2013


This notebook will test your system to check if Anaconda and Py-ART have been installed correctly.  Select the cell below and execute by hitting shift+enter.  If **Ready to go** is printed as the first line, everything is installed correctly.  If **ISSUES** is printed or you get an error, something is mis-configured with your system, ask one of the instructors for help.

print "ISSUES\n\nWrong Py-ART version\n"


these are just some random experiments ...

`ptr` is a separate, non-owning cdata object. It is not pointing to the original data.


A scratch notebook for testing and developing `simmy`.

#This means that modules will be automatically reloaded when changed.

#Makes for swift exporatory development, probably a performance hit if using well-tested code.

test_config = TitanConfig('/home/ajacobs/Research/Projects/Simmy/IPyRoot/TestModel', config_dict)


This notebook contains tests for tohu's primitive generators.

from tohu.v6.primitive_generators import *

from tohu.v6.utils import print_generated_sequence

Tohu version: v0.5.2+65.g5b6573b

`Constant` simply returns the same, constant value every time.

Generated sequence: quux, quux, quux, quux, quux, quux, quux, quux, quux, quux


# Available Measurement Data
[back to overview page](index.ipynb)

QU KEMAR anechoic: https://dev.qu.tu-berlin.de/projects/measurements/wiki/2010-11-kemar-anechoic

KEMAR-BRIRs for 64 loudspeakers, RIRs, etc.: http://dx.doi.org/10.14279/depositonce-87.2

The FABIAN head-related transfer function data base: http://dx.doi.org/10.14279/depositonce-5718

<img src="http://i.creativecommons.org/p/zero/1.0/88x31.png" style="border-style: none;" alt="CC0" />

with this work has waived all copyright and related or neighboring


*The `pandas` library provides high-performance, easy-to-use data structures and data analysis tools.*


Test running python notebook from Github

Hello World!


Add Jupyter notebooks dir with example template

console.log("JupyROOT - %%cpp magic configured");

Welcome to JupyROOT 6.09/03


Add still empty tutorial ipython notebook

This notebook introduces the basic functionalities of pymofa, the python modeling framework to run and evaluate your models systematically ;)


Add notebook with a signal processing link

has waived all copyright and related or neighboring rights to


# ★ Trigonometric Interpolation And The FFT ★


Add another notebook about random numbers (this initial version is almost empty).

## Return a random floating point number in the range [0.0, 1.0)

## Return a random integer from a given interval

min_value = 0
max_value = 10
random.randint(min_value, max_value)


Add second notebook: get OECD metropolitan areas

# -*- coding: UTF-8 -*-
# Render our plots inline
%matplotlib inline
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import re

# Demographic Statistics_TL3: Regional typology (urban=1/intermediate=2/rural=3,4,5)

data = pd.read_csv("list-of-municipalities-in-functional-urban-areas.csv", encoding="utf-8")


Several sets of test data were used to ensure the accuracy of each of the algorithms. These test data were comprised of arrays of values with known maximum sub-array solutions. These test sets were run through each algorithm, and the output was compared to the known solution.

Along with the provided set of test cases, several additional test cases were generated in order to test the algorithm accuracy under very specific conditions. Some examples of these test cases include:

* The trivial case of a single array element

* Arrays with a single positive value as the first or last element (to test the handling of the boundaries)

* Arrays with a single positive value in the middle of the arrary

* Arrays where the running sum reaches 0 at some point (i.e. multiple maximum sum sub-arrays possible)

All algorithms correctly solved all of the test data sets.


#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

FROM fedora
MAINTAINER Justin Ross <jross@apache.org>

RUN dnf -qy update && dnf -q clean all

RUN dnf -qy install findutils make python-qpid-proton && dnf -q clean all

COPY . /root/qtools

ARG CACHE_BUST=1
RUN cd /root/qtools && make install PREFIX=/usr

WORKDIR /root
CMD ["qtools-test"]

Disable delta rpms for the fedora tests

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

FROM fedora
MAINTAINER Justin Ross <jross@apache.org>

RUN dnf -qy --setopt deltarpm=0 update && dnf -q clean all

RUN dnf -qy --setopt deltarpm=0 install findutils make python-qpid-proton && dnf -q clean all

COPY . /root/qtools

ARG CACHE_BUST=1
RUN cd /root/qtools && make install PREFIX=/usr

WORKDIR /root
CMD ["qtools-test"]


ARG base_image="python:3.8"
FROM $base_image

ARG python_version="3.8"
ARG abi="38"

# Needed to disable interactive configuration by tzdata.
RUN ln -fs /usr/share/zoneinfo/Europe/Dublin /etc/localtime

RUN apt-get update && apt-get install -y --no-install-recommends \
  byobu \
  tmux \
  xterm

RUN python${python_version} -mpip install --upgrade setuptools wheel pytype==2021.1.28

COPY dist /tmp/launchpad

RUN WHL=`ls /tmp/launchpad/*${abi}*.whl` && python${python_version} -mpip install $WHL[tensorflow,reverb]

WORKDIR /

Fix nightly build for 3.9 Python (pytype==2021.1.28 is not known there).

ARG base_image="python:3.8"
FROM $base_image

ARG python_version="3.8"
ARG abi="38"

# Needed to disable interactive configuration by tzdata.
RUN ln -fs /usr/share/zoneinfo/Europe/Dublin /etc/localtime

RUN apt-get update && apt-get install -y --no-install-recommends \
  byobu \
  tmux \
  xterm

RUN python${python_version} -mpip install --upgrade setuptools wheel attrs==20.3.0 pytype

COPY dist /tmp/launchpad

RUN WHL=`ls /tmp/launchpad/*${abi}*.whl` && python${python_version} -mpip install $WHL[tensorflow,reverb]

WORKDIR /


FROM ubuntu:20.04

ENV \
    #
    # Some APT packages like 'tzdata' wait for user input on install by default.
    # https://stackoverflow.com/questions/44331836/apt-get-install-tzdata-noninteractive
    DEBIAN_FRONTEND=noninteractive \
    LANG=C.UTF-8 \
    LANGUAGE=C.UTF-8 \
    LC_ALL=C.UTF-8

RUN \
    apt-get update -q && \
    apt-get install -qy --no-install-recommends \
        #
        # Cloning the repository
        git \
        ca-certificates \
        #
        # Running mach with Python 2
        python2 \
        python2-dev \
        python-is-python2 \
        #
        # Running mach with Python 3
        python3 \
        python3-pip \
        python3-dev \
        virtualenv \
        #
        # Compiling C modules when installing Python packages in a virtualenv
        gcc \
        #
        # Installing rustup and sccache (build dockerfile) or fetching build artifacts (run tasks)
        curl \
        # Setting the default locale
        locales \
        locales-all \
    && \
    #
    # Python 2 bits that have been removed from Ubuntu packages
    curl https://bootstrap.pypa.io/get-pip.py -sSf -o get-pip.py && \
    python2 get-pip.py && \
    python2 -m pip install virtualenv

Use 2.7-compatible get-pip in docker build.

FROM ubuntu:20.04

ENV \
    #
    # Some APT packages like 'tzdata' wait for user input on install by default.
    # https://stackoverflow.com/questions/44331836/apt-get-install-tzdata-noninteractive
    DEBIAN_FRONTEND=noninteractive \
    LANG=C.UTF-8 \
    LANGUAGE=C.UTF-8 \
    LC_ALL=C.UTF-8

RUN \
    apt-get update -q && \
    apt-get install -qy --no-install-recommends \
        #
        # Cloning the repository
        git \
        ca-certificates \
        #
        # Running mach with Python 2
        python2 \
        python2-dev \
        python-is-python2 \
        #
        # Running mach with Python 3
        python3 \
        python3-pip \
        python3-dev \
        virtualenv \
        #
        # Compiling C modules when installing Python packages in a virtualenv
        gcc \
        #
        # Installing rustup and sccache (build dockerfile) or fetching build artifacts (run tasks)
        curl \
        # Setting the default locale
        locales \
        locales-all \
    && \
    #
    # Python 2 bits that have been removed from Ubuntu packages
    curl https://bootstrap.pypa.io/2.7/get-pip.py -sSf -o get-pip.py && \
    python2 get-pip.py && \
    python2 -m pip install virtualenv


FROM ubuntu:bionic-20200403

ENV \
    #
    # Some APT packages like 'tzdata' wait for user input on install by default.
    # https://stackoverflow.com/questions/44331836/apt-get-install-tzdata-noninteractive
    DEBIAN_FRONTEND=noninteractive \
    LANG=C.UTF-8 \
    LANGUAGE=C.UTF-8 \
    LC_ALL=C.UTF-8

RUN \
    apt-get update -q && \
    apt-get install -qy --no-install-recommends \
        #
        # Cloning the repository
        git \
        ca-certificates \
        #
        # Running mach with Python 2
        python \
        python-pip \
        python-dev \
        python-virtualenv \
        #
        # Running mach with Python 3
        python3 \
        python3-pip \
        python3-dev \
        virtualenv \
        #
        # Compiling C modules when installing Python packages in a virtualenv
        gcc \
        #
        # Installing rustup and sccache (build dockerfile) or fetching build artifacts (run tasks)
        curl \
        # Setting the default locale
        locales \
        locales-all

Use newer Ubuntu docker image.

FROM ubuntu:eoan-20200608

ENV \
    #
    # Some APT packages like 'tzdata' wait for user input on install by default.
    # https://stackoverflow.com/questions/44331836/apt-get-install-tzdata-noninteractive
    DEBIAN_FRONTEND=noninteractive \
    LANG=C.UTF-8 \
    LANGUAGE=C.UTF-8 \
    LC_ALL=C.UTF-8

RUN \
    apt-get update -q && \
    apt-get install -qy --no-install-recommends \
        #
        # Cloning the repository
        git \
        ca-certificates \
        #
        # Running mach with Python 2
        python \
        python-pip \
        python-dev \
        python-virtualenv \
        #
        # Running mach with Python 3
        python3 \
        python3-pip \
        python3-dev \
        virtualenv \
        #
        # Compiling C modules when installing Python packages in a virtualenv
        gcc \
        #
        # Installing rustup and sccache (build dockerfile) or fetching build artifacts (run tasks)
        curl \
        # Setting the default locale
        locales \
        locales-all


FROM ubuntu:bionic-20200403

ENV \
    #
    # Some APT packages like 'tzdata' wait for user input on install by default.
    # https://stackoverflow.com/questions/44331836/apt-get-install-tzdata-noninteractive
    DEBIAN_FRONTEND=noninteractive

RUN \
    apt-get update -q && \
    apt-get install -qy --no-install-recommends \
        #
        # Cloning the repository
        git \
        ca-certificates \
        #
        # Running mach with Python 2
        python \
        python-pip \
        python-dev \
        python-virtualenv \
        #
        # Running mach with Python 3
        python3 \
        python3-pip \
        python3-dev \
        virtualenv \
        #
        # Compiling C modules when installing Python packages in a virtualenv
        gcc \
        #
        # Installing rustup and sccache (build dockerfile) or fetching build artifacts (run tasks)
        curl

Set docker image locale to UTF-8.

FROM ubuntu:bionic-20200403

ENV \
    #
    # Some APT packages like 'tzdata' wait for user input on install by default.
    # https://stackoverflow.com/questions/44331836/apt-get-install-tzdata-noninteractive
    DEBIAN_FRONTEND=noninteractive \
    LANG=C.UTF-8 \
    LANGUAGE=C.UTF-8 \
    LC_ALL=C.UTF-8

RUN \
    apt-get update -q && \
    apt-get install -qy --no-install-recommends \
        #
        # Cloning the repository
        git \
        ca-certificates \
        #
        # Running mach with Python 2
        python \
        python-pip \
        python-dev \
        python-virtualenv \
        #
        # Running mach with Python 3
        python3 \
        python3-pip \
        python3-dev \
        virtualenv \
        #
        # Compiling C modules when installing Python packages in a virtualenv
        gcc \
        #
        # Installing rustup and sccache (build dockerfile) or fetching build artifacts (run tasks)
        curl \
        # Setting the default locale
        locales \
        locales-all


FROM ubuntu:18.04

ARG uid=1000

RUN apt-get update && \
    apt-get install -y \
      pkg-config \
      libssl-dev \
      curl \
      libsqlite3-dev \
      cmake \
      python3-pip \
      debhelper \
      devscripts \
      libncursesw5-dev \
      libzmq3-dev \
      libsodium-dev

RUN pip3 install -U \
	pip \
	twine \
	plumbum \
	deb-pkg-tools

RUN apt-get update && apt-get install -y --no-install-recommends \
        ruby \
        ruby-dev \
        rubygems \
    && gem install --no-ri --no-rdoc rake fpm \
    && rm -rf /var/lib/apt/lists/*

# install java and maven
RUN apt-get update && apt-get install openjdk-8-jdk -y
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
RUN apt-get update && apt-get install -y maven

# install nodejs and npm
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -y nodejs

RUN apt-get install -y wget

RUN useradd -ms /bin/bash -u $uid indy
USER indy

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.39.0
ENV PATH /home/indy/.cargo/bin:$PATH

WORKDIR /home/indy

Remove devscirpts from Ubuntu 18.04 CI dockerimage to avoid 2 versions of libssl in the setup.

FROM ubuntu:18.04

ARG uid=1000

RUN apt-get update && \
    apt-get install -y \
      pkg-config \
      libssl-dev \
      curl \
      libsqlite3-dev \
      cmake \
      python3-pip \
      debhelper \
      libncursesw5-dev \
      libzmq3-dev \
      libsodium-dev

RUN pip3 install -U \
	pip \
	twine \
	plumbum \
	deb-pkg-tools

RUN apt-get update && apt-get install -y --no-install-recommends \
        ruby \
        ruby-dev \
        rubygems \
    && gem install --no-ri --no-rdoc rake fpm \
    && rm -rf /var/lib/apt/lists/*

# install java and maven
RUN apt-get update && apt-get install openjdk-8-jdk -y
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
RUN apt-get update && apt-get install -y maven

# install nodejs and npm
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -y nodejs

RUN apt-get install -y wget

RUN useradd -ms /bin/bash -u $uid indy
USER indy

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.39.0
ENV PATH /home/indy/.cargo/bin:$PATH

WORKDIR /home/indy


FROM ubuntu-upstart:14.04
MAINTAINER MidoNet (http://midonet.org)

# Configure cassandra repos
RUN echo "deb http://debian.datastax.com/community 2.0 main" > /etc/apt/sources.list.d/cassandra.list

RUN apt-get install -qqy curl
RUN curl -L http://debian.datastax.com/debian/repo_key | apt-key add -

RUN apt-get -q update && \
    apt-get install -qqy openjdk-7-jre-headless && \
    apt-get install -qqy dsc20 && \
    apt-mark hold dsc20 cassandra

ADD bin/run-cassandra.sh /run-cassandra.sh

# Expose all cassandra ports
EXPOSE 7000 7001 7199 9042 9160

CMD ["/run-cassandra.sh"]

Add apt-get update so curl happily installs

FROM ubuntu-upstart:14.04
MAINTAINER MidoNet (http://midonet.org)

# Configure cassandra repos
RUN echo "deb http://debian.datastax.com/community 2.0 main" > /etc/apt/sources.list.d/cassandra.list

RUN apt-get update
RUN apt-get install -qqy curl
RUN curl -L http://debian.datastax.com/debian/repo_key | apt-key add -

RUN apt-get -q update && \
    apt-get install -qqy openjdk-7-jre-headless && \
    apt-get install -qqy dsc20 && \
    apt-mark hold dsc20 cassandra

ADD bin/run-cassandra.sh /run-cassandra.sh

# Expose all cassandra ports
EXPOSE 7000 7001 7199 9042 9160

CMD ["/run-cassandra.sh"]


FROM hyperledger/indy-core-baseci:0.0.3-master
LABEL maintainer="Hyperledger <hyperledger-indy@lists.hyperledger.org>"

ARG uid=1000
ARG user=indy
ARG venv=venv

RUN echo "To invalidate cache"

RUN apt-get update -y && apt-get install -y \
    python3-nacl \
    libindy=1.13.0~1420 \
# rocksdb python wrapper
    libbz2-dev \
    zlib1g-dev \
    liblz4-dev \
    libsnappy-dev \
    ursa=0.3.2-2  \
    rocksdb=5.8.8

RUN indy_ci_add_user $uid $user $venv

RUN indy_image_clean

USER $user
WORKDIR /home/$user

# TODO: This needs to be removed after ursa python wrapper is fixed
RUN git clone https://github.com/hyperledger/ursa-python.git
RUN pip install -e ursa-python

Remove hacks to install python ursa wrapper


FROM hyperledger/indy-core-baseci:0.0.3-master
LABEL maintainer="Hyperledger <hyperledger-indy@lists.hyperledger.org>"

ARG uid=1000
ARG user=indy
ARG venv=venv

RUN echo "To invalidate cache"

RUN apt-get update -y && apt-get install -y \
    python3-nacl \
    libindy=1.13.0~1420 \
    libssl-dev \
# rocksdb python wrapper
    libbz2-dev \
    zlib1g-dev \
    liblz4-dev \
    libsnappy-dev \
    ursa=0.3.2-1  \
    rocksdb=5.8.8

RUN indy_ci_add_user $uid $user $venv

RUN indy_image_clean

USER $user
WORKDIR /home/$user

Remove dev dependency on libssl

FROM hyperledger/indy-core-baseci:0.0.3-master
LABEL maintainer="Hyperledger <hyperledger-indy@lists.hyperledger.org>"

ARG uid=1000
ARG user=indy
ARG venv=venv

RUN echo "To invalidate cache"

RUN apt-get update -y && apt-get install -y \
    python3-nacl \
    libindy=1.13.0~1420 \
# rocksdb python wrapper
    libbz2-dev \
    zlib1g-dev \
    liblz4-dev \
    libsnappy-dev \
    ursa=0.3.2-1  \
    rocksdb=5.8.8

RUN indy_ci_add_user $uid $user $venv

RUN indy_image_clean

USER $user
WORKDIR /home/$user