text:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="catalog.xsl" ?>
<catalog version="0.4">
  <datatypes>
     <datatype name="Bool">
       <constructor name="False" signature="Bool"/>
       <constructor name="True" signature="Bool"/>
     </datatype>
     <datatype name="Ordering">
       <constructor name="LT" signature="Ordering"/>
       <constructor name="EQ" signature="Ordering"/>
       <constructor name="GT" signature="Ordering"/>
     </datatype>
     <datatype name="Maybe" typeArity="1">
       <constructor name="Nothing" signature="Maybe x"/>
       <constructor name="Just" signature="x -> Maybe x"/>
     </datatype>
     <datatype name="Either" typeArity="2">
       <constructor name="Left" signature="l -> Either l r"/>
       <constructor name="Right" signature="r -> Either l r"/>
     </datatype>
     <datatype name="[]" typeArity="1">
       <constructor name="[]" signature="[a]"/>
       <constructor name="(:)" signature="a -> [a] -> [a]"/>
     </datatype>
     <datatype name="Int" builtin="true"/>
     <datatype name="Integer" builtin="true"/>
     <datatype name="Char" builtin="true"/>
     <datatype name="Float" builtin="true"/>
     <datatype name="Int" builtin="true"/>
     <datatype name="Double" builtin="true"/>
     <datatype name="()" typeArity="0">
       <constructor name="()" signature="()"/>
     </datatype>
     <datatype name="(,)" typeArity="2">
       <constructor name="(,)" signature="a -> b -> (a,b)"/>
     </datatype>
     <datatype name="(,,)" typeArity="3">
       <constructor name="(,,)" signature="a -> b -> c -> (a,b,c)"/>
     </datatype>
     <datatype name="(,,,)" typeArity="4">
       <constructor name="(,,,)" signature="a -> b -> c -> d -> (a,b,c,d)"/>
     </datatype>
     <datatype name="(,,,,)" typeArity="5">
       <constructor name="(,,,,)" signature="a -> b -> c -> d -> e ->(a,b,c,d,e)"/>
     </datatype>
     <datatype name="IO" builtin="true" typeArity="1"/>
  </datatypes>

  <classes>
    <class name="Eq" default="Int">
      <instance name="Int"/>
      <instance name="Integer"/>
      <instance name="Ordering"/>
      <instance name="Float"/>
      <instance name="Double"/>
      <instance name="Char"/>
      <instance name="Bool"/>
      <instance name="[]" constrainedArgs="1"/>
      <instance name="Maybe" constrainedArgs="1"/>
      <instance name="Either" constrainedArgs="2"/>
      <instance name="()"/>
      <instance name="(,)" constrainedArgs="2"/>
      <instance name="(,,)" constrainedArgs="3"/>
      <instance name="(,,,)" constrainedArgs="4"/>
      <instance name="(,,,,)" constrainedArgs="5"/>
    </class>
    <class name="Ord" default="Int">
      <superClass name="Eq"/>
      <instance name="Ordering"/>
      <instance name="Bool"/>
      <instance name="Char"/>
      <instance name="Double"/>
      <instance name="Float"/>
      <instance name="Int"/>
      <instance name="Integer"/>
      <instance name="[]" constrainedArgs="1"/>
      <instance name="Maybe" constrainedArgs="1"/>
      <instance name="Either" constrainedArgs="2"/>
      <instance name="()"/>
      <instance name="(,)" constrainedArgs="2"/>
      <instance name="(,,)" constrainedArgs="3"/>
      <instance name="(,,,)" constrainedArgs="4"/>
      <instance name="(,,,,)" constrainedArgs="5"/>
    </class>
    <class name="Enum" default="Int">
      <instance name="Ordering"/>
      <instance name="Integer"/>
      <instance name="Int"/>
      <instance name="Char"/>
      <instance name="Bool"/>
      <instance name="Float"/>
      <instance name="Double"/>
      <instance name="()"/>
    </class>
    <class name="Bounded" default="Int">
      <instance name="Ordering"/>
      <instance name="Int"/>
      <instance name="Char"/>
      <instance name="Bool"/>
      <instance name="()"/>
      <instance name="(,)" constrainedArgs="2"/>
      <instance name="(,,)" constrainedArgs="3"/>
      <instance name="(,,,)" constrainedArgs="4"/>
      <instance name="(,,,,)" constrainedArgs="5"/>
    </class>
    <class name="Num" default="Int">
      <instance name="Int"/>
      <instance name="Integer"/>
      <instance name="Float"/>
      <instance name="Double"/>
    </class>
    <class name="Fractional" default="Double">
      <superClass name="Num"/>
      <instance name="Float"/>
      <instance name="Double"/>
    </class>
    <class name="Floating">
      <superClass name="Fractional"/>
      <instance name="Float"/>
      <instance name="Double"/>
    </class>
    <class name="Real">
      <superClass name="Num"/>
      <superClass name="Ord"/>
      <instance name="Int"/>
      <instance name="Integer"/>
      <instance name="Float"/>
      <instance name="Double"/>
    </class>
    <class name="Integral" default="Int">
      <superClass name="Enum"/>
      <superClass name="Real"/>
      <instance name="Int"/>
      <instance name="Integer"/>
    </class>
    <class name="RealFrac">
      <superClass name="Fractional"/>
      <superClass name="Real"/>
      <instance name="Float"/>
      <instance name="Double"/>
    </class>
    <class name="RealFloat">
      <superClass name="Floating"/>
      <superClass name="RealFrac"/>
      <instance name="Float"/>
      <instance name="Double"/>
    </class>
    <class name="Show">
      <instance name="Ordering"/>
      <instance name="Integer"/>
      <instance name="Int"/>
      <instance name="Char"/>
      <instance name="Bool"/>
      <instance name="Float"/>
      <instance name="Double"/>
      <instance name="[]" constrainedArgs="1"/>
      <instance name="Maybe" constrainedArgs="1"/>
      <instance name="Either" constrainedArgs="2"/>
      <instance name="()"/>
      <instance name="(,)" constrainedArgs="2"/>
      <instance name="(,,)" constrainedArgs="3"/>
      <instance name="(,,,)" constrainedArgs="4"/>
      <instance name="(,,,,)" constrainedArgs="5"/>
    </class>
    <class name="Read">
      <instance name="Ordering"/>
      <instance name="Integer"/>
      <instance name="Int"/>
      <instance name="Char"/>
      <instance name="Bool"/>
      <instance name="Float"/>
      <instance name="Double"/>
      <instance name="[]" constrainedArgs="1"/>
      <instance name="Maybe" constrainedArgs="1"/>
      <instance name="Either" constrainedArgs="2"/>
      <instance name="()"/>
      <instance name="(,)" constrainedArgs="2"/>
      <instance name="(,,)" constrainedArgs="3"/>
      <instance name="(,,,)" constrainedArgs="4"/>
      <instance name="(,,,,)" constrainedArgs="5"/>
    </class>
    <class name="Monoid">
      <instance name="Ordering"/>
      <instance name="Maybe" constrainedArgs="1"/>
      <instance name="IO"/>
      <instance name="[]"/>
      <instance name="()"/>
      <instance name="(,)" constrainedArgs="2"/>
      <instance name="(,,)" constrainedArgs="3"/>
      <instance name="(,,,)" constrainedArgs="4"/>
      <instance name="(,,,,)" constrainedArgs="5"/>
    </class>
    <class name="Functor" default="[]">
      <instance name="Maybe"/>
      <instance name="IO"/>
      <instance name="[]"/>
    </class>
    <class name="Applicative" default="Maybe">
      <superClass name="Functor"/>
      <instance name="Maybe"/>
      <instance name="IO"/>
      <instance name="[]"/>
    </class>
    <class name="Monad">
      <superClass name="Applicative"/>
      <instance name="Maybe"/>
      <instance name="IO"/>
      <instance name="[]"/>
    </class>
    <class name="MonadPlus">
      <superClass name="Monad"/>
      <instance name="Maybe"/>
      <instance name="[]"/>
    </class>
    <class name="Alternative">
      <superClass name="Applicative"/>
      <instance name="Maybe"/>
      <instance name="[]"/>
    </class>
    <class name="Foldable" default="[]">
      <instance name="Maybe"/>
      <instance name="[]"/>
    </class>
    <class name="Traversable">
      <superClass name="Functor"/>
      <superClass name="Foldable"/>
      <instance name="Maybe"/>
      <instance name="[]"/>
    </class>
    <class name="Arbitrary">
      <instance name="Ordering"/>
      <instance name="Integer"/>
      <instance name="Int"/>
      <instance name="Char"/>
      <instance name="Bool"/>
      <instance name="Float"/>
      <instance name="Double"/>
      <instance name="[]" constrainedArgs="1"/>
      <instance name="Maybe" constrainedArgs="1"/>
      <instance name="Either" constrainedArgs="2"/>
      <instance name="()"/>
      <instance name="(,)" constrainedArgs="2"/>
      <instance name="(,,)" constrainedArgs="3"/>
      <instance name="(,,,)" constrainedArgs="4"/>
      <instance name="(,,,,)" constrainedArgs="5"/>
    </class>
  </classes>

  <functions>
    <category name="Comparison, logic" isCommon="true">
      <function name="(==)" signature="Eq e => e -> e -> Bool" isCommon="true"/>
      <function name="(/=)" signature="Eq e => e -> e -> Bool" isCommon="true"/>
      <function name="(<)" signature="Ord o => o -> o -> Bool"/>
      <function name="(<=)" signature="Ord o => o -> o -> Bool"/>
      <function name="(>)" signature="Ord o => o -> o -> Bool"/>
      <function name="(>=)" signature="Ord o => o -> o -> Bool"/>
      <function name="max" signature="Ord o => o -> o -> o" isCommon="true"/>
      <function name="min" signature="Ord o => o -> o -> o" isCommon="true"/>
      <function name="(&&)" signature="Bool -> Bool -> Bool" isCommon="true">
        and
      </function>
      <function name="(||)" signature="Bool -> Bool -> Bool" isCommon="true">
        or
      </function>
      <function name="not" signature="Bool -> Bool" isCommon="true">
        not
      </function>
      <function name="True" signature="Bool" isConstructor="true" isCommon="true">
        A true value.
      </function>
      <function name="False" signature="Bool" isConstructor="true" isCommon="true">
        A false value.
      </function>
      <function name="LT" signature="Ordering" isConstructor="true">
        Less than
      </function>
      <function name="EQ" signature="Ordering" isConstructor="true">
        Equal to
      </function>
      <function name="GT" signature="Ordering" isConstructor="true">
        Greater than
      </function>
      <function name="compare" signature="Ord o => o -> o -> Ordering"/>
      <function name="comparing" signature="Ord o => (e -> o) -> e -> e -> Ordering"/>
    </category>

    <category name="Enum, conversions">
      <function name="show" signature="Show a => a -> [Char]" isCommon="true">
        a specialised variant of showsPrec, using precedence context zero, and
        returning an ordinary [Char].
      </function>
      <function name="read" signature="Read a => [Char] -> a" isCommon="true">
        the read function reads input from a string, which must be completely consumed by the input process.
      </function>
      <function name="succ" signature="Enum e => e -> e" isCommon="true">
        The successor of a value.
      </function>
      <function name="pred" signature="Enum e => e -> e" isCommon="true">
        The predecessor of a value.
      </function>
      <function name="toEnum" signature="Enum e => Int -> e" isCommon="true">
        Convert from an Int.
      </function>
      <function name="fromEnum" signature="Enum e => e -> Int" isCommon="true">
        Convert to an Int. It is implementation-dependent what fromEnum returns when applied to a value that is too large to fit in an Int.
      </function>
      <function name="enumFrom" signature="Enum e => e -> [e]" isCommon="true">
        Used in Haskell's translation of [n..].
      </function>
      <function name="enumFromTo" signature="Enum e => e -> e -> [e]" isCommon="true">
        used in Haskell's translation of [n..m].
      </function>
      <function name="enumFromThen" signature="Enum e => e -> e -> [e]">
        used in Haskell's translation of [n, n'..].
      </function>
      <function name="enumFromThenTo" signature="Enum e => e -> e -> e -> [e]">
        used in Haskell's translation of [n, n'..m].
      </function>
      <function name="fromInteger" signature="Num n => Integer -> n">
        Conversion from an Integer. An integer literal represents the application of the
        function fromInteger to the appropriate value of type Integer, so such literals have
        type (Num a) => a.
      </function>
      <function name="toRational" signature="Real r => r -> Rational">
        the rational equivalent of its real argument with full precision.
      </function>
      <function name="fromRational" signature="Fractional f => Rational -> f">
        Conversion from a Rational (that is Ratio Integer).
      </function>
      <function name="toInteger" signature="Integral i => i -> Integer">
        Conversion to Integer.
      </function>
      <function name="fromIntegral" signature="(Num n, Integral i) => i -> n" isCommon="true">
        general coercion from integral types.
      </function>
      <function name="realToFrac" signature="(Real r, Fractional f) => r -> f">
        general coercion to fractional types
      </function>
      <function name="minBound" signature="Bounded e => e"/>
      <function name="maxBound" signature="Bounded e => e"/>
      <function name="digitToInt" signature="Char -> Int"/>
      <function name="intToDigit" signature="Int -> Char"/>
      <function name="chr" signature="Int -> Char"/>
      <function name="ord" signature="Char -> Int"/>
      <function name="toUpper" signature="Char -> Char"/>
      <function name="toLower" signature="Char -> Char"/>
    </category>

    <category name="Arithmetic" isCommon="true">
      <function name="(+)" signature="Num n => n -> n -> n" isCommon="true">
        Mathematical addition.
      </function>
      <function name="(*)" signature="Num n => n -> n -> n" isCommon="true">
        Mathematical multiplication.
      </function>
      <function name="(-)" signature="Num n => n -> n -> n" isCommon="true">
        Mathematical subtraction.
      </function>
      <function name="negate" signature="Num n => n -> n" isCommon="true">
        Unary negation.
      </function>
      <function name="abs" signature="Num n => n -> n" isCommon="true">
        Absolute value.
      </function>
      <function name="signum" signature="Num n => n -> n">
        Sign of a number.
      </function>
      <function name="quot" signature="Integral i => i -> i -> i">
        integer division truncated toward zero.
      </function>
      <function name="rem" signature="Integral i => i -> i -> i">
        integer remainder, satisfying (x 'quot' y)*y + (x 'rem' y) == x.
      </function>
      <function name="div" signature="Integral i => i -> i -> i" isCommon="true">
        integer division truncated toward negative infinity.
      </function>
      <function name="mod" signature="Integral i => i -> i -> i" isCommon="true">
        integer modulus, satisfying (x 'div' y)*y + (x 'mod y) == x.
      </function>
      <function name="even" signature="Integral i => i -> Bool" isCommon="true"/>
      <function name="odd" signature="Integral i => i -> Bool" isCommon="true"/>
      <function name="gcd" signature="Integral i => i -> i -> i">
        gcd x y is the non-negative factor of both x and y of which every common factor of x and
        y is also a factor; for example gcd 4 2 = 2, gcd (-4) 6 = 2, gcd 0 4 = 4. gcd 0 0
        = 0. (That is, the common divisor that is "greatest" in the divisibility preordering.)

        Note: Since for signed fixed-width integer types, abs minBound < 0, the result may be
        negative if one of the arguments is minBound (and necessarily is if the other is 0 or
        minBound) for such types.
      </function>
      <function name="lcm" signature="Integral i => i -> i -> i">
        lcm x y is the smallest positive integer that both x and y divide.
      </function>
      <function name="(^)" signature="(Num n, Integral i) => n -> i -> n">
        raise a number to an non-negative integral power.
      </function>
    </category>

    <category name="Floating point">
      <function name="(/)" signature="Fractional a => a -> a -> a" isCommon="true">
        fractional division.
      </function>
      <function name="recip" signature="Fractional a => a -> a">
        reciprocal division.
      </function>
      <function name="pi" signature="Floating a => a" isCommon="true"/>
      <function name="exp" signature="Floating a => a -> a" isCommon="true"/>
      <function name="log" signature="Floating a => a -> a" isCommon="true"/>
      <function name="sqrt" signature="Floating a => a -> a" isCommon="true"/>
      <function name="(**)" signature="Floating a => a -> a -> a" isCommon="true"/>
      <function name="logBase" signature="Floating a => a -> a -> a"/>
      <function name="sin" signature="Floating a => a -> a" isCommon="true"/>
      <function name="cos" signature="Floating a => a -> a" isCommon="true"/>
      <function name="tan" signature="Floating a => a -> a" isCommon="true"/>
      <function name="asin" signature="Floating a => a -> a"/>
      <function name="acos" signature="Floating a => a -> a"/>
      <function name="atan" signature="Floating a => a -> a"/>
      <function name="properFraction" signature="(RealFrac a, Integral i) => a -> (i, a)">
        The function properFraction takes a real fractional number x and returns a pair (n,f) such that x = n+f, and:
        - n is an integral number with the same sign as x; and
        - f is a fraction with the same type and sign as x; and with absolute value less than 1.
      </function>
      <function name="truncate" signature="(RealFrac a, Integral i) => a -> i">
        truncate x returns the integer nearest x between zero and x
      </function>
      <function name="round" signature="(RealFrac a, Integral i) => a -> i" isCommon="true">
        round x returns the nearest integer to x; the even integer if x is equidistant between two integers.
      </function>
      <function name="ceiling" signature="(RealFrac a, Integral i) => a -> i">
        ceiling x returns the least integer not less than x.
      </function>
      <function name="floor" signature="(RealFrac a, Integral i) => a -> i">
        floor x returns the greatest integer not greater than x.
      </function>
      <function name="isNaN" signature="RealFloat a => a -> Bool">
        True if the argument is an IEEE "not-a-number" (NaN) value.
      </function>
      <function name="isInfinite" signature="RealFloat a => a -> Bool">
        True if the argument is an IEEE infinity or negative infinity
      </function>
      <function name="(^^)" signature="(Integral i, Fractional a) => a -> i -> a" isCommon="true">
        raise a number to an integral power
      </function>
    </category>

    <category name="Functor and co.">
      <function name="fmap" signature="Functor f => (a -> b) -> f a -> f b" isCommon="true">
        Map over a functor.
      </function>
      <function name="(<$)" signature="Functor f => a -> f b -> f a"/>
      <function name="(<$>)" signature="Functor f => (a -> b) -> f a -> f b" isCommon="true"/>
      <function name="pure" signature="Applicative f => a -> f a" isCommon="true"/>
      <function name="(<*>)" signature="Applicative f => f (a -> b) -> f a -> f b" isCommon="true"/>
      <function name="(>>=)" signature="Monad m => m a -> (a -> m b) -> m b" isCommon="true"/>
      <function name="(>>)" signature="Monad m => m a -> m b -> m b"/>
      <function name="return" signature="Monad m => a -> m a" isCommon="true"/>
      <function name="liftA2" signature="Applicative f => (a -> b -> c) -> f a -> f b -> f c" isCommon="true"/>
      <function name="liftA3" signature="Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d"/>
      <function name="empty" signature="Alternative f => f a"/>
      <function name="(<|>)" signature="Alternative f => f a -> f a -> f a"/>
      <function name="mapM" signature="Monad m => (a -> m b) -> [a] -> m [b]" isCommon="true"/>
      <function name="mapM_" signature="Monad m => (a -> m b) -> [a] -> m ()"/>
      <function name="sequence" signature="Monad m => [m a] -> m [a]"/>
      <function name="sequence_" signature="Monad m => [m a] -> m ()"/>
    </category>

    <category name="List reductions">
      <function name="foldr" signature="(a -> b -> b) -> b -> [a] -> b" isCommon="true">
        Right-associative fold of a structure.
      </function>
      <function name="foldl" signature="(b -> a -> b) -> b -> [a] -> b" isCommon="true">
        Left-associative fold of structure.
      </function>
      <function name="foldr1" signature="(a -> a -> a) -> [a] -> a">
        A variant of foldr that has no base case, an thus may only be applied to non-empty structures.
      </function>
      <function name="foldl1" signature="(a -> a -> a) -> [a] -> a">
        A variant of foldl that has no base case, and thus may only be applied to non-empty structures.
      </function>
      <function name="maximum" signature="Ord a => [a] -> a" isCommon="true">
        The largest element of a non-empty structure.
      </function>
      <function name="minimum" signature="Ord a => [a] -> a" isCommon="true">
        The least element of a non-empty structure.
      </function>
      <function name="sum" signature="Num a => [a] -> a" isCommon="true">
        The sum function computes the sum of the numbers of a structure.
      </function>
      <function name="product" signature="Num a => [a] -> a" isCommon="true">
        The product function computes the product of the numbers of a structure.
      </function>
      <function name="and" signature="[Bool] -> Bool" isCommon="true">
        and returns the conjuction of a container of Bools. For the result to be True, the
        container must be finite; False, however, results from a False value finitely far from
        the left end.
      </function>
      <function name="or" signature="[Bool] -> Bool" isCommon="true">
        or returns the disjunction of a container of Bools. For the result to be False, the
        container must be finite; True, however, results from a True value finitely far from
        the left end.
      </function>
      <function name="any" signature="(e -> Bool) -> [e] -> Bool" isCommon="true">
        Determines whether any element of the structure satisfies the predicate.
      </function>
      <function name="all" signature="(e -> Bool) -> [e] -> Bool" isCommon="true">
        Determines whether all elements of the structure satisfy the pradicate.
      </function>
      <function name="scanl" signature="(b -> a -> b) -> b -> [a] -> [b]">
        scanl is similar to foldl, but returns a list of successive reduced values from the left.
      </function>
      <function name="scanl1" signature="(a -> a -> a) -> [a] -> [a]">
        scanl1 is a variant of scanl that has no starting value argument.
      </function>
      <function name="scanr" signature="(a -> b -> b) -> b -> [a] -> [b]">
        scanr is the right-to-left dual of scanl.
      </function>
      <function name="scanr1" signature="(a -> a -> a) -> [a] -> [a]">
        scanr1 is a variant of scanr that has no starting value argument.
      </function>
      <function name="mappend" signature="Monoid a => [a] -> a"/>
      <function name="foldl'" signature="(b -> a -> b) -> b -> [a] -> b" isCommon="true"/>
      <function name="foldl1'" signature="(a -> a -> a) -> [a] -> a"/>
      <function name="mapAccumL" signature="(acc -> x -> (acc, y)) -> acc -> [x] -> (acc, [y])"/>
      <function name="mapAccumR" signature="(acc -> x -> (acc, y)) -> acc -> [x] -> (acc, [y])"/>
    </category>

    <category name="Utility functions" isCommon="true">
      <function name="id" signature="x -> x" isCommon="true">
        identity function.
      </function>
      <function name="const" signature="k -> x -> k" isCommon="true">
        constant function.
      </function>
      <function name="(.)" signature="(b -> c) -> (a -> b) -> a -> c" isCommon="true">
        Function composition
      </function>
      <function name="flip" signature="(a -> b -> c) -> b -> a -> c" isCommon="true">
        flip f takes its (first) two arguments in the reverse order of f.
      </function>
      <function name="($)" signature="(a -> b) -> a -> b" isCommon="true">
        Application operator. This operator is used to apply user defined functions, since ordinary application (f x) means
        the same as (f $ x). However, $ has low, right-associative binding precedence, so it
        sometimes allows parentheses to be omitted.
      </function>
      <function name="fst" signature="(a, x) -> a" isCommon="true">
        Extract the first component of a pair.
      </function>
      <function name="snd" signature="(x, b) -> b" isCommon="true">
        Extract the second component of a pair
      </function>
      <function name="curry" signature="((a, b) -> c) -> a -> b -> c" isCommon="true">
        curry converts an uncurried function to a curried function
      </function>
      <function name="uncurry" signature="(a -> b -> c) -> (a, b) -> c" isCommon="true">
        uncurry converts a curried function to a function on pairs
      </function>
      <function name="until" signature="(a -> Bool) -> (a -> a) -> a -> a">
        until p f yields the result of applying f until p holds.
      </function>
      <function name="undefined" signature="x">
        A special case of error. It is expected that compilers will recognize this and insert error
        messages which are more appropriate to the context in which undefined appears.
      </function>
      <function name="seq" signature="a -> b -> b">
        The value of seq a b is bottom if a is bottom, and otherwise equal to b. seq is usually
        introduced to improve performance by avoiding unneeded laziness.
      </function>
      <function name="($!)" signature="(a -> b) -> a -> b">
        Strict (call-by-value) application operator. It takes a function and an argument, evaluates the
        argument to weak head normal form (WHNF), then calls the function with that value.
      </function>
      <function name="mempty" signature="Monoid m => m" isCommon="true"/>
      <function name="mappend" signature="Monoid m => m -> m -> m" isCommon="true"/>
      <function name="on" signature="(b -> b -> c) -> (a -> b) -> a -> a -> c"/>
      <function name="fix" signature="(a -> a) -> a"/>
    </category>

    <category name="Basic datatypes" isCommon="true">
      <function name="()" signature="()" isConstructor="true" isCommon="true"/>
      <function name="(,)" signature="a -> b -> (a, b)" isConstructor="true" isCommon="true"/>
      <function name="(,,)" signature="a -> b -> c -> (a, b, c)" isConstructor="true"/>
      <function name="(,,,)" signature="a -> b -> c -> d -> (a, b, c, d)" isConstructor="true"/>
      <function name="(,,,,)" signature="a -> b -> c -> d -> e -> (a, b, c, d, e)" isConstructor="true"/>

      <function name="Nothing" signature="Maybe x" isConstructor="true" isCommon="true"/>
      <function name="Just" signature="x -> Maybe x" isConstructor="true" isCommon="true"/>
      <function name="maybe" signature="r -> (x -> r) -> Maybe x -> r" isCommon="true"/>
      <function name="isJust" signature="Maybe x -> Bool" isCommon="true"/>
      <function name="isNothing" signature="Maybe x -> Bool"/>
      <function name="fromJust" signature="Maybe x -> x" isCommon="true"/>
      <function name="fromMaybe" signature="x -> Maybe x -> x" isCommon="true"/>
      <function name="maybeToList" signature="Maybe x -> [x] "/>
      <function name="listToMaybe" signature="[x] -> Maybe x "/>
      <function name="catMaybes" signature="[Maybe x] -> [x] " isCommon="true"/>

      <function name="Left" signature="l -> Either l r" isConstructor="true"/>
      <function name="Right" signature="l -> Either l r" isConstructor="true"/>
      <function name="either" signature="(l -> x) -> (r -> x) -> Either l r -> x" isCommon="true"/>
      <function name="lefts" signature="[Either l r] -> [l]"/>
      <function name="rights" signature="[Either l r] -> [r]"/>
      <function name="isLeft" signature="Either l r -> Bool"/>
      <function name="isRight" signature="Either l r -> Bool"/>
      <function name="partitionEithers" signature="[Either l r] -> ([l],[r])"/>
    </category>

    <category name="Basic list operations" isCommon="true">
      <function name="[]" signature="[a]" isConstructor="true" isCommon="true">
      	An empty list.
      </function>
      <function name="(:)" signature="a -> [a] -> [a]" isConstructor="true" isCommon="true">
        prepend an element to a list.
      </function>
      <function name="map" signature="(a -> b) -> [a] -> [b]" isCommon="true">
        map f xs is the list obtained by applying f to each element of xs.
      </function>
      <function name="(++)" signature="[a] -> [a] -> [a]" isCommon="true">
        append two lists.
      </function>
      <function name="filter" signature="(a -> Bool) -> [a] -> [a]" isCommon="true">
        filter, applied to predicate and a list, returns the list of those elements that satisfy the predicate.
      </function>
      <function name="head" signature="[a] -> a" isCommon="true">
        Extract the first element of a list, which must be non-empty.
      </function>
      <function name="last" signature="[a] -> a" isCommon="true">
        Extract the last element of a list, which must be finite and non-empty.
      </function>
      <function name="tail" signature="[a] -> [a]" isCommon="true">
        Extract the elements after the head of a list, which must be non-empty.
      </function>
      <function name="init" signature="[a] -> [a]" isCommon="true">
        Return all the elements of a list except the last one. The list must be non-empty.
      </function>
      <function name="(!!)" signature="[a] -> Int -> a" isCommon="true">
        List index (subscript) operator, starting from 0. It is an instance of the more general genericIndex, which takes an index of any integral type.
      </function>
      <function name="reverse" signature="[a] -> [a]" isCommon="true">
        reverse xs returns the elements of xs in reverse order. xs must be finite.
      </function>
      <function name="concat" signature="[[a]] -> [a]" isCommon="true">
        The concatenation of all the elements of a container of lists.
      </function>
      <function name="concatMap" signature="([a] -> [b]) -> [a] -> [b]" isCommon="true">
        Map a function over all the elements of a container and concatenate the resulting.
      </function>
      <function name="iterate" signature="(a -> a) -> a -> [a]">
        iterate f x returns an infinite list of repeated applications of f to x
      </function>
      <function name="repeat" signature="a -> [a]">
        repeat x is an infinite list, with x the value of every element.
      </function>
      <function name="replicate" signature="Int -> a -> [a]">
        replicate n x is a list of length n with x the value of every element.
        It is an instance of the more general genericReplicate, in which n may be of any integral type.
      </function>
      <function name="take" signature="Int -> [a] -> [a]" isCommon="true">
        take n, applied to a list xs, returns the prefix of xs of length n, or xs itself if n > length xs.
      </function>
      <function name="drop" signature="Int -> [a] -> [a]" isCommon="true">
        drop n xs returns the suffix of xs after the first n elements, or [] if n > length xs.
      </function>
      <function name="zip" signature="[a] -> [b] -> [(a, b)]" isCommon="true">
        zip takes two lists and returns a list of corresponding pairs. If one input list is short,
        excess elements of the longer list are discarded.
      </function>
      <function name="zipWith" signature="(a -> b -> c) -> [a] -> [b] -> [c]" isCommon="true">
        zipWith generalises zip by zipping with the function given as the first argument, instead of a tupling function.
        For example, zipWith (+) is applied to two lists to produce the list of corresponding sums.
      </function>
      <function name="unzip" signature="[(a, b)] -> ([a], [b])" isCommon="true">
        unzip transforms a list of pairs into a list of first components and a list of second
        components.
      </function>
      <function name="null" signature="[x] -> Bool">
        Test whether the structure is empty. The default implementation is optimized for
        structures that are similar to cons-lists, because there is no general way to do better.
      </function>
      <function name="length" signature="[x] -> Int" isCommon="true">
        Returns the size/length of a finite structure as an Int. The default implementation is
        optimized for structures that are similar to cons-lists, because there is no general way to
        do better.
      </function>
      <function name="elem" signature="Eq e => e -> [e] -> Bool" isCommon="true">
        Does the element occur in the structure?
      </function>
      <function name="notElem" signature="Eq e => e -> [e] -> Bool">
        notElem is the negation of elem.
      </function>
      <function name="group" signature="Eq a => [e] -> [[e]]"/>
      <function name="insert" signature="Ord e => e -> [e] -> [e]"/>
      <function name="nub" signature="Eq e => [e] -> [e]"/>
      <function name="sort" signature="Ord e => [e] -> [e]"/>
    </category>

    <category name="More list operations">
      <function name="cycle" signature="[a] -> [a]">
        cycle ties a finite list into a circular one, or equivalently, the infinite repetition of the orignal list. It is de identity on infinite lists.
      </function>
      <function name="splitAt" signature="Int -> [a] -> ([a], [a])" isCommon="true">
        splitAt n xs returns a tuple where first element is xs prefix of length n and second element is the remainder of the list.
      </function>
      <function name="takeWhile" signature="(a -> Bool) -> [a] -> [a]" isCommon="true">
        takeWhile, applied to a predicate p and a list xs, returns the longest prefix (possibly empty) of xs of elements that satisfy p.
      </function>
      <function name="dropWhile" signature="(a -> Bool) -> [a] -> [a]" isCommon="true">
        dropWhile p returns the suffix remaning after takeWhile p xs.
      </function>
      <function name="span" signature="(a -> Bool) -> [a] -> ([a], [a])">
        span, applied to a predicate p and a list xs, returns a tuple where first element is longest prefix (possibly empty)
        of xs of elements that satisfy p and second element is the remainder of the list.
      </function>
      <function name="break" signature="(a -> Bool) -> [a] -> ([a], [a])">
        break, applied to a predicate p and a list xs, returns a tuple where first element is
        longest prefix (possibly empty) of xs of element that do not satisfy p and second element is the remainder of the list.
      </function>
      <function name="zip3" signature="[a] -> [b] -> [b] -> [(a, b, c)]">
        zip3 takes three lists and returns a list of triples, analogous to zip.
      </function>
      <function name="zipWith3" signature="(a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]">
        The zipWith3 function takes a function which combines three elements, as well as three
        lists and returns a list of their point-wise combination, analogous to zipWith.
      </function>
      <function name="unzip3" signature="[(a, b, c)] -> ([a], [b], [c])">
        the unzip3 function takes a list of triples and returns three lists, analogous to unzip.
      </function>
      <function name="lookup" signature="Eq a => a -> [(a, b)] -> Maybe b" isCommon="true">
        lookup key assocs looks up a key in an association list.
      </function>
      <function name="lines" signature="[Char] -> [[Char]]">
        lines breaks a string up into a list of strings at newline characters.
        The resulting strings do not contain newlines.
      </function>
      <function name="words" signature="[Char] -> [[Char]]">
        words breaks a string up into a list of words, which were delimited by white space.
      </function>
      <function name="unlines" signature="[[Char]] -> [Char]">
        unlines is an inverse operation to lines. It joins lines, after appending a
        terminating newline to each.
      </function>
      <function name="unwords" signature="[[Char]] -> [Char]">
        unwords is an inverse operation to words. It joins words with separating spaces.
      </function>
      <function name="(\\)" signature="Eq a => [a] -> [a] -> [a]" isCommon="true"/>
      <function name="delete" signature="Eq a => a -> [a] -> [a]" isCommon="true"/>
      <function name="deleteBy" signature="(a -> a -> Bool) -> a -> [a] -> [a]"/>
      <function name="elemIndex" signature="Eq a => a -> [a] -> Maybe Int" isCommon="true"/>
      <function name="elemIndices" signature="Eq a => a -> [a] -> [Int]"/>
      <function name="find" signature="(a -> Bool) -> [a] -> Maybe a" isCommon="true"/>
      <function name="findIndex" signature="(a -> Bool) -> [a] -> Maybe Int" isCommon="true"/>
      <function name="findIndices" signature="(a -> Bool) -> [a] -> [Int]"/>
      <function name="groupBy" signature="(a -> a -> Bool) -> [a] -> [[a]]" isCommon="true"/>
      <function name="inits" signature="[a] -> [[a]]" isCommon="true"/>
      <function name="insertBy" signature="(a -> a -> Ordering) -> a -> [a] -> [a]"/>
      <function name="intercalate" signature="[a] -> [[a]] -> [a]"/>
      <function name="intersect" signature="Eq a => [a] -> [a] -> [a]" isCommon="true"/>
      <function name="intersectBy" signature="(a -> a -> Bool) -> [a] -> [a] -> [a]"/>
      <function name="intersperse" signature="a -> [a] -> [a]"/>
      <function name="isInfixOf" signature="Eq a => [a] -> [a] -> Bool"/>
      <function name="isPrefixOf" signature="Eq a => [a] -> [a] -> Bool" isCommon="true"/>
      <function name="nubBy" signature="(a -> a -> Bool) -> [a] -> [a]"/>
      <function name="partition" signature="(a -> Bool) -> [a] -> ([a], [a])"/>
      <function name="permutations" signature="[a] -> [[a]]"/>
      <function name="sortBy" signature="(a -> a -> Ordering) -> [a] -> [a]" isCommon="true"/>
      <function name="subsequences" signature="[a] -> [[a]]"/>
      <function name="tails" signature="[a] -> [[a]]" isCommon="true"/>
      <function name="transpose" signature="[[a]] -> [[a]]" isCommon="true"/>
      <function name="unfoldr" signature="(b -> Maybe (a, b)) -> b -> [a]" isCommon="true"/>
      <function name="union" signature="Eq a => [a] -> [a] -> [a]" isCommon="true"/>
      <function name="unionBy" signature="(a -> a -> Bool) -> [a] -> [a] -> [a]"/>

    </category>
  </functions>
</catalog>


text:
namespace ork {

///////////////////////////////////////////////////////////////////////////

OpGroup::OpGroup(OpMultiQ*popq, const char* pname)
	: mpOpQ(popq)
	, mLimitMaxOpsInFlight(0)
	, mLimitMaxOpsQueued(0)
	, mGroupName(pname)
	, mEnabled(true)
{
	mOpsPendingCounter.set(0);
	mOpsInFlightCounter.set(0);
	mOpSerialIndex.set(0);
}

///////////////////////////////////////////////////////////////////////////

void OpGroup::push(const Op& the_op)
{
	if( mEnabled )
	{
		////////////////////////////////
		// throttle it (limit number of ops in queue)
		////////////////////////////////
		if( mLimitMaxOpsQueued )
		{
			int index = 0;
			while( mOpsPendingCounter.get() > mLimitMaxOpsQueued )
			{
				//printf( "mOpsPendingCounter<%d> mLimitMaxOpsQueued<%d>\n", mOpsPendingCounter.get(), mLimitMaxOpsQueued );
				dispersed_sleep(index++,30);
			}
		}
		////////////////////////////////

		mOpsPendingCounter.fetch_and_increment();
		mOpSerialIndex.fetch_and_increment();

		mOps.push(the_op);

		mpOpQ->notify_one();
	}
}

///////////////////////////////////////////////////////////////////////////

void OpGroup::drain()
{
	int index = 0;
	while(mOpsPendingCounter.get()>0)
	{
		//dispersed_sleep(index++,10);
		usleep(100);
	}
	//printf( "OpGroup::drain count<%d>\n", int(mSynchro.mOpCounter));
	//OpqDrained pred_is_drained;
	//mSynchro.WaitOnCondition(pred_is_drained);
}

void OpGroup::notify_op_complete()
{
	mOpsPendingCounter.fetch_and_decrement();
}

///////////////////////////////////////////////////////////////////////////

bool OpGroup::try_pop( Op& out_op )
{
	bool rval = mOps.try_pop(out_op);

	return rval;
}

///////////////////////////////////////////////////////////////////////////
} // namespace ork

redpajama_set_name: RedPajamaGithub


text:
export GCP_PROJECT_DIR=$(PWD)
export GCP_ARTIFACTS_DIR=${GCP_PROJECT_DIR}/artififacts
export GCP_GSDATA_DIR=${GCP_ARTIFACTS_DIR}/gsdata
[ -f ${GCP_GSDATA_DIR} ] || mkdir -p ${GCP_GSDATA_DIR}

###################
## Customization ##
###################
# GCP Configuration, i.e. GCP project conf
# See https://cloud.google.com/sdk/gcloud/reference/topic/configurations
export GCP_CONFIGURATION=default
export GCP_KEY_FILE=project.json
export GCP_PROJECT_ID=my-project-2016
export GCP_ZONE=us-central1-a
export GCP_ENVIRONMENT=dev  # one of (dev, stage, prod)
export GCP_DNS_ZONE=<example-com>
export GCP_DNS_DOMAIN=<example.com>
export GCP_CLUSTER_NAME=<cluster_name>
export GCP_GSDATA_BUCKET=${GCP_PROJECT_ID}-gsdata

##########################
## End of customization ##
##########################


text:
package vgrechka.phizdetsidea.phizdets.psi;

/**
 * @author yole
 */
public interface PyPrintStatement extends PyStatement {
}


text:
  Signed in as {{user ? user.displayName : 'Anonymous'}}.
  <button mat-button
          class="user__sign-out"
          (click)="signOut()">Sign out</button>

  <mat-form-field class="new-todo-field">
    <input matInput
           type="text"
           placeholder="New To-Do.."
           [(ngModel)]="newTodoTitle"
           (keyup.enter)="createTodo()">
  </mat-form-field>

<mat-list>
  <app-todo *ngFor="let todo of todos; trackBy: trackByTodos"
            [item]="todo"
            (updateRequest)="updateTodo(todo, $event)"
            (deleteRequest)="deleteTodo(todo)"></app-todo>
</mat-list>


text:
CREATE DATABASE restfulmlb;

\c restfulmlb

CREATE TABLE players (id SERIAL PRIMARY KEY, name VARCHAR(255), number integer, weight integer, age integer, throws CHAR(1), bats CHAR(1), batting_average decimal, rbi integer, home_runs integer, steals integer, on_base_percentage decimal, walks integer, position CHAR(2));


text:
import amulet
import unittest

TIMEOUT = 1800

class TestDeploy(unittest.TestCase):
    """
    Deployment test for Apache Zookeeper quorum
    """

    @classmethod
    def setUpClass(cls):
        cls.d = amulet.Deployment(series='xenial')

        cls.d.add('zookeeper', charm='zookeeper', units=3)

        cls.d.setup(timeout=TIMEOUT)
        cls.d.sentry.wait_for_messages({'zookeeper': 'ready (3 units)'},
                                       timeout=TIMEOUT)
        cls.unit = cls.d.sentry['zookeeper'][0]

    def test_deploy(self):
        """Verify zk quorum is running"""
        output, retcode = self.unit.run("pgrep -a java")
        assert 'QuorumPeerMain' in output, "Zookeeper QuorumPeerMain daemon is not started"

    def test_quorum(self):
        """
        Verify that our peers are talking to each other, and taking on
        appropriate roles.
        """
        for unit in self.d.sentry['zookeeper']:
            output, _ = unit.run(
                "/usr/lib/zookeeper/bin/zkServer.sh status"
            )
            # Unit should be a leader or follower
            self.assertTrue("leader" in output or "follower" in output)

    def test_smoke(self):
        """Validates Zookeeper using the Bigtop 'zookeeper' smoke test."""
        smk_uuids = []

        for unit in self.d.sentry['zookeeper']:
            smk_uuids.append(unit.run_action('smoke-test'))

        for smk_uuid in smk_uuids:
            # 'zookeeper' smoke takes a while (bigtop tests are slow)
            result = self.d.action_fetch(smk_uuid, timeout=1800, full_output=True)
            # actions set status=completed on success
            if (result['status'] != "completed"):
                self.fail('Zookeeper smoke-test failed: %s' % result)

if __name__ == '__main__':
    unittest.main()


text:
#include "Anything.h"
#include "Context.h"
#include "StringStream.h"
#include "Renderer.h"
#include "TestSuite.h"
#include "FormRenderer.h"
#include "TextFieldRendererTest.h"

TextFieldRendererTest::TextFieldRendererTest (TString tname) : FieldRendererTest(tname)
{
	fFieldRenderer = new (coast::storage::Global()) TextFieldRenderer("TextFieldRenderer");
};

TextFieldRendererTest::~TextFieldRendererTest()
{
	if (fFieldRenderer) {
		delete fFieldRenderer;
	}
	fFieldRenderer = 0;
};

void TextFieldRendererTest::setUp ()
{

}

void TextFieldRendererTest::TestCase0()
{
	fCurrentTestMethod = "TextField-TestCase0";
	this->TestField0();
	assertCharPtrEqual( _QUOTE_(<INPUT TYPE="PASSWORD" NAME="fld_the name of field" VALUE="the value of field" SIZE="50" MAXLENGTH="40" the options of field>), fReply.str() );

}

void TextFieldRendererTest::TestCase1()
{
	fCurrentTestMethod = "TextField-TestCase1";
	this->TestField1();
	assertCharPtrEqual( _QUOTE_(<INPUT TYPE="PASSWORD" NAME="fld_the name of field" VALUE="the value of field" SIZE="50" MAXLENGTH="40" 0="the option nr. 0 of field" 1="the option nr. 1 of field" 2="the option nr. 2 of field">), fReply.str() );

}

void TextFieldRendererTest::TestOptionRenderer()
{
	fCurrentTestMethod = "TextField-OptionRendere";
	this->TestFieldOptionRenderer();
	assertCharPtrEqual( _QUOTE_(<INPUT TYPE="PASSWORD" NAME="fld_the name of field" VALUE="the value of field" SIZE="50" MAXLENGTH="40" 0="the option nr. 0 of field" 1="07.08.97" 2="the option nr. 2 of field">), fReply.str() );

}

void TextFieldRendererTest::TestOptionRendererOld()
{
	fCurrentTestMethod = "TextField-OptionRendere";
	this->TestFieldOptionRendererOld();
	assertCharPtrEqual( _QUOTE_(<INPUT TYPE="PASSWORD" NAME="fld_the name of field" VALUE="the value of field" SIZE="50" MAXLENGTH="40" 0="the option nr. 0 of field" 1="07.08.97" 2="the option nr. 2 of field">), fReply.str() );

}

void TextFieldRendererTest::TestValue()
{
	fCurrentTestMethod = "TextField-TestCase1";
	this->TestFieldValue();
	assertCharPtrEqual( _QUOTE_(<INPUT TYPE="TEXT" NAME="fld_the name of field" VALUE="the value of field">), fReply.str() );

}

void TextFieldRendererTest::TestUnreadable()
{
	fCurrentTestMethod = "TextField-Unreadable";
	this->TestFieldUnreadable();
	assertCharPtrEqual( _QUOTE_(<INPUT TYPE="PASSWORD" NAME="fld_the name of field">), fReply.str() );

}

void TextFieldRendererTest::TestSize()
{
	fCurrentTestMethod = "TextField-Size";
	this->TestFieldSize();
	assertCharPtrEqual( _QUOTE_(<INPUT TYPE="TEXT" NAME="fld_the name of field" SIZE="50">), fReply.str() );

}

void TextFieldRendererTest::TestMaxlength()
{
	fCurrentTestMethod = "TextField-Maxlength";
	this->TestFieldMaxlength();
	assertCharPtrEqual( _QUOTE_(<INPUT TYPE="TEXT" NAME="fld_the name of field" MAXLENGTH="40">), fReply.str() );

}

void TextFieldRendererTest::Options4TextArea()
// test the date renderer with simple formatting strings
{
	fCurrentTestMethod = "TextField-Test4Opt";
	this->TestField4Opt();
	assertEqual( _QUOTE_(<INPUT TYPE="TEXT" NAME="fld_the name of field" 0="the option nr. 0 of field" 1="the option nr. 1 of field" 2="the option nr. 2 of field" 3="the option nr. 3 of field">), fReply.str());

}

void TextFieldRendererTest::Options3TextArea()
// test the date renderer with simple formatting strings
{
	fCurrentTestMethod = "TextField-Test3Opt";
	this->TestField3Opt();
	assertEqual( _QUOTE_(<INPUT TYPE="TEXT" NAME="fld_the name of field" 0="the option nr. 0 of field" 1="the option nr. 1 of field" 2="the option nr. 2 of field">), fReply.str());

}

void TextFieldRendererTest::Options2TextArea()
// test the date renderer with simple formatting strings
{
	fCurrentTestMethod = "TextField-Test2Opt";
	this->TestField2Opt();
	assertEqual( _QUOTE_(<INPUT TYPE="TEXT" NAME="fld_the name of field" 0="the option nr. 0 of field" 1="the option nr. 1 of field">), fReply.str());

}

void TextFieldRendererTest::Option1TextArea()
// test the date renderer with simple formatting strings
{
	fCurrentTestMethod = "TextField-Test1Opt";
	this->TestField1Opt();
	assertEqual( _QUOTE_(<INPUT TYPE="TEXT" NAME="fld_the name of field" 0="the option nr. 0 of field">), fReply.str());

}

void TextFieldRendererTest::OptionsNoSlotName2TextArea()
// test the date renderer with simple formatting strings
{
	fCurrentTestMethod = "TextField-Test2OptNoSlotName";
	this->TestField2OptNoSlotName();
	assertEqual( _QUOTE_(<INPUT TYPE="TEXT" NAME="fld_the name of field" the option nr. 0 of field the option nr. 1 of field>), fReply.str());

}

void TextFieldRendererTest::OptionNoSlotName1TextArea()
// test the date renderer with simple formatting strings
{
	fCurrentTestMethod = "TextField-Test1OptNoSlotName";
	this->TestField1OptNoSlotName();
	assertEqual( _QUOTE_(<INPUT TYPE="TEXT" NAME="fld_the name of field" the option nr. 0 of field>), fReply.str());

}

void TextFieldRendererTest::OptionsMixedTextArea()
// test the date renderer with simple formatting strings
{
	fCurrentTestMethod = "TextField-Test3OptMixed";
	this->TestField3OptMixed();
	assertEqual( _QUOTE_(<INPUT TYPE="TEXT" NAME="fld_the name of field" the option nr. 0 of field 1="the option nr. 1 of field" the option nr. 2 of field>), fReply.str());

}

void TextFieldRendererTest::NoOptionsTextArea()
// test the date renderer with simple formatting strings
{
	fCurrentTestMethod = "TextField-TestOptEmpty";
	this->TestFieldOptEmpty();
	assertEqual( _QUOTE_(<INPUT TYPE="TEXT" NAME="fld_the name of field">), fReply.str());

}

Test *TextFieldRendererTest::suite ()
{
	TestSuite *testSuite = new TestSuite;

	ADD_CASE(testSuite, TextFieldRendererTest, TestCase0);
	ADD_CASE(testSuite, TextFieldRendererTest, TestCase1);
	ADD_CASE(testSuite, TextFieldRendererTest, TestValue);
	ADD_CASE(testSuite, TextFieldRendererTest, TestOptionRenderer);
	ADD_CASE(testSuite, TextFieldRendererTest, TestOptionRendererOld);
	ADD_CASE(testSuite, TextFieldRendererTest, TestUnreadable);
	ADD_CASE(testSuite, TextFieldRendererTest, TestSize);
	ADD_CASE(testSuite, TextFieldRendererTest, TestMaxlength);
	ADD_CASE(testSuite, TextFieldRendererTest, Options4TextArea);
	ADD_CASE(testSuite, TextFieldRendererTest, Options3TextArea);
	ADD_CASE(testSuite, TextFieldRendererTest, Options2TextArea);
	ADD_CASE(testSuite, TextFieldRendererTest, Option1TextArea);
	ADD_CASE(testSuite, TextFieldRendererTest, OptionsNoSlotName2TextArea);
	ADD_CASE(testSuite, TextFieldRendererTest, OptionNoSlotName1TextArea);
	ADD_CASE(testSuite, TextFieldRendererTest, OptionsMixedTextArea);
	ADD_CASE(testSuite, TextFieldRendererTest, NoOptionsTextArea);

	return testSuite;
}


text:
#ifndef MITKPIXELMANIPULATIONTOOL_H
#define MITKPIXELMANIPULATIONTOOL_H

#include "mitkTool.h"
#include <MitkSegmentationExports.h>

#include "itkImage.h"

namespace mitk
{
  class Image;

  class MitkSegmentation_EXPORT PixelManipulationTool : public Tool
  {
  public:
    mitkClassMacro(PixelManipulationTool, Tool);
    itkFactorylessNewMacro(Self)
    itkCloneMacro(Self)

    void SetValue( int value );
    int GetValue();

    void SetFixedValue( int value );
    int GetFixedValue();

    virtual const char* GetName() const;
    virtual const char** GetXPM() const;

    virtual void Activated();
    virtual void Deactivated();

    virtual void CalculateImage();

  protected:
    PixelManipulationTool();
    virtual ~PixelManipulationTool();

    virtual void OnRoiDataChanged();
    void AddImageToDataStorage(itk::SmartPointer<mitk::Image> image);

    template <typename TPixel, unsigned int VImageDimension>
    void ITKPixelManipulation( itk::Image<TPixel, VImageDimension>* originalImage, Image* maskImage, Image* newImage, int newValue);

    mitk::DataNode::Pointer m_OriginalImageNode;
    int m_Value;
    bool m_FixedValue;
  };//clas
}//namespace
#endif


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Classes vs Modules</title>
  <link rel="stylesheet" type="text/css" href="../stylesheets/default.css">
 <link href='http://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css'>
  <link href='http://fonts.googleapis.com/css?family=PT+Serif' rel='stylesheet' type='text/css'>

Matt Leo

        Home
        About
        Resume
        Projects
        Blog
        Contact

Classes vs. Modules

8/16/15

Classes and modules share similarities in Ruby but are utilized in very different ways - let's compare.

Classes

Classes are instantiated and create a new object within Ruby. A class consists of methods, constants, and variables. Think of a class as the blueprints required to create a new object. Let's use an example:

class Car

   def initialize(brand, name)

      @brand = brand

      @name = name

   end

   def vroom

      puts 'Vroooom!'

   end

   def details

      puts "This fine car is a #{@brand} #{@name}."

   end

end

Within the class Car are 3 methods: initialize, vroom, and details. All three methods create the behaviors of the class Car. In order to use a class, you must instantiate it with the following:

          my_car = Car.new(Ford, Mustang)

This code creates a new instance of the class Car called my_car and assigns (Ford, Mustang) to the instance variables (@brand, @name). Since my_car is an object, methods can be called upon it. For example:

my_car.details will puts This fine car is a Ford Mustang.

Modules

Unlike classes, modules cannot be instantiated. Think of modules as libraries that hold bundles of methods, constants, and classes. Let's look at the Ruby Math module as an example:

module Math

   PI = 3.141592654

end

There are other constants and methods within this module but we will keep it simple for now and only refer to the constant PI. Since we cannot instantiate a module, we must extract its data differently than we would for a class. Here are two simple ways access PI:

puts Math::PI

#=> 3.141592653589793

include Math

puts PI

#=> 3.141592653589793

The first example uses the constant lookup operator (::). This allows you to scope constants and classes within a module. The second example uses include which allows the mix in of modules into classes.


text:
namespace lum{
    void upload_mat(GLuint texture_id, const cv::Mat & im) {
        GLuint err = glGetError();
        if (err) {
            fprintf(stderr, "Before texture upload: %d\n", err);
        }
        assert(im.type() == CV_32FC3); // expect BGR floating point image for simplicity
        glBindTexture(GL_TEXTURE_2D, texture_id);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, im.cols, im.rows, 0, GL_BGR, GL_FLOAT, im.data);
        err = glGetError();
        if (err) {
            fprintf(stderr, "After texture upload: %d\n", err);
        }
    }
}


text:
<?php class member_model extends CI_Model {

    //Ensemble des attributs de membre
    protected $table = 'member';
    public $firstname;
    public $name;
    public $mail;
    public $login;
    public $password;
    public $admin;
    public $state;

    public function __construct() {

        parent::__construct();
    }

    //Récupérer un membre
    public function get($id){
       return $this->db->get_where($this->table, array('id_member'=>$id))->row();
    }

    //Vérification de mail
    public function verifMail($mail){
        $mail = $this->db->get_where($this->table, array('mail'=>$mail))->row();
        if ($mail!=null) {
            return $mail;
        }
        else
            return null;
    }

    //Vérification du login
    public function verifLogin($login){
            $login = $this->db->get_where($this->table, array('login'=>$login))->row();
            if ($login!=null) {
                return $login;
            }
            else
                return null;
        }

        //Récupération de l'ensemble des membres
    public function get_all() {
        $query = $this->db->get($this->table);
        return $query->result();
    }

    //Login suivant le login et password
     public function login($login, $password)
    {

         $query = $this->db->get_where($this->table, array('login'=>$login, 'password'=>md5($password)))->row();

            if($query!=null)
            {
                return $query;
            }
            else
                return null;
    }

    //Création d'un nouveau membre
    public function insert($firstname,$name,$mail,$login,$password,$admin,$state) {

        $this->firstname = $firstname;
        $this->name = $name;
        $this->mail = $mail;
        $this->login = $login;
        $this->password = md5($password);
        $this->admin = $admin;
        $this->state = $state;

        return $this->db->insert($this->table, $this);
    }

    //Mise à jour d'un membre
    public function update($arr_data)
    {

        $this->db
                ->where('id_member',$arr_data['id_member']);
        $this->db
                ->update($this->table,$arr_data);
    }

    //Suppression d'un membre
    public function delete($id)
    {
        $this->db->delete($this->table,array('id_member' => $id));
    }

    //Réinitialisation du mot de passe du membre
   public function reiniMDP($login,$email)
   {
        $cle = $login.microtime(TRUE)*100000;
        $query = $this->db->get_where($this->table, array('login'=>$login, 'mail'=>$email))->row();
        if ($query!=null) {
            $this->db
                ->where(array('login'=>$login, 'mail'=>$email));
            $this->db->update($this->table,array('key' => md5($cle)));
            return $cle;
        }
        else
            return null;
   }

   //Vérification de la clé d'activation du membre
   public function verifCle($login,$cle)
   {
        $query = $this->db->get_where($this->table,array('login'=>$login,'key'=>md5($cle)))->row();
        if (is_null($query)) {
            return null;
        }
        else
            return $query;
   }
}
?>


text:
class RemoveMetadataForPublicationsAndTechnologies < ActiveRecord::Migration
  def self.up
    execute "delete from metadata where kind in ('publication', 'technology');"
  end

  def self.down
  end
end


text:
import numpy as np
import pandas as pd
import scipy
import statsmodels

"""
In this optional exercise, you should complete the function called
predictions(turnstile_weather). This function takes in our pandas
turnstile weather dataframe, and returns a set of predicted ridership values,
based on the other information in the dataframe.

In exercise 3.5 we used Gradient Descent in order to compute the coefficients
theta used for the ridership prediction. Here you should attempt to implement
another way of computing the coeffcients theta. You may also try using a reference implementation such as:
http://statsmodels.sourceforge.net/devel/generated/statsmodels.regression.linear_model.OLS.html

One of the advantages of the statsmodels implementation is that it gives you
easy access to the values of the coefficients theta. This can help you infer relationships
between variables in the dataset.

You may also experiment with polynomial terms as part of the input variables.

The following links might be useful:
http://en.wikipedia.org/wiki/Ordinary_least_squares
http://en.wikipedia.org/w/index.php?title=Linear_least_squares_(mathematics)
http://en.wikipedia.org/wiki/Polynomial_regression

This is your playground. Go wild!

How does your choice of linear regression compare to linear regression
with gradient descent computed in Exercise 3.5?

You can look at the information contained in the turnstile_weather dataframe below:
https://www.dropbox.com/s/meyki2wl9xfa7yk/turnstile_data_master_with_weather.csv

Note: due to the memory and CPU limitation of our amazon EC2 instance, we will
give you a random subset (~10%) of the data contained in turnstile_data_master_with_weather.csv

If you receive a "server has encountered an error" message, that means you are hitting
the 30 second limit that's placed on running your program. See if you can optimize your code so it
runs faster.
"""

def predictions(weather_turnstile):

    dummy_units = pd.get_dummies(weather_turnstile['UNIT'], prefix='unit')
    features = weather_turnstile[['rain', 'Hour', 'mintempi', 'maxtempi', 'meanwindspdi','fog','precipi']].join(dummy_units)
    values = weather_turnstile[['ENTRIESn_hourly']]
    m = len(values)

    """
    Linear Regression with statsmodels:
    R^2 value is: 0.485414650479
    """
    model = sm.OLS(values, features)
    results = model.fit()
    theta = results.params
    prediction = results.fittedvalues
    #print theta, results.rsquared

    return prediction

def compute_r_squared(data, predictions):
    SST = ((data-np.mean(data))**2).sum()
    SSReg = ((predictions-np.mean(data))**2).sum()
    r_squared = SSReg / SST

    return r_squared

if __name__ == "__main__":
    input_filename = "turnstile_data_master_with_weather.csv"
    turnstile_master = pd.read_csv(input_filename)
    predicted_values = predictions(turnstile_master)
    r_squared = compute_r_squared(turnstile_master['ENTRIESn_hourly'], predicted_values)

    print r_squared


text:
package com.tricker.moneycalc2.util;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class HttpUtil {

	public synchronized static void sendHttpRequest(final String address, final HttpCallbackListener listener) {
		new Thread(new Runnable() {
			public void run() {
				HttpURLConnection connection = null;
				try {
					URL url = new URL(address);
					connection = (HttpURLConnection) url.openConnection();
					connection.setRequestProperty("Charset", "utf-8");
					connection.setRequestMethod("GET");
					connection.setConnectTimeout(8000);
					connection.setReadTimeout(8000);
//					connection.connect();
					InputStream in = connection.getInputStream();

					BufferedReader reader = new BufferedReader(new InputStreamReader(in,"utf-8"));
					StringBuilder response = new StringBuilder();
					String line;
					while ((line = reader.readLine()) != null) {
						response.append(line);
					}

					/*
					 * byte[] buf = new byte[1024]; StringBuilder response = new
					 * StringBuilder(); while((in.read(buf))!=-1){
					 * response.append(new String(buf)); buf=new
					 * byte[1024];//重新生成,避免和上次读取的数据重复 }
					 */

					if (listener != null) {
						listener.onFinish(response.toString());
					}
					// reader.close();
					// in.close();
				} catch (Exception e) {
					e.printStackTrace();
					if (listener != null) {
						listener.onError(e);
					}
				} finally {
					if (connection != null) {
						connection.disconnect();
					}

				}
			}
		}).start();
	}
}


text:
import sys
import logging

from exe.exc import ConfigError

__all__ = ["bootstrap_logger", "initialize_logger", "open_logfile"]

## Consts ##
LOG_LEVEL_MAPPER = dict(
    DEBUG    = logging.DEBUG,
    INFO     = logging.INFO,
    WARNING  = logging.WARNING,
    ERROR    = logging.ERROR,
    CRITICAL = logging.CRITICAL)
LOG_LEVEL_DEFAULT = logging.INFO
LOG_FORMAT_DEFAULT = '%(asctime)-15s [%(levelname)s] %(message)s'

def bootstrap_logger():
    """ Initialize stream logger before the real logger initialized. """
    logger = logging.getLogger()
    handler = logging.StreamHandler(sys.stdout)
    formatter = logging.Formatter(LOG_FORMAT_DEFAULT)

    handler.setFormatter(formatter)
    logger.addHandler(handler)
    logger.setLevel(LOG_LEVEL_DEFAULT)

def initialize_logger(log_path="", log_level="", log_format=None):
    """ Open and config the root logger. """
    if not log_level:
        log_level = LOG_LEVEL_DEFAULT
    else:
        for name, level in LOG_LEVEL_MAPPER.items():
            if name == log_level.upper():
                log_level = level
                break

    if log_format == None:
        log_format = LOG_FORMAT_DEFAULT
    formatter = logging.Formatter(log_format)

    if not log_path:
        handler = logging.StreamHandler(sys.stdout)
    else:
        handler = open_logfile(log_path)

    logger = logging.getLogger()
    for _handler in logger.handlers:
        logger.removeHandler(_handler)

    logger.addHandler(handler)
    logger.setLevel(log_level)
    handler.setFormatter(formatter)

def open_logfile(log_path=""):
    """ Return log handler by open log file. """
    if not log_path:
        handler = logging.StreamHandler(sys.stdout)
    else:
        handler = logging.FileHandler(log_path, 'a', 'utf-8')
    handler.setLevel(logging.DEBUG)

    return handler


text:
//
// The task:
//
//
//  Author:
//
//

#ifndef ALITRDDIGITSFILTER_H
#define ALITRDDIGITSFILTER_H

#include "AliTRDdigitsTask.h"

#include <vector>
#include <list>

class TTreeStream;
class AliInputEventHandler;
class AliTRDdigitsManager;
class AliESDEvent;
class AliESDtrackCuts;
class AliESD;
class AliESDtrack;
class AliAnalysisTask;
class AliESDInputHandler;
class AliESDv0KineCuts;
class AliAnalysisManager;
class AliCentrality;
class TSystem;
class TStyle;
class TROOT;
class Riostream;
class TChain;
class TArrayF;
class TFile;
class THnSparse;
class TH2;
class TF1;
class TH1;
class TObjArray;

class AliTRDdigitsFilter : public AliTRDdigitsTask {

public:

  AliTRDdigitsFilter(const char *name = "trd_digits_filter");
  virtual ~AliTRDdigitsFilter();

  virtual void   UserCreateOutputObjects();
  //virtual Bool_t UserNotify();
  virtual void   UserExec(Option_t *);
  virtual void   Process();
  //virtual void   Terminate(const Option_t*);

  //AliESDv0KineCuts* GetV0cuts() {return fV0cuts;}

  void AcceptTracks(TString label, EPID_t pid,
      Float_t minPt, Float_t maxPt, Float_t fraction);

  void AcceptEvents(TString label,
                    Float_t minCent, Float_t maxCent, Float_t fraction);

  void PrintSettings();

  struct TrackCrit {
    TString fLabel;
    EPID_t fPid;
    Float_t fMinPt;
    Float_t fMaxPt;
    Float_t fFraction;
  };

  std::vector<TrackCrit> fTrackCriteria; // criteria to accept tracks

  struct EventCrit {
    TString fLabel;
    Float_t fMinCent;
    Float_t fMaxCent;
    Float_t fFraction;
  };

  std::vector<EventCrit> fEventCriteria; // criteria to accept events

protected:

  //AliESDv0KineCuts *fV0cuts;        //! ESD V0 cuts

  //std::vector<EPID_t> fPidTags;     //! vector of PID info for all tracks

  //Bool_t ReadDigits();
  //void WriteDigits();

  //void SetupV0qa();
  //void FillV0PIDlist();
  //void ClearV0PIDlist();

  Bool_t PassTrackCuts(AliESDtrack *fESDTrack=0,Int_t thres=0);
  Bool_t PassTrackPIDCuts(AliESDtrack *fESDTrack=0);

private:
  //
  //
  //AliESDEvent *fESDevent;              //! ESD object

  //TObjArray *fOutputContainer;         //! output data container
  //AliESDtrackCuts *fESDtrackCuts;      //! basic cut variables for all non-V0 tracks
  //AliESDtrackCuts *fESDtrackCutsV0;    //! basic cut variables for all V0 tracks

  //TList   *fListQA;                    //! List with filter QA histograms

  //TFile* fDigitsInputFile;             //! Digits file for reading
  //TFile* fDigitsOutputFile;            //! Digits file for writing

  //Int_t fEventNoInFile;                //! Bookkeeping

  //AliTRDdigitsManager* fDigMan;        //! digits manager

  // Histograms
  THnSparse*  fhAcc;                        //! summary hist of all acc tracks
  TH1F*       fhEventCuts;                  //! statistics of event cuts
  TH1F*       fhPtTag;                      //! pT of PID-tagged tracks
  TH1F*       fhPtGood;                     //! pT spectrum after quality cuts
  TH1F*       fhPtAcc;                      //! pT spectrum of accepted track
  TH1F*       fhCent;                       //! Centrality of event
  TH1F*       fhCentAcc;                    //! Accepted events based on centrality
  //-------------------------------------------------------------------------

  //TH1F *fhPt[fgkNSpecies];            //! pT spectrum for different species

  AliTRDdigitsFilter(const AliTRDdigitsFilter&); // not implemented
  AliTRDdigitsFilter& operator=(const AliTRDdigitsFilter&); // not implemented

  ClassDef(AliTRDdigitsFilter, 1);
};
#endif


text:
import { call as callTyped } from "typed-redux-saga/macro";
import { diMainGet } from "readium-desktop/main/di";
import { aboutFiltered } from "readium-desktop/main/filter";
import { PublicationDocument } from "readium-desktop/main/db/document/publication";
import { PublicationViewConverter } from "readium-desktop/main/converter/publication";

const convertDocs = async (docs: PublicationDocument[], publicationViewConverter: PublicationViewConverter) => {
    const pubs = [];
    for (const doc of docs) {
        pubs.push(await publicationViewConverter.convertDocumentToView(doc));
    }
    return pubs;
};
export function* findByTag(tag: string) {

    const publicationRepository = diMainGet("publication-repository");
    const publicationViewConverter = diMainGet("publication-view-converter");
    const docs = yield* callTyped(() => publicationRepository.findByTag(tag));
    const publicationViews = yield* callTyped(() => convertDocs(docs, publicationViewConverter));

    return aboutFiltered(publicationViews);
}


text:
package org.aja.tej.examples.sparksql.sql

import org.aja.tej.utils.TejUtils
import org.apache.spark.sql.SQLContext
import java.sql.Date

/**
  * Created by mageswaran on 24/1/16.
  */
object ComplexTypes extends App {

  val sc = TejUtils.getSparkContext(this.getClass.getSimpleName)

  val sqlContext = new SQLContext(sc)
  import sqlContext.implicits._

  //Three scehma defined by case classes
  case class Cust(id: Integer, name: String, trans: Seq[Transaction], billing:Address, shipping:Address)
  case class Transaction(id: Integer, date: Date, amount: Double)
  case class Address(state:String)

  // create a sequence of case class objects
  // (we defined the case class above)
  val custs = Seq(
    Cust(1, "Widget Co",    Seq(Transaction(1, Date.valueOf("2012-01-01"), 100.0)), Address("AZ"), Address("CA")),
    Cust(2, "Acme Widgets", Seq(Transaction(2, Date.valueOf("2014-06-15"), 200.0),
                                Transaction(3, Date.valueOf("2014-07-01"), 50.0)),  Address("CA"), null),
    Cust(3, "Widgetry",     Seq(Transaction(4, Date.valueOf("2014-01-01"), 150.0)), Address("CA"), Address("CA"))
  )
  // make it an RDD and convert to a DataFrame
  val customerDF = sc.parallelize(custs, 4).toDF()

  println("*** inferred schema takes nesting and arrays into account")
  customerDF.printSchema()

  customerDF.registerTempTable("customer")

  println("*** Query results reflect complex structure")
  val allCust = sqlContext.sql("SELECT * FROM customer")
  allCust.show()
  //  +---+------------+--------------------+-------+--------+
  //  | id|        name|               trans|billing|shipping|
  //  +---+------------+--------------------+-------+--------+
  //  |  1|   Widget Co|[[1,2012-01-01,10...|   [AZ]|    [CA]|
  //  |  2|Acme Widgets|[[2,2014-06-15,20...|   [CA]|    null|
  //  |  3|    Widgetry|[[4,2014-01-01,15...|   [CA]|    [CA]|
  //  +---+------------+--------------------+-------+--------+

  //
  // notice how the following query refers to shipping.date and
  // trans[1].date but some records don't have these components: Spark SQL
  // handles these cases quite gracefully
  //

  println("*** Projecting from deep structure doesn't blow up when it's missing")
  val projectedCust =
    sqlContext.sql(
      """
        | SELECT id, name, shipping.state, trans[1].date AS secondTrans
        | FROM customer
      """.stripMargin)
  projectedCust.show()
  //  +---+------------+-----+-----------+
  //  | id|        name|state|secondTrans|
  //  +---+------------+-----+-----------+
  //  |  1|   Widget Co|   CA|       null|
  //  |  2|Acme Widgets| null| 2014-07-01|
  //  |  3|    Widgetry|   CA|       null|
  //  +---+------------+-----+-----------+
  projectedCust.printSchema()

  //
  // The 'trans' field is an array of Transaction structures, but you can pull just the
  // dates out of each one by referencing trans.date
  //

  println("*** Reach into each element of an array of structures by omitting the subscript")
  val arrayOfStruct =
    sqlContext.sql("SELECT id, trans.date AS transDates FROM customer")
  arrayOfStruct.show()
  //  +---+--------------------+
  //  | id|          transDates|
  //  +---+--------------------+
  //  |  1|        [2012-01-01]|
  //  |  2|[2014-06-15, 2014...|
  //  |  3|        [2014-01-01]|
  //  +---+--------------------+
  arrayOfStruct.printSchema()

  println("*** Group by a nested field")
  val groupByNested =
    sqlContext.sql(
      """SELECT shipping.state, count(*) AS customers
        | FROM customer
        | GROUP BY shipping.state
      """.stripMargin)
  groupByNested.show()
  //  +-----+---------+
  //  |state|customers|
  //  +-----+---------+
  //  |   CA|        2|
  //  | null|        1|
  //  +-----+---------+

  println("*** Order by a nested field")
  val orderByNested =
    sqlContext.sql(
      """
        | SELECT id, shipping.state
        | FROM customer
        | ORDER BY shipping.state
      """.stripMargin)
  orderByNested.show()
  //  +---+-----+
  //  | id|state|
  //  +---+-----+
  //  |  2| null|
  //  |  1|   CA|
  //  |  3|   CA|
  //  +---+-----+

}


text:
from .models import Tweet, TwitterConfiguration
import tweepy

class StreamListener(tweepy.StreamListener):

    def __init__(self):
        super().__init__()
        self.counter = 0
        self.limit = 1

    def on_status(self, status):
        if self.counter < self.limit:
            self.counter += 1
            tweet_text = ''
            if hasattr(status, 'retweeted_status'):
                try:
                    tweet_text = status.retweeted_status.extended_tweet['full_text']
                except:
                    tweet_text = status.retweeted_status.text
            else:
                try:
                    tweet_text = status.extended_tweet['full_text']
                except AttributeError:
                    tweet_text = status.text

            tweet = Tweet(
                name=status.author.name,
                user=status.author.screen_name,
                text=tweet_text,
                twitter_date_created=status.created_at
            )
            tweet.save()
        else:
            return False

    def on_error(self, status_code):
        return False

    def on_timeout(self):
        return False

class Twitter(object):

    def __init__(self):

        conf = TwitterConfiguration.objects.first()
        self.consumer_key = conf.consumer_key
        self.consumer_secret = conf.consumer_secret
        self.access_token = conf.access_token
        self.access_token_secret = conf.access_token_secret
        self.api_auth = None
        self.api = None
        self.api_stream = None

    def auth(self):
        self.api_auth = tweepy.OAuthHandler(self.consumer_key, self.consumer_secret)
        self.api_auth.set_access_token(self.access_token, self.access_token_secret)
        self.api = tweepy.API(self.api_auth)
        return self.api

    def stream(self, topics, languages):
        self.auth()
        self.api_stream = tweepy.Stream(auth=self.api.auth, listener=StreamListener(), tweet_mode='extended')
        self.api_stream.filter(track=topics, languages=languages)


text:
package org.apache.maven.repository.metadata;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

import org.apache.maven.artifact.ArtifactScopeEnum;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;

/**
 * default implementation of the metadata classpath transformer
 *
 * @author Oleg Gusakov
 *
 */
@Component( role = ClasspathTransformation.class )
public class DefaultClasspathTransformation
    implements ClasspathTransformation
{
    @Requirement
    GraphConflictResolver conflictResolver;

    //----------------------------------------------------------------------------------------------------
    public ClasspathContainer transform( MetadataGraph dirtyGraph, ArtifactScopeEnum scope, boolean resolve )
        throws MetadataGraphTransformationException
    {
        try
        {
            if ( dirtyGraph == null || dirtyGraph.isEmpty() )
            {
                return null;
            }

            MetadataGraph cleanGraph = conflictResolver.resolveConflicts( dirtyGraph, scope );

            if ( cleanGraph == null || cleanGraph.isEmpty() )
            {
                return null;
            }

            ClasspathContainer cpc = new ClasspathContainer( scope );
            if ( cleanGraph.isEmptyEdges() )
            {
                // single entry in the classpath, populated from itself
                ArtifactMetadata amd = cleanGraph.getEntry().getMd();
                cpc.add( amd );
            }
            else
            {
                ClasspathGraphVisitor v = new ClasspathGraphVisitor( cleanGraph, cpc );
                MetadataGraphVertex entry = cleanGraph.getEntry();
                // entry point
                v.visit( entry );
            }

            return cpc;
        }
        catch ( GraphConflictResolutionException e )
        {
            throw new MetadataGraphTransformationException( e );
        }
    }

    //===================================================================================================
    /**
     * Helper class to traverse graph. Required to make the containing method thread-safe
     * and yet use class level data to lessen stack usage in recursion
     */
    private class ClasspathGraphVisitor
    {
        MetadataGraph graph;

        ClasspathContainer cpc;

        List<MetadataGraphVertex> visited;

        // -----------------------------------------------------------------------
        protected ClasspathGraphVisitor( MetadataGraph cleanGraph, ClasspathContainer cpc )
        {
            this.cpc = cpc;
            this.graph = cleanGraph;

            visited = new ArrayList<MetadataGraphVertex>( cleanGraph.getVertices().size() );
        }

        // -----------------------------------------------------------------------
        protected void visit( MetadataGraphVertex node ) // , String version, String artifactUri )
        {
            ArtifactMetadata md = node.getMd();
            if ( visited.contains( node ) )
            {
                return;
            }

            cpc.add( md );
//
//            TreeSet<MetadataGraphEdge> deps = new TreeSet<MetadataGraphEdge>(
//                        new Comparator<MetadataGraphEdge>()
//                        {
//                            public int compare( MetadataGraphEdge e1
//                                              , MetadataGraphEdge e2
//                                              )
//                            {
//                                if( e1.getDepth() == e2.getDepth() )
//                                {
//                                    if( e2.getPomOrder() == e1.getPomOrder() )
//                                        return e1.getTarget().toString().compareTo(e2.getTarget().toString() );
//
//                                    return e2.getPomOrder() - e1.getPomOrder();
//                                }
//
//                                return e2.getDepth() - e1.getDepth();
//                            }
//                        }
//                    );

            List<MetadataGraphEdge> exits = graph.getExcidentEdges( node );

            if ( exits != null && exits.size() > 0 )
            {
                MetadataGraphEdge[] sortedExits = exits.toArray( new MetadataGraphEdge[exits.size()] );
                Arrays.sort( sortedExits
                        ,
                        new Comparator<MetadataGraphEdge>()
                        {
                            public int compare( MetadataGraphEdge e1
                                            , MetadataGraphEdge e2
                                            )
                            {
                                if ( e1.getDepth() == e2.getDepth() )
                                {
                                    if ( e2.getPomOrder() == e1.getPomOrder() )
                                    {
                                        return e1.getTarget().toString().compareTo( e2.getTarget().toString() );
                                    }
                                    return e2.getPomOrder() - e1.getPomOrder();
                                }

                                return e2.getDepth() - e1.getDepth();
                            }
                        }
                );

                for ( MetadataGraphEdge e : sortedExits )
                {
                    MetadataGraphVertex targetNode = e.getTarget();
                    targetNode.getMd().setArtifactScope( e.getScope() );
                    targetNode.getMd().setWhy( e.getSource().getMd().toString() );
                    visit( targetNode );
                }
            }

        }
        //-----------------------------------------------------------------------
        //-----------------------------------------------------------------------
    }
    //----------------------------------------------------------------------------------------------------
    //----------------------------------------------------------------------------------------------------
}


text:
#ifndef QGRAPHICSSCENEINDEX_H
#define QGRAPHICSSCENEINDEX_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists for the convenience
// of other Qt classes.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qgraphicsscene_p.h"
#include "qgraphicsscene.h"
#include <private/qobject_p.h>

#include <QtCore/qnamespace.h>
#include <QtCore/qobject.h>
#include <QtGui/qtransform.h>

QT_REQUIRE_CONFIG(graphicsview);

QT_BEGIN_NAMESPACE

class QGraphicsSceneIndexPrivate;
class QPointF;
class QRectF;
template<typename T> class QList;

typedef bool (*QGraphicsSceneIndexIntersector)(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode,
                                               const QTransform &deviceTransform, const void *data);

class Q_AUTOTEST_EXPORT QGraphicsSceneIndex : public QObject
{
    Q_OBJECT

public:
    QGraphicsSceneIndex(QGraphicsScene *scene = 0);
    virtual ~QGraphicsSceneIndex();

    QGraphicsScene *scene() const;

    virtual QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const  = 0;
    virtual QList<QGraphicsItem *> items(const QPointF &pos, Qt::ItemSelectionMode mode,
                                         Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;
    virtual QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode,
                                         Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;
    virtual QList<QGraphicsItem *> items(const QPolygonF &polygon, Qt::ItemSelectionMode mode,
                                         Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;
    virtual QList<QGraphicsItem *> items(const QPainterPath &path, Qt::ItemSelectionMode mode,
                                         Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;
    virtual QList<QGraphicsItem *> estimateItems(const QPointF &point, Qt::SortOrder order) const;
    virtual QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const = 0;
    virtual QList<QGraphicsItem *> estimateTopLevelItems(const QRectF &, Qt::SortOrder order) const;

protected Q_SLOTS:
    virtual void updateSceneRect(const QRectF &rect);

protected:
    virtual void clear();
    virtual void addItem(QGraphicsItem *item) = 0;
    virtual void removeItem(QGraphicsItem *item) = 0;
    virtual void deleteItem(QGraphicsItem *item);

    virtual void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const void *const value);
    virtual void prepareBoundingRectChange(const QGraphicsItem *item);

    QGraphicsSceneIndex(QGraphicsSceneIndexPrivate &dd, QGraphicsScene *scene);

    friend class QGraphicsScene;
    friend class QGraphicsScenePrivate;
    friend class QGraphicsItem;
    friend class QGraphicsItemPrivate;
    friend class QGraphicsSceneBspTreeIndex;
private:
    Q_DISABLE_COPY(QGraphicsSceneIndex)
    Q_DECLARE_PRIVATE(QGraphicsSceneIndex)
};

class QGraphicsSceneIndexPrivate : public QObjectPrivate
{
    Q_DECLARE_PUBLIC(QGraphicsSceneIndex)
public:
    QGraphicsSceneIndexPrivate(QGraphicsScene *scene);
    ~QGraphicsSceneIndexPrivate();

    void init();
    static bool itemCollidesWithPath(const QGraphicsItem *item, const QPainterPath &path, Qt::ItemSelectionMode mode);

    void recursive_items_helper(QGraphicsItem *item, QRectF exposeRect,
                                QGraphicsSceneIndexIntersector intersect, QList<QGraphicsItem *> *items,
                                const QTransform &viewTransform,
                                Qt::ItemSelectionMode mode, qreal parentOpacity, const void *intersectData) const;
    inline void items_helper(const QRectF &rect, QGraphicsSceneIndexIntersector intersect,
                             QList<QGraphicsItem *> *items, const QTransform &viewTransform,
                             Qt::ItemSelectionMode mode, Qt::SortOrder order, const void *intersectData) const;

    QGraphicsScene *scene;
};

inline void QGraphicsSceneIndexPrivate::items_helper(const QRectF &rect, QGraphicsSceneIndexIntersector intersect,
                                                     QList<QGraphicsItem *> *items, const QTransform &viewTransform,
                                                     Qt::ItemSelectionMode mode, Qt::SortOrder order, const void *intersectData) const
{
    Q_Q(const QGraphicsSceneIndex);
    const QList<QGraphicsItem *> tli = q->estimateTopLevelItems(rect, Qt::AscendingOrder);
    for (int i = 0; i < tli.size(); ++i)
        recursive_items_helper(tli.at(i), rect, intersect, items, viewTransform, mode, 1.0, intersectData);
    if (order == Qt::DescendingOrder) {
        const int n = items->size();
        for (int i = 0; i < n / 2; ++i)
            items->swap(i, n - i - 1);
    }
}

QT_END_NAMESPACE

#endif // QGRAPHICSSCENEINDEX_H


text:
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ArtemisTestModule } from '../../test.module';
import { RouterTestingModule } from '@angular/router/testing';
import { MockModule, MockPipe } from 'ng-mocks';
import { ArtemisTranslatePipe } from 'app/shared/pipes/artemis-translate.pipe';
import { PerformanceInterval, StatisticsAverageScoreGraphComponent } from 'app/shared/statistics-graph/statistics-average-score-graph.component';
import { BarChartModule } from '@swimlane/ngx-charts';
import { ExerciseType } from 'app/entities/exercise.model';
import { GraphColors } from 'app/entities/statistics.model';
import { MockRouter } from '../../helpers/mocks/mock-router';
import { Router } from '@angular/router';
import { CourseManagementStatisticsModel } from 'app/entities/quiz/course-management-statistics-model';

describe('StatisticsAverageScoreGraphComponent', () => {
    let fixture: ComponentFixture<StatisticsAverageScoreGraphComponent>;
    let component: StatisticsAverageScoreGraphComponent;
    let router: Router;

    const exercise1 = { exerciseId: 1, exerciseName: 'FarcadePattern', averageScore: 0, exerciseType: ExerciseType.TEXT };
    const exercise2 = { exerciseId: 2, exerciseName: 'BridgePattern', averageScore: 20, exerciseType: ExerciseType.PROGRAMMING };
    const exercise3 = { exerciseId: 3, exerciseName: 'VisitorPattern', averageScore: 25, exerciseType: ExerciseType.FILE_UPLOAD };
    const exercise4 = { exerciseId: 4, exerciseName: 'AdapterPattern', averageScore: 35, exerciseType: ExerciseType.QUIZ };
    const exercise5 = { exerciseId: 5, exerciseName: 'ProxyPattern', averageScore: 40, exerciseType: ExerciseType.MODELING };
    const exercise6 = { exerciseId: 6, exerciseName: 'BuilderPattern', averageScore: 50, exerciseType: ExerciseType.QUIZ };
    const exercise7 = { exerciseId: 7, exerciseName: 'BehaviouralPattern', averageScore: 55, exerciseType: ExerciseType.PROGRAMMING };
    const exercise8 = { exerciseId: 8, exerciseName: 'SingletonPattern', averageScore: 56, exerciseType: ExerciseType.TEXT };
    const exercise9 = { exerciseId: 9, exerciseName: 'ObserverPattern', averageScore: 60, exerciseType: ExerciseType.FILE_UPLOAD };
    const exercise10 = { exerciseId: 10, exerciseName: 'StrategyPattern', averageScore: 75, exerciseType: ExerciseType.PROGRAMMING };
    const exercise11 = { exerciseId: 11, exerciseName: 'StatePattern', averageScore: 100, exerciseType: ExerciseType.MODELING };

    const returnValue = [exercise2, exercise4, exercise5, exercise8, exercise9, exercise10, exercise6, exercise11, exercise1, exercise3, exercise7];

    const courseAverageScore = 75;

    const exerciseTypes = [ExerciseType.PROGRAMMING, ExerciseType.MODELING, ExerciseType.QUIZ, ExerciseType.TEXT, ExerciseType.FILE_UPLOAD];
    const exerciseTypeStrings = ['text', 'programming', 'file-upload', 'quiz', 'modeling', 'quiz', 'programming', 'text', 'file-upload', 'programming', 'modeling'];

    beforeEach(() => {
        TestBed.configureTestingModule({
            imports: [ArtemisTestModule, RouterTestingModule.withRoutes([]), MockModule(BarChartModule)],
            declarations: [StatisticsAverageScoreGraphComponent, MockPipe(ArtemisTranslatePipe)],
            providers: [{ provide: Router, useClass: MockRouter }],
        })
            .compileComponents()
            .then(() => {
                fixture = TestBed.createComponent(StatisticsAverageScoreGraphComponent);
                component = fixture.componentInstance;
                router = fixture.debugElement.injector.get(Router);

                component.exerciseAverageScores = returnValue;
                component.courseAverage = courseAverageScore;
                fixture.detectChanges();
            });
    });

    it('should initialize', () => {
        const averageExerciseScores = [0, 20, 25, 35, 40, 50, 55, 56, 60, 75];
        const expectedTypes = [
            ExerciseType.TEXT,
            ExerciseType.PROGRAMMING,
            ExerciseType.FILE_UPLOAD,
            ExerciseType.QUIZ,
            ExerciseType.MODELING,
            ExerciseType.QUIZ,
            ExerciseType.PROGRAMMING,
            ExerciseType.TEXT,
            ExerciseType.FILE_UPLOAD,
            ExerciseType.PROGRAMMING,
            ExerciseType.MODELING,
        ];
        const expectedColors = [...new Array(3).fill(GraphColors.RED), ...new Array(5).fill(GraphColors.GREY), ...new Array(3).fill(GraphColors.GREEN)];
        // take first 10 exerciseTitles

        expect(component.barChartLabels).toEqual([
            'FarcadePattern',
            'BridgePattern',
            'VisitorPattern',
            'AdapterPattern',
            'ProxyPattern',
            'BuilderPattern',
            'BehaviouralPattern',
            'SingletonPattern',
            'ObserverPattern',
            'StrategyPattern',
        ]);
        for (let i = 0; i < averageExerciseScores.length; i++) {
            expect(component.ngxData[i].value).toBe(averageExerciseScores[i]);
            expect(component.ngxData[i].exerciseType).toBe(expectedTypes[i]);
            expect(component.ngxData[i].exerciseId).toBe(i + 1);
            expect(component.ngxColor.domain[i]).toBe(expectedColors[i]);
        }
    });

    it('should return the correct type stringification for the tooltips', () => {
        for (let i = 0; i < 10; i++) {
            expect(component.convertTypeForTooltip(returnValue[i].exerciseName, returnValue[i].averageScore)).toBe(exerciseTypeStrings[i]);
        }
    });

    it('should delegate the user to the correct pages', () => {
        const routerMock = jest.spyOn(router, 'navigate');
        component.courseId = 42;

        let event: any;
        let path: any[];
        for (let i = 0; i < 10; i++) {
            event = { name: returnValue[i].exerciseName, value: returnValue[i].averageScore };
            path = ['course-management', 42, exerciseTypeStrings[i] + '-exercises', returnValue[i].exerciseId, 'exercise-statistics'];
            if (returnValue[i].exerciseType === ExerciseType.QUIZ) {
                path[4] = 'quiz-point-statistic';
            }
            component.onSelect(event);
            expect(routerMock).toHaveBeenCalledWith(path);
        }
    });

    it('should switch time span', () => {
        component.switchTimeSpan(true);

        // remove first one and push one to the end
        expect(component.barChartLabels).toEqual([
            'BridgePattern',
            'VisitorPattern',
            'AdapterPattern',
            'ProxyPattern',
            'BuilderPattern',
            'BehaviouralPattern',
            'SingletonPattern',
            'ObserverPattern',
            'StrategyPattern',
            'StatePattern',
        ]);
    });

    describe('test filtering', () => {
        const programmingExercises = [exercise2, exercise7, exercise10];
        const modelingExercises = [exercise5, exercise11];
        const quizExercises = [exercise4, exercise6];
        const textExercises = [exercise1, exercise8];
        const fileUploadExercises = [exercise3, exercise9];
        let expectedScores: CourseManagementStatisticsModel[];

        it.each(exerciseTypes)('should filter for type correctly if only one type is selected', (type: ExerciseType) => {
            toggleAllTypes();

            component.toggleType(type);

            if (type === ExerciseType.PROGRAMMING) {
                expect(component.currentlyDisplayableExercises).toEqual(programmingExercises);
                expect(component.currentSize).toBe(programmingExercises.length);
            } else if (type === ExerciseType.MODELING) {
                expect(component.currentlyDisplayableExercises).toEqual(modelingExercises);
                expect(component.currentSize).toBe(modelingExercises.length);
            } else if (type === ExerciseType.QUIZ) {
                expect(component.currentlyDisplayableExercises).toEqual(quizExercises);
                expect(component.currentSize).toBe(quizExercises.length);
            } else if (type === ExerciseType.TEXT) {
                expect(component.currentlyDisplayableExercises).toEqual(textExercises);
                expect(component.currentSize).toBe(textExercises.length);
            } else {
                expect(component.currentlyDisplayableExercises).toEqual(fileUploadExercises);
                expect(component.currentSize).toBe(fileUploadExercises.length);
            }

            expect(component.currentPeriod).toBe(0);
        });

        it('should filter correctly if lowest third is selected', () => {
            expectedScores = [exercise1, exercise2, exercise3];

            component.togglePerformanceInterval(PerformanceInterval.LOWEST);

            expect(component.currentlyDisplayableExercises).toEqual(expectedScores);
        });

        it('should filter correctly if average third is selected', () => {
            expectedScores = [exercise4, exercise5, exercise6, exercise7, exercise8];

            component.togglePerformanceInterval(PerformanceInterval.AVERAGE);

            expect(component.currentlyDisplayableExercises).toEqual(expectedScores);
        });

        it('should filter correctly if best third is selected', () => {
            expectedScores = [exercise9, exercise10, exercise11];

            component.togglePerformanceInterval(PerformanceInterval.BEST);

            expect(component.currentlyDisplayableExercises).toEqual(expectedScores);
        });

        it('should filter correctly if lowest and average third is selected', () => {
            expectedScores = [exercise1, exercise2, exercise3, exercise4, exercise5, exercise6, exercise7, exercise8];

            component.togglePerformanceInterval(PerformanceInterval.AVERAGE);
            component.togglePerformanceInterval(PerformanceInterval.LOWEST);

            expect(component.currentlyDisplayableExercises).toEqual(expectedScores);
        });

        it('should filter correctly if lowest and best third is selected', () => {
            expectedScores = [exercise1, exercise2, exercise3, exercise9, exercise10, exercise11];

            component.togglePerformanceInterval(PerformanceInterval.BEST);
            component.togglePerformanceInterval(PerformanceInterval.LOWEST);

            expect(component.currentlyDisplayableExercises).toEqual(expectedScores);
        });

        it('should filter correctly if median and best third is selected', () => {
            expectedScores = [exercise4, exercise5, exercise6, exercise7, exercise8, exercise9, exercise10, exercise11];

            component.togglePerformanceInterval(PerformanceInterval.BEST);
            component.togglePerformanceInterval(PerformanceInterval.AVERAGE);

            expect(component.currentlyDisplayableExercises).toEqual(expectedScores);
        });
    });

    const toggleAllTypes = () => {
        exerciseTypes.forEach((type) => {
            component.toggleType(type);
        });
    };
});


text: package lua51