text:
<?php

namespace Kassko\DataMapper\Result;

use Kassko\DataMapper\Result\Exception\DuplicatedIndexException;

/**
 * Hydrate results walkable with iterator.
 *
 * @author kko
 */
class IterableResultHydrator extends AbstractResultHydrator
{
    /**
     * Hydrate results.
     *
     * @param array $data Raw results.
     *
     * @return Generator
     */
    public function hydrate($objectClass, array $data, $indexOfBy = false)
    {
        $this->objectClass = $objectClass;

        if (0 == count($data)) {

            yield $this->createObjectToHydrate($this->objectClass);
        } elseif (! is_array(current($data))) {

            yield $this->hydrateItem($this->objectClass, $data);
        } elseif (false === $indexOfBy) {

            foreach ($data as $item) {
                yield $this->hydrateItem($this->objectClass, $item);
            }
        } else {

            foreach ($this->hydrateBy($data, $indexOfBy) as $valueOfBy => $item) {
                yield $valueOfBy => $item;
            }
        }
    }

    private function hydrateBy(array $data, $indexOfBy)
    {
        $metadata = $this->objectManager->getMetadata($this->objectClass);
        $originalFieldName = $metadata->getOriginalFieldName($indexOfBy);

        $valuesOfBy = [];
        foreach ($data as $key => $item) {

            $valueOfBy = $item[$originalFieldName];

            if (! isset($valueOfBy)) {
                continue;
            }

            $item = $this->hydrateItem($this->objectClass, $item);

            if (isset($valueOfByUsed[$valueOfBy])) {
                throw new DuplicatedIndexException($valueOfBy, $this->objectClass);
            }

            $valueOfByUsed[$valueOfBy] = true;

            yield $valueOfBy => $item;
        }
    }
}


text:
List of users

          Add user

            Name
            Username
            Action

              {{user.firstName}} {{user.lastName}}

              {{user.id}}

              Edit

      The current search parameters could not retrieve any users. Try to reset page number.

    <pagination ng-if="pages.total > pages.size"
                class="pagination-sm"

                ng-model="pages.current"
                ng-change="pageChange(pages.current)"

                total-items="pages.total"
                items-per-page="pages.size"
                max-size="7"

                boundary-links="true"

                next-text="›"
                last-text="»"
                previous-text="‹"
                first-text="«"></pagination>

redpajama_set_name: RedPajamaGithub


text:
//---------------------------------------------------------------------
// <copyright file="ExpressionTestCases.cs" company="Microsoft">
//      Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
// </copyright>
//---------------------------------------------------------------------

namespace Microsoft.Test.Taupo.OData.Query.Tests.UriParser
{
    #region Namespaces
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Microsoft.OData.Core.UriParser.TreeNodeKinds;
    using Microsoft.Spatial;
    using Microsoft.OData.Core.UriParser;
    using Microsoft.OData.Core.UriParser.Syntactic;
    using Microsoft.Test.Taupo.OData.Common;
    #endregion Namespaces
    //// ToDo: When we start supporting spatial, uncomment these.
    ////public class SpatialHelper
    ////{
    ////    public static Geography ParseGeography(string text)
    ////    {
    ////        return SpatialImplementation.CurrentImplementation.CreateWellKnownTextSqlFormatter().Read<Geography>(new StringReader(text));
    ////    }

    ////    public static Geometry ParseGeometry(string text)
    ////    {
    ////        return SpatialImplementation.CurrentImplementation.CreateWellKnownTextSqlFormatter().Read<Geometry>(new StringReader(text));
    ////    }
    ////}

    public class InvalidExpressionTestCase
    {
        public static readonly InvalidExpressionTestCase[] InvalidPrimitiveLiteralTestCases = new InvalidExpressionTestCase[]
        {
            // Unterminated literals
            new InvalidExpressionTestCase { Expression = "'some", ExpectedErrorMessage = "There is an unterminated string literal at position 5 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "'", ExpectedErrorMessage = "There is an unterminated string literal at position 1 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "'some''", ExpectedErrorMessage = "There is an unterminated string literal at position 7 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "^", ExpectedErrorMessage = "Syntax error: character '^' is not valid at position 0 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "binary'", ExpectedErrorMessage = "There is an unterminated literal at position 7 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "binary'1234", ExpectedErrorMessage = "There is an unterminated literal at position 11 in '$(Expression)'." },

            // Lexically invalid number literals
            new InvalidExpressionTestCase { Expression = "4.a", ExpectedErrorMessage = "A digit was expected at position 2 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "4Ea", ExpectedErrorMessage = "A digit was expected at position 2 in '$(Expression)'." },

            // Invalid binary literal
            new InvalidExpressionTestCase { Expression = "binary'1'", ExpectedErrorMessage = "Unrecognized 'Edm.Binary' literal 'binary'1'' at '0' in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "binary'1z'", ExpectedErrorMessage = "Unrecognized 'Edm.Binary' literal 'binary'1z'' at '0' in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "binary'z1'", ExpectedErrorMessage = "Unrecognized 'Edm.Binary' literal 'binary'z1'' at '0' in '$(Expression)'." },

            ////ToDo: When we start supporting spatial, uncomment these.
            //// Geography
            ////new InvalidExpressionTestCase { Expression = "geography''", ExpectedErrorMessage = "Unrecognized 'Edm.Geography' literal 'geography''' at '0' in 'geography'''." },
            ////new InvalidExpressionTestCase { Expression = "geography'foofoo'", ExpectedErrorMessage = "Unrecognized 'Edm.Geography' literal 'geography'foofoo'' at '0' in 'geography'foofoo''." },

            ////// Geometry
            ////new InvalidExpressionTestCase { Expression = "geometry''", ExpectedErrorMessage = "Unrecognized 'Edm.Geometry' literal 'geometry''' at '0' in 'geometry'''." },
            ////new InvalidExpressionTestCase { Expression = "geometry'foofoo'", ExpectedErrorMessage = "Unrecognized 'Edm.Geometry' literal 'geometry'foofoo'' at '0' in 'geometry'foofoo''." },
        };

        public static readonly InvalidExpressionTestCase[] InvalidPrimitiveLiteralSelectTestCases = new InvalidExpressionTestCase[]
        {
            // Unterminated literals
            new InvalidExpressionTestCase { Expression = "'some", ExpectedErrorMessage = "There is an unterminated string literal at position 5 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "'", ExpectedErrorMessage = "There is an unterminated string literal at position 1 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "'some''", ExpectedErrorMessage = "There is an unterminated string literal at position 7 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "^", ExpectedErrorMessage = "Syntax error: character '^' is not valid at position 0 in '$(Expression)'." },

            new InvalidExpressionTestCase { Expression = "binary'", ExpectedErrorMessage = "There is an unterminated literal at position 7 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "binary'1234", ExpectedErrorMessage = "There is an unterminated literal at position 11 in '$(Expression)'." },

            // Lexically invalid number literals
            new InvalidExpressionTestCase { Expression = "4.a", ExpectedErrorMessage = "A digit was expected at position 2 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "4Ea", ExpectedErrorMessage = "A digit was expected at position 2 in '$(Expression)'." },

            // Invalid binary literal
            new InvalidExpressionTestCase { Expression = "binary'1'", ExpectedErrorMessage = "Term 'binary'1'' is not valid in a $select expression." },
            new InvalidExpressionTestCase { Expression = "binary'1z'", ExpectedErrorMessage = "Term 'binary'1z'' is not valid in a $select expression." },
            new InvalidExpressionTestCase { Expression = "binary'z1'", ExpectedErrorMessage = "Term 'binary'z1'' is not valid in a $select expression." },

            ////ToDo: When we start supporting spatial, uncomment these.
            //// Geography
            ////new InvalidExpressionTestCase { Expression = "geography''", ExpectedErrorMessage = "Unrecognized 'Edm.Geography' literal 'geography''' at '0' in 'geography'''." },
            ////new InvalidExpressionTestCase { Expression = "geography'foofoo'", ExpectedErrorMessage = "Unrecognized 'Edm.Geography' literal 'geography'foofoo'' at '0' in 'geography'foofoo''." },

            ////// Geometry
            ////new InvalidExpressionTestCase { Expression = "geometry''", ExpectedErrorMessage = "Unrecognized 'Edm.Geometry' literal 'geometry''' at '0' in 'geometry'''." },
            ////new InvalidExpressionTestCase { Expression = "geometry'foofoo'", ExpectedErrorMessage = "Unrecognized 'Edm.Geometry' literal 'geometry'foofoo'' at '0' in 'geometry'foofoo''." },
        };

        public static readonly IEnumerable<InvalidExpressionTestCase> InvalidExpressionTestCases = new InvalidExpressionTestCase[]
        {
            // Invalid primary token
            new InvalidExpressionTestCase { Expression = ",", ExpectedErrorMessage = "Expression expected at position 0 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "/", ExpectedErrorMessage = "Expression expected at position 0 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = ".", ExpectedErrorMessage = "Expression expected at position 0 in '$(Expression)'." },

            // Unclosed parenthesis
            new InvalidExpressionTestCase { Expression = "(", ExpectedErrorMessage = "Expression expected at position 1 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "(42", ExpectedErrorMessage = "')' or operator expected at position 3 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "(')'", ExpectedErrorMessage = "')' or operator expected at position 4 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "((((null)))", ExpectedErrorMessage = "')' or operator expected at position 11 in '$(Expression)'." },

            // Unclosed list of arguments
            new InvalidExpressionTestCase { Expression = "func(", ExpectedErrorMessage = "Expression expected at position 5 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "func(42", ExpectedErrorMessage = "')' or ',' expected at position 7 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "func(42,", ExpectedErrorMessage = "Expression expected at position 8 in '$(Expression)'." },
            new InvalidExpressionTestCase { Expression = "func(((null))", ExpectedErrorMessage = "')' or ',' expected at position 13 in '$(Expression)'." },

            // Invalid end
            new InvalidExpressionTestCase { Expression = "42 42", ExpectedErrorMessage = "Syntax error at position 5 in '$(Expression)'." },
        };

        public string Expression { get; set; }
        public string ExpectedErrorMessage { get; set; }
        public override string ToString() { return this.Expression; }
    }

    internal class ExpressionTestCase
    {
        public static string[] PropertyAccessNames = new string[]
        {
            "Foo",
            "Bar",
            "_some"
        };

        public static string[] PropertyAccessIncludingStarNames = new string[]
        {
            "Foo",
            "Bar",
            "_some",
            "*"
        };

        public static IEnumerable<ExpressionTestCase> VariousExpressions()
        {
            // Primitive
            yield return new ExpressionTestCase()
            {
                Expression = "42",
                ExpectedToken = new LiteralToken(42)
            };

            // Logical binary operator
            foreach (BinaryOperatorKind binaryOperatorKind in QueryTestUtils.BinaryOperatorGroups.Select(bg => bg.OperatorKinds[0]))
            {
                yield return new ExpressionTestCase()
                {
                    Expression = "'foo' or 'bar'",
                    ExpectedToken = new BinaryOperatorToken(
                        BinaryOperatorKind.Or,
                        new LiteralToken("foo"),
                        new LiteralToken("bar"))
                };
            }

            // Unary operator
            yield return new ExpressionTestCase()
            {
                Expression = "not false",
                ExpectedToken = new UnaryOperatorToken(UnaryOperatorKind.Not, new LiteralToken(false))
            };

            // Property access
            yield return new ExpressionTestCase()
            {
                Expression = "Customer/Name",
                ExpectedToken = new EndPathToken("Name", new InnerPathToken("Customer", null, null))
            };

            // Parenthesis
            yield return new ExpressionTestCase()
            {
                Expression = "(42)",
                ExpectedToken = new LiteralToken(42)
            };

            // Function call
            yield return new ExpressionTestCase()
            {
                Expression = "startswith(Name, 'John')",
                ExpectedToken = new FunctionCallToken(
                    "startswith",
                    new QueryToken[]
                    {
                        new EndPathToken("Name", null),
                        new LiteralToken("John")
                    })
            };
        }

        public static IEnumerable<ExpressionTestCase> PrimitiveLiteralTestCases()
        {
            return new[]
            {
                // Null
                new ExpressionTestCase { Expression = "null", ExpectedToken = new LiteralToken(null) },

                // String
                new ExpressionTestCase { Expression = "''", ExpectedToken = new LiteralToken("") },
                new ExpressionTestCase { Expression = "'some'", ExpectedToken = new LiteralToken("some") },
                new ExpressionTestCase { Expression = "'foo''bar'", ExpectedToken = new LiteralToken("foo'bar") },

                // Boolean
                new ExpressionTestCase { Expression = "true", ExpectedToken = new LiteralToken(true) },
                new ExpressionTestCase { Expression = "false", ExpectedToken = new LiteralToken(false) },

                // DateTimeOffset
                new ExpressionTestCase { Expression = "2004-09-14T21:00:04-08:00", ExpectedToken = new LiteralToken(new DateTimeOffset(2004, 09, 14, 21, 0, 4, new TimeSpan(-8, 0, 0))) },

                // Duration
                new ExpressionTestCase { Expression = "duration'PT21H4S'", ExpectedToken = new LiteralToken(new TimeSpan(21, 00, 04)) },

                // Decimal
                new ExpressionTestCase { Expression = "42m", ExpectedToken = new LiteralToken((Decimal)42) },
                new ExpressionTestCase { Expression = "42.42M", ExpectedToken = new LiteralToken((Decimal)42.42) },

                // Int64
                new ExpressionTestCase { Expression = "42l", ExpectedToken = new LiteralToken((Int64)42) },
                new ExpressionTestCase { Expression = "42L", ExpectedToken = new LiteralToken((Int64)42) },

                // Int32
                new ExpressionTestCase { Expression = "42", ExpectedToken = new LiteralToken((Int32)42) },
                new ExpressionTestCase { Expression = "-123", ExpectedToken = new LiteralToken((Int32)(-123)) },

                // Double
                new ExpressionTestCase { Expression = "42.42d", ExpectedToken = new LiteralToken((Double)42.42) },
                new ExpressionTestCase { Expression = "-42.42d", ExpectedToken = new LiteralToken((Double)(-42.42)) },
                new ExpressionTestCase { Expression = "123456D", ExpectedToken = new LiteralToken((Double)123456) },

                // Single
                new ExpressionTestCase { Expression = "42.42f", ExpectedToken = new LiteralToken((Single)42.42) },
                new ExpressionTestCase { Expression = "-42.42F", ExpectedToken = new LiteralToken((Single)(-42.42)) },
                new ExpressionTestCase { Expression = "123456F", ExpectedToken = new LiteralToken((Single)123456) },

                // Guid
                new ExpressionTestCase { Expression = "FD3A4006-A6EF-420E-8EDA-DA2B1C58F6DF", ExpectedToken = new LiteralToken(new Guid("{FD3A4006-A6EF-420E-8EDA-DA2B1C58F6DF}")) },

                // Binary
                new ExpressionTestCase { Expression = "binary''", ExpectedToken = new LiteralToken(new byte[0]) },
                new ExpressionTestCase { Expression = "binary'AQID'", ExpectedToken = new LiteralToken(new byte[] { 1, 2, 3 }) },
                new ExpressionTestCase { Expression = "binary'qrvM'", ExpectedToken = new LiteralToken(new byte[] { 0xaa, 0xbb, 0xcc }) },

                //// ToDo:When we start supporting spatial uncomment these.
                //// Geography Point
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geography'SRID=4326;POINT (20 10 30 40)'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeography("SRID=4326;POINT (20 10 30 40)"))
                ////},
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geography'SRID=4326;POINT (20 10 NULL 40)'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeography("SRID=4326;POINT (20 10 NULL 40)"))
                ////},
                ////// Geography LineString
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geography'SRID=4326;LINESTRING (20 10, 30 20)'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeography("SRID=4326;LINESTRING (20 10, 30 20)"))
                ////},
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geography'SRID=4326;LINESTRING (20 10 30, 30 20 40)'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeography("SRID=4326;LINESTRING (20 10 30, 30 20 40)"))
                ////},
                ////// Geography Polygon
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geography'SRID=4326;POLYGON ((20 10, 30 20, 40 30, 20 10), (-20 -10, -30 -20, -40 -30, -20 -10))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeography("SRID=4326;POLYGON ((20 10, 30 20, 40 30, 20 10), (-20 -10, -30 -20, -40 -30, -20 -10))"))
                ////},
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geography'SRID=4326;POLYGON ((20 10 30, 30 20 40, 40 30 50, 20 10 30), (-20 -10 30, -30 -20 40, -40 -30 50, -20 -10 30))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeography("SRID=4326;POLYGON ((20 10 30, 30 20 40, 40 30 50, 20 10 30), (-20 -10 30, -30 -20 40, -40 -30 50, -20 -10 30))"))
                ////},
                ////// Geography Collection
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geography'SRID=4326;GEOMETRYCOLLECTION (LINESTRING (20 10, 30 20, 40 30, 20 10), POINT (-20 -10), POINT (-30 -20), POINT (-40 -30), POINT (-20 -10))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeography("SRID=4326;GEOMETRYCOLLECTION (LINESTRING (20 10, 30 20, 40 30, 20 10), POINT (-20 -10), POINT (-30 -20), POINT (-40 -30), POINT (-20 -10))"))
                ////},
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geography'SRID=4326;GEOMETRYCOLLECTION (LINESTRING (20 10 30, 30 20 40, 40 30 50, 20 10 30), POINT (-20 -10 30), POINT (-30 -20 40), POINT (-40 -30 50), POINT (-20 -10 30))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeography("SRID=4326;GEOMETRYCOLLECTION (LINESTRING (20 10 30, 30 20 40, 40 30 50, 20 10 30), POINT (-20 -10 30), POINT (-30 -20 40), POINT (-40 -30 50), POINT (-20 -10 30))"))
                ////},
                ////// Geography MultiPoint
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geography'SRID=4326;MULTIPOINT ((20 10), (30 20), (40 30), (20 10), (-20 -10), (-30 -20), (-40 -30), (-20 -10))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeography("SRID=4326;MULTIPOINT ((20 10), (30 20), (40 30), (20 10), (-20 -10), (-30 -20), (-40 -30), (-20 -10))"))
                ////},
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geography'SRID=4326;MULTIPOINT ((20 10 30), (30 20 40), (40 30 50), (20 10 30), (-20 -10 30), (-30 -20 40), (-40 -30 50), (-20 -10 30))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeography("SRID=4326;MULTIPOINT ((20 10 30), (30 20 40), (40 30 50), (20 10 30), (-20 -10 30), (-30 -20 40), (-40 -30 50), (-20 -10 30))"))
                ////},
                ////// Geography MultiLineString
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geography'SRID=4326;MULTILINESTRING ((20 10, 30 20), (20 20, 30 30), (20 30, 30 40), (20 40, 30 50))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeography("SRID=4326;MULTILINESTRING ((20 10, 30 20), (20 20, 30 30), (20 30, 30 40), (20 40, 30 50))"))
                ////},
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geography'SRID=4326;MULTILINESTRING ((20 10 1, 30 20 0), (20 20 2, 30 30 1), (20 30 3, 30 40 2), (20 40 4, 30 50 3))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeography("SRID=4326;MULTILINESTRING ((20 10 1, 30 20 0), (20 20 2, 30 30 1), (20 30 3, 30 40 2), (20 40 4, 30 50 3))"))
                ////},
                ////// Geography MultiPolygon
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geography'SRID=4326;MULTIPOLYGON (((20 10, 30 20, 40 30, 20 10), (-20 -10, -30 -20, -40 -30, -20 -10)), ((22 12, 32 22, 42 32, 22 12), (-22 -12, -32 -22, -42 -32, -22 -12)), ((24 14, 34 24, 44 34, 24 14), (-24 -14, -34 -24, -44 -34, -24 -14)), ((26 16, 36 26, 46 36, 26 16), (-26 -16, -36 -26, -46 -36, -26 -16)))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeography("SRID=4326;MULTIPOLYGON (((20 10, 30 20, 40 30, 20 10), (-20 -10, -30 -20, -40 -30, -20 -10)), ((22 12, 32 22, 42 32, 22 12), (-22 -12, -32 -22, -42 -32, -22 -12)), ((24 14, 34 24, 44 34, 24 14), (-24 -14, -34 -24, -44 -34, -24 -14)), ((26 16, 36 26, 46 36, 26 16), (-26 -16, -36 -26, -46 -36, -26 -16)))"))
                ////},
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geography'SRID=4326;MULTIPOLYGON (((20 10 1, 30 20 2, 40 30 3, 20 10 1), (-20 -10 1, -30 -20 2, -40 -30 3, -20 -10 1)), ((22 12 1, 32 22 2, 42 32 3, 22 12 1), (-22 -12 1, -32 -22 2, -42 -32 3, -22 -12 1)), ((24 14 1, 34 24 2, 44 34 3, 24 14 1), (-24 -14 1, -34 -24 2, -44 -34 3, -24 -14 1)), ((26 16 1, 36 26 2, 46 36 3, 26 16 1), (-26 -16 1, -36 -26 2, -46 -36 3, -26 -16 1)))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeography("SRID=4326;MULTIPOLYGON (((20 10 1, 30 20 2, 40 30 3, 20 10 1), (-20 -10 1, -30 -20 2, -40 -30 3, -20 -10 1)), ((22 12 1, 32 22 2, 42 32 3, 22 12 1), (-22 -12 1, -32 -22 2, -42 -32 3, -22 -12 1)), ((24 14 1, 34 24 2, 44 34 3, 24 14 1), (-24 -14 1, -34 -24 2, -44 -34 3, -24 -14 1)), ((26 16 1, 36 26 2, 46 36 3, 26 16 1), (-26 -16 1, -36 -26 2, -46 -36 3, -26 -16 1)))"))
                ////},
                ////// Geometry Point
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geometry'SRID=0;POINT (10 20 30 40)'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeometry("SRID=0;POINT (10 20 30 40)"))
                ////},
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geometry'SRID=0;POINT (10 20 NULL 40)'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeometry("SRID=0;POINT (10 20 NULL 40)"))
                ////},
                ////// Geometry LineString
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geometry'SRID=0;LINESTRING (10 20, 20 30)'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeometry("SRID=0;LINESTRING (10 20, 20 30)"))
                ////},
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geometry'SRID=0;LINESTRING (10 20 30, 20 30 40)'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeometry("SRID=0;LINESTRING (10 20 30, 20 30 40)"))
                ////},
                ////// Geometry Polygon
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geometry'SRID=0;POLYGON ((10 20, 20 30, 30 40, 10 20), (-10 -20, -20 -30, -30 -40, -10 -20))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeometry("SRID=0;POLYGON ((10 20, 20 30, 30 40, 10 20), (-10 -20, -20 -30, -30 -40, -10 -20))"))
                ////},
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geometry'SRID=0;POLYGON ((10 20 30, 20 30 40, 30 40 50, 10 20 30), (-10 -20 30, -20 -30 40, -30 -40 50, -10 -20 30))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeometry("SRID=0;POLYGON ((10 20 30, 20 30 40, 30 40 50, 10 20 30), (-10 -20 30, -20 -30 40, -30 -40 50, -10 -20 30))"))
                ////},
                ////// Geometry Collection
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geometry'SRID=0;GEOMETRYCOLLECTION (LINESTRING (10 20, 20 30, 30 40, 10 20), POINT (-10 -20), POINT (-20 -30), POINT (-30 -40), POINT (-10 -20))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeometry("SRID=0;GEOMETRYCOLLECTION (LINESTRING (10 20, 20 30, 30 40, 10 20), POINT (-10 -20), POINT (-20 -30), POINT (-30 -40), POINT (-10 -20))"))
                ////},
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geometry'SRID=0;GEOMETRYCOLLECTION (LINESTRING (10 20 30, 20 30 40, 30 40 50, 10 20 30), POINT (-10 -20 30), POINT (-20 -30 40), POINT (-30 -40 50), POINT (-10 -20 30))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeometry("SRID=0;GEOMETRYCOLLECTION (LINESTRING (10 20 30, 20 30 40, 30 40 50, 10 20 30), POINT (-10 -20 30), POINT (-20 -30 40), POINT (-30 -40 50), POINT (-10 -20 30))"))
                ////},
                ////// Geometry MultiPoint
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geometry'SRID=0;MULTIPOINT ((10 20), (20 30), (30 40), (10 20), (-10 -20), (-20 -30), (-30 -40), (-10 -20))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeometry("SRID=0;MULTIPOINT ((10 20), (20 30), (30 40), (10 20), (-10 -20), (-20 -30), (-30 -40), (-10 -20))"))
                ////},
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geometry'SRID=0;MULTIPOINT ((10 20 30), (20 30 40), (30 40 50), (10 20 30), (-10 -20 30), (-20 -30 40), (-30 -40 50), (-10 -20 30))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeometry("SRID=0;MULTIPOINT ((10 20 30), (20 30 40), (30 40 50), (10 20 30), (-10 -20 30), (-20 -30 40), (-30 -40 50), (-10 -20 30))"))
                ////},
                ////// Geometry MultiLineString
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geometry'SRID=0;MULTILINESTRING ((10 20, 20 30), (20 20, 30 30), (30 20, 40 30), (40 20, 50 30))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeometry("SRID=0;MULTILINESTRING ((10 20, 20 30), (20 20, 30 30), (30 20, 40 30), (40 20, 50 30))"))
                ////},
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geometry'SRID=0;MULTILINESTRING ((10 20 1, 20 30 0), (20 20 2, 30 30 1), (30 20 3, 40 30 2), (40 20 4, 50 30 3))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeometry("SRID=0;MULTILINESTRING ((10 20 1, 20 30 0), (20 20 2, 30 30 1), (30 20 3, 40 30 2), (40 20 4, 50 30 3))"))
                ////},
                ////// Geometry MultiPolygon
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geometry'SRID=0;MULTIPOLYGON (((10 20, 20 30, 30 40, 10 20), (-10 -20, -20 -30, -30 -40, -10 -20)), ((12 22, 22 32, 32 42, 12 22), (-12 -22, -22 -32, -32 -42, -12 -22)), ((14 24, 24 34, 34 44, 14 24), (-14 -24, -24 -34, -34 -44, -14 -24)), ((16 26, 26 36, 36 46, 16 26), (-16 -26, -26 -36, -36 -46, -16 -26)))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeometry("SRID=0;MULTIPOLYGON (((10 20, 20 30, 30 40, 10 20), (-10 -20, -20 -30, -30 -40, -10 -20)), ((12 22, 22 32, 32 42, 12 22), (-12 -22, -22 -32, -32 -42, -12 -22)), ((14 24, 24 34, 34 44, 14 24), (-14 -24, -24 -34, -34 -44, -14 -24)), ((16 26, 26 36, 36 46, 16 26), (-16 -26, -26 -36, -36 -46, -16 -26)))"))
                ////},
                ////new ExpressionTestCase
                ////{
                ////    Expression = "geometry'SRID=0;MULTIPOLYGON (((10 20 1, 20 30 2, 30 40 3, 10 20 1), (-10 -20 1, -20 -30 2, -30 -40 3, -10 -20 1)), ((12 22 1, 22 32 2, 32 42 3, 12 22 1), (-12 -22 1, -22 -32 2, -32 -42 3, -12 -22 1)), ((14 24 1, 24 34 2, 34 44 3, 14 24 1), (-14 -24 1, -24 -34 2, -34 -44 3, -14 -24 1)), ((16 26 1, 26 36 2, 36 46 3, 16 26 1), (-16 -26 1, -26 -36 2, -36 -46 3, -16 -26 1)))'",
                ////    ExpectedToken = new LiteralToken(SpatialHelper.ParseGeometry("SRID=0;MULTIPOLYGON (((10 20 1, 20 30 2, 30 40 3, 10 20 1), (-10 -20 1, -20 -30 2, -30 -40 3, -10 -20 1)), ((12 22 1, 22 32 2, 32 42 3, 12 22 1), (-12 -22 1, -22 -32 2, -32 -42 3, -12 -22 1)), ((14 24 1, 24 34 2, 34 44 3, 14 24 1), (-14 -24 1, -24 -34 2, -34 -44 3, -14 -24 1)), ((16 26 1, 26 36 2, 36 46 3, 16 26 1), (-16 -26 1, -26 -36 2, -36 -46 3, -16 -26 1)))"))
                ////},
            };
        }

        public static IEnumerable<ExpressionTestCase> BinaryOperatorTestCases()
        {
            // Single operator
            foreach (var operatorKind in QueryTestUtils.BinaryOperatorGroups.SelectMany(og => og.OperatorKinds))
            {
                yield return new ExpressionTestCase()
                {
                    Expression = "false " + operatorKind.ToOperatorName() + " true",
                    ExpectedToken = new BinaryOperatorToken(operatorKind, new LiteralToken(false), new LiteralToken(true))
                };
            }

            // Two operators from the same group
            foreach (var operatorGroup in QueryTestUtils.BinaryOperatorGroups)
            {
                IEnumerable<BinaryOperatorKind[]> operatorPairs = new[] {
                    new BinaryOperatorKind[] { operatorGroup.OperatorKinds[0], operatorGroup.OperatorKinds[0] }
                };

                if (operatorGroup.OperatorKinds.Length > 1)
                {
                    operatorPairs = operatorPairs.Concat(operatorGroup.OperatorKinds.Variations(2));
                }

                foreach (var operatorPair in operatorPairs)
                {
                    yield return new ExpressionTestCase()
                    {
                        Expression = "1 " + operatorPair[0].ToOperatorName() + " 2 " + operatorPair[1].ToOperatorName() + " 3",
                        ExpectedToken = new BinaryOperatorToken(
                            operatorPair[1],
                            new BinaryOperatorToken(
                                operatorPair[0],
                                new LiteralToken(1),
                                new LiteralToken(2)),
                            new LiteralToken(3))
                    };

                    yield return new ExpressionTestCase()
                    {
                        Expression = "1 " + operatorPair[0].ToOperatorName() + " (2 " + operatorPair[1].ToOperatorName() + " 3)",
                        ExpectedToken = new BinaryOperatorToken(
                            operatorPair[0],
                            new LiteralToken(1),
                            new BinaryOperatorToken(
                                operatorPair[1],
                                new LiteralToken(2),
                                new LiteralToken(3))),
                    };
                }
            }

            // Two operators from different groups
            foreach (var operatorGroupHigher in QueryTestUtils.BinaryOperatorGroups)
            {
                foreach (var operatorGroupLower in QueryTestUtils.BinaryOperatorGroups.Where(og => og.Priority > operatorGroupHigher.Priority))
                {
                    foreach (var operatorKindHigher in operatorGroupHigher.OperatorKinds)
                    {
                        foreach (var operatorKindLower in operatorGroupLower.OperatorKinds)
                        {
                            // Lower and higher
                            yield return new ExpressionTestCase()
                            {
                                Expression = "1 " + operatorKindLower.ToOperatorName() + " 2 " + operatorKindHigher.ToOperatorName() + " 3",
                                ExpectedToken = new BinaryOperatorToken(
                                    operatorKindHigher,
                                    new BinaryOperatorToken(
                                        operatorKindLower,
                                        new LiteralToken(1),
                                        new LiteralToken(2)),
                                    new LiteralToken(3))
                            };

                            // Lower and higher with parenthesis
                            yield return new ExpressionTestCase()
                            {
                                Expression = "1 " + operatorKindLower.ToOperatorName() + " (2 " + operatorKindHigher.ToOperatorName() + " 3)",
                                ExpectedToken = new BinaryOperatorToken(
                                    operatorKindLower,
                                    new LiteralToken(1),
                                    new BinaryOperatorToken(
                                        operatorKindHigher,
                                        new LiteralToken(2),
                                        new LiteralToken(3)))
                            };

                            // Higher and lower
                            yield return new ExpressionTestCase()
                            {
                                Expression = "1 " + operatorKindHigher.ToOperatorName() + " 2 " + operatorKindLower.ToOperatorName() + " 3",
                                ExpectedToken = new BinaryOperatorToken(
                                    operatorKindHigher,
                                    new LiteralToken(1),
                                    new BinaryOperatorToken(
                                        operatorKindLower,
                                        new LiteralToken(2),
                                        new LiteralToken(3)))
                            };
                        }
                    }
                }
            }

            foreach (var operatorKind in QueryTestUtils.BinaryOperatorGroups.Select(bg => bg.OperatorKinds[0]))
            {
                foreach (var testCase in VariousExpressions())
                {
                    yield return new ExpressionTestCase()
                    {
                        Expression = "false " + operatorKind.ToOperatorName() + " (" + testCase.Expression + ")",
                        ExpectedToken = new BinaryOperatorToken(operatorKind, new LiteralToken(false), testCase.ExpectedToken)
                    };
                }
            }
        }

        public static IEnumerable<ExpressionTestCase> UnaryOperatorTestCases()
        {
            // Single unary operator
            foreach (var operatorKind in QueryTestUtils.UnaryOperatorKinds)
            {
                yield return new ExpressionTestCase()
                {
                    Expression = operatorKind.ToOperatorName() + " 'foo'",
                    ExpectedToken = new UnaryOperatorToken(operatorKind, new LiteralToken("foo"))
                };

                foreach (var testCase in VariousExpressions())
                {
                    yield return new ExpressionTestCase()
                    {
                        Expression = operatorKind.ToOperatorName() + "(" + testCase.Expression + ")",
                        ExpectedToken = new UnaryOperatorToken(operatorKind, testCase.ExpectedToken)
                    };
                }
            }

            // Two unary operators
            foreach (var operatorKindPair in QueryTestUtils.UnaryOperatorKinds.Variations(2))
            {
                yield return new ExpressionTestCase()
                {
                    Expression = operatorKindPair[0].ToOperatorName() + " " + operatorKindPair[1].ToOperatorName() + " 'foo'",
                    ExpectedToken = new UnaryOperatorToken(
                        operatorKindPair[0],
                        new UnaryOperatorToken(
                            operatorKindPair[1],
                            new LiteralToken("foo")))
                };
            }

            // Unary and binary operator.
            foreach (var unaryOperatorKind in QueryTestUtils.UnaryOperatorKinds)
            {
                foreach (var binaryOperatorKind in QueryTestUtils.BinaryOperatorKinds)
                {
                    yield return new ExpressionTestCase()
                    {
                        Expression = unaryOperatorKind.ToOperatorName() + " 'foo' " + binaryOperatorKind.ToOperatorName() + " 'bar'",
                        ExpectedToken = new BinaryOperatorToken(
                            binaryOperatorKind,
                            new UnaryOperatorToken(unaryOperatorKind, new LiteralToken("foo")),
                            new LiteralToken("bar"))
                    };

                    // With parenthesis
                    yield return new ExpressionTestCase()
                    {
                        Expression = unaryOperatorKind.ToOperatorName() + " ('foo' " + binaryOperatorKind.ToOperatorName() + " 'bar')",
                        ExpectedToken = new UnaryOperatorToken(
                            unaryOperatorKind,
                            new BinaryOperatorToken(binaryOperatorKind,
                                new LiteralToken("foo"),
                                new LiteralToken("bar")))
                    };
                }
            }
        }

        public static IEnumerable<ExpressionTestCase> PropertyAccessTestCases(string [] propertyNames)
        {
            foreach (var properties in propertyNames.Variations().Where(p => p.Length > 0))
            {
                // Simple property access paths
                QueryToken pathToken = null;
                foreach (string propertyName in properties)
                {
                    pathToken = new InnerPathToken(propertyName, pathToken, null);
                }
                InnerPathToken pathNav = (InnerPathToken)pathToken;
                pathToken = new EndPathToken(pathNav.Identifier, pathNav.NextToken);

                yield return new ExpressionTestCase()
                {
                    Expression = string.Join("/", properties),
                    ExpectedToken = pathToken
                };
            }
        }

        public static IEnumerable<ExpressionTestCase> ParenthesisTestCases()
        {
            foreach (var testCase in VariousExpressions())
            {
                string expression = testCase.Expression;
                for (int i = 1; i < 5; i++)
                {
                    expression = "(" + expression + ")";
                }

                yield return new ExpressionTestCase()
                {
                    Expression = expression,
                    ExpectedToken = testCase.ExpectedToken
                };
            }
        }

        public static IEnumerable<ExpressionTestCase> FunctionCallTestCases()
        {
            string[] functionNames = new string[] { "func", "_MyFunc", "cast" };
            foreach (string functionName in functionNames)
            {
                foreach (var arguments in VariousExpressions().ToList().Variations(0, 1, 3))
                {
                    yield return new ExpressionTestCase()
                    {
                        Expression = functionName + "(" + string.Join(",", arguments.Select(a => a.Expression).ToArray()) + ")",
                        ExpectedToken = new FunctionCallToken(functionName, arguments.Select(a => a.ExpectedToken))
                    };
                }
            }
        }

        public string Expression { get; set; }
        public QueryToken ExpectedToken { get; set; }
        public override string ToString() { return this.Expression; }
    }
}


text:
var Docker, Promise, _, chalk, form;

Promise = require('bluebird');

_ = require('lodash');

Docker = require('docker-toolbelt');

form = require('resin-cli-form');

chalk = require('chalk');

module.exports = {
  selectContainerFromDevice: Promise.method(function(deviceIp) {
    var docker;
    docker = new Docker({
      host: deviceIp,
      port: 2375
    });
    return docker.listContainersAsync().then(function(containers) {
      if (_.isEmpty(containers)) {
        throw new Error("No containers are running in " + deviceIp);
      }
      return form.ask({
        message: 'Select a container',
        type: 'list',
        choices: _.map(containers, function(container) {
          return {
            name: (container.Names[0] || 'Untitled') + " (" + container.Id + ")",
            value: container.Id
          };
        })
      });
    });
  }),
  pipeContainerStream: Promise.method(function(arg) {
    var deviceIp, docker, follow, name, outStream, ref;
    deviceIp = arg.deviceIp, name = arg.name, outStream = arg.outStream, follow = (ref = arg.follow) != null ? ref : false;
    docker = new Docker({
      host: deviceIp,
      port: 2375
    });
    return docker.getContainer(name).attachAsync({
      logs: !follow,
      stream: follow,
      stdout: true,
      stderr: true
    }).then(function(containerStream) {
      return containerStream.pipe(outStream);
    })["catch"](function(err) {
      err = '' + err.statusCode;
      if (err === '404') {
        return console.log(chalk.red.bold("Container '" + name + "' not found."));
      }
      throw err;
    });
  })
};


text:
require 'test_helper'

class My::ItemsControllerTest < ActionDispatch::IntegrationTest
  setup do
    @student = create(:student)
    log_user_in(@student)
    patch my_terms_path
  end

  should "only show current items" do
    create_list(:item_connection, 3, student:  @student, :expires_on => Date.today - 1.year)
    create_list(:item_connection, 6, student:  @student, :expires_on => Date.today + 1.year)

    get my_items_path

    items = assigns(:items)
    assert items
    assert_equal 6, items.size

  end

end


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

/// <summary>
/// Editor只要是负责显示 附加在Inspector检视窗中的UI  https://docs.unity3d.com/Manual/editor-CustomEditors.html
/// Handles只要是用来描绘Scene窗口中的GUI, 例如坐标轴等 https://docs.unity3d.com/ScriptReference/Handles.html
///
///
/// 参考:
///
/// 有空看[如何在Unity编辑器中添加你自己的工具,绘制你自己的gizmo] https://code.tutsplus.com/zh-hans/tutorials/how-to-add-your-own-tools-to-unitys-editor--active-10047
/// http://blog.csdn.net/jjiss318/article/details/7435708
/// </summary>

[CustomEditor(typeof(LookAtPoint))]
[CanEditMultipleObjects]
public class Editor_Leran : Editor
{
    SerializedProperty lookAtPoint;

    /// <summary>
    /// This function is called when the object becomes enabled and active.
    /// </summary>
    void OnEnable()
    {
        lookAtPoint = serializedObject.FindProperty("lookAtPoint");
    }

    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        EditorGUILayout.PropertyField(lookAtPoint);
        EditorGUILayout.LabelField("这里是LabelField,可以和在OnGUI一样使用各种描绘方法");
        serializedObject.ApplyModifiedProperties();
    }

    public void OnSceneGUI()
    {
        var t = (target as LookAtPoint);

        EditorGUI.BeginChangeCheck();
        Vector3 pos = Handles.PositionHandle(t.transform.position, Quaternion.identity);
        if(EditorGUI.EndChangeCheck())
        {
            Undo.RecordObject(target, "Move Point");
            t.lookAtPoint = pos;
            t.Update();
        }
    }
}


text:
using System.Collections.Generic;
using libLSD.Formats;
using libLSD.Formats.Packets;
using libLSD.Types;
using LSDR.SDK.IO;
using UnityEngine;

namespace LSDR.IO
{
    /// <summary>
    /// TMDReader is used to load/create meshes from PSX TMD files.
    /// </summary>
    public class TMDReader
    {
        // default list capacity, used to avoid resizing lists a lot
        private const int DEFAULT_LIST_CAPACITY = 64;

        // cached instances of lists to use when building a mesh
        private List<Vector3> _verts;
        private List<Vector3> _normals;
        private List<Color32> _colors;
        private List<Vector2> _uvs;
        private List<int> _indices;
        private List<int> _alphaBlendIndices;
        private List<int> _packetIndices;
        private List<int> _polyIndices;

        /// <summary>
        /// Create a new instance of TMDReader.
        /// </summary>
        public TMDReader()
        {
            initializeCachedLists(DEFAULT_LIST_CAPACITY);

            // special handling for packet indices initialization, as most indices
            // a packet can have is 4 (in the case of a quad)
            _packetIndices = new List<int>
            {
                0, 0, 0, 0
            };
        }

        public Mesh MeshFromTMD(TMD tmd)
        {
            Mesh mesh = new Mesh();

            foreach (var obj in tmd.ObjectTable)
            {
                Mesh objMesh = CreateTMDObjectMesh(obj);
            }

            return null;
        }

        public Mesh CreateTMDObjectMesh(TMDObject obj)
        {
            clearCachedLists();

            foreach (var prim in obj.Primitives)
            {
                // currently only polygon primitives are supported
                if (prim.Type != TMDPrimitivePacket.Types.POLYGON) continue;

                // figure out which index list to use based on whether or not this primitive is alpha blended
                List<int> indicesList = (prim.Options & TMDPrimitivePacket.OptionsFlags.AlphaBlended) != 0
                    ? _alphaBlendIndices
                    : _indices;

                // get interfaces for different packet types from LibLSD
                ITMDPrimitivePacket primitivePacket = prim.PacketData;
                ITMDTexturedPrimitivePacket texturedPrimitivePacket = prim.PacketData as ITMDTexturedPrimitivePacket;
                ITMDColoredPrimitivePacket coloredPrimitivePacket = prim.PacketData as ITMDColoredPrimitivePacket;
                ITMDLitPrimitivePacket litPrimitivePacket = prim.PacketData as ITMDLitPrimitivePacket;

                for (int i = 0; i < primitivePacket.Vertices.Length; i++)
                {
                    // get index into vertices array
                    int vertIndex = primitivePacket.Vertices[i];
                    _packetIndices[i] = _verts.Count;

                    // create variables for each of the vertex types
                    Vec3 vertPos = obj.Vertices[vertIndex];
                    Vector3 vec3VertPos = new Vector3(vertPos.X, -vertPos.Y, vertPos.Z) / 2048f;
                    Color32 vertCol = Color.white;
                    Vector3 vertNorm = Vector3.zero;
                    Vector2 vertUV = Vector2.one;

                    // handle packet colour
                    if (coloredPrimitivePacket != null)
                    {
                        Vec3 packetVertCol =
                            coloredPrimitivePacket.Colors[coloredPrimitivePacket.Colors.Length > 1 ? i : 0];
                        vertCol = new Color(packetVertCol.X, packetVertCol.Y, packetVertCol.Z);
                        if (vertCol.r > 0 && vertCol.g > 0 && vertCol.b > 0
                            && (prim.Options & TMDPrimitivePacket.OptionsFlags.Textured) == 0
                            && (prim.Options & TMDPrimitivePacket.OptionsFlags.AlphaBlended) != 0)
                        {
                            vertCol.a = 127;
                        }
                    }

                    // handle packet normals
                    if (litPrimitivePacket != null)
                    {
                        TMDNormal packetVertNorm =
                            obj.Normals[litPrimitivePacket.Normals[litPrimitivePacket.Normals.Length > 1 ? i : 0]];
                        vertNorm = new Vector3(packetVertNorm.X, packetVertNorm.Y, packetVertNorm.Z);
                    }

                    // handle packet UVs
                    if (texturedPrimitivePacket != null)
                    {
                        // calculate which texture page we're on
                        int texPage = texturedPrimitivePacket.Texture.TexturePageNumber;

                        int texPageXPos = ((texPage % 16) * 128) - 640;
                        int texPageYPos = texPage < 16 ? 256 : 0;

                        // derive UV coords from the texture page
                        int uvIndex = i * 2;
                        int vramXPos = texPageXPos + texturedPrimitivePacket.UVs[uvIndex];
                        int vramYPos = texPageYPos + (256 - texturedPrimitivePacket.UVs[uvIndex + 1]);
                        float uCoord = vramXPos / (float)LibLSDUnity.VRAM_WIDTH;
                        float vCoord = vramYPos / (float)LibLSDUnity.VRAM_HEIGHT;

                        vertUV = new Vector2(uCoord, vCoord);

                        // check for overlapping UVs and fix them slightly
                        foreach (var uv in _uvs)
                        {
                            if (uv.Equals(vertUV))
                            {
                                vertUV += new Vector2(0.0001f, 0.0001f);
                            }
                        }
                    }

                    // add all computed aspects of vertex to lists
                    _verts.Add(vec3VertPos);
                    _normals.Add(vertNorm);
                    _colors.Add(vertCol);
                    _uvs.Add(vertUV);
                }

                // we want to add extra indices if this primitive is a quad (to triangulate)
                bool isQuad = (prim.Options & TMDPrimitivePacket.OptionsFlags.Quad) != 0;

                _polyIndices.Add(_packetIndices[0]);
                _polyIndices.Add(_packetIndices[1]);
                _polyIndices.Add(_packetIndices[2]);

                if (isQuad)
                {
                    _polyIndices.Add(_packetIndices[2]);
                    _polyIndices.Add(_packetIndices[1]);
                    _polyIndices.Add(_packetIndices[3]);
                }

                // if this primitive is double sided we want to add more vertices with opposite winding order
                if ((prim.Flags & TMDPrimitivePacket.PrimitiveFlags.DoubleSided) != 0)
                {
                    _polyIndices.Add(_packetIndices[1]);
                    _polyIndices.Add(_packetIndices[0]);
                    _polyIndices.Add(_packetIndices[2]);

                    if (isQuad)
                    {
                        _polyIndices.Add(_packetIndices[1]);
                        _polyIndices.Add(_packetIndices[2]);
                        _polyIndices.Add(_packetIndices[3]);
                    }
                }

                // add the indices to the list
                indicesList.AddRange(_polyIndices);
                _polyIndices.Clear();
            }

            Mesh result = new Mesh();
            result.SetVertices(_verts);
            result.SetNormals(_normals);
            result.SetColors(_colors);
            result.SetUVs(0, _uvs);

            // regular mesh
            if (_indices.Count >= 3)
            {
                result.SetTriangles(_indices, 0, false, 0);
            }

            // alpha blended mesh
            if (_alphaBlendIndices.Count >= 3)
            {
                result.subMeshCount = 2;
                result.SetTriangles(_alphaBlendIndices, 1, false, 0);
            }

            return result;
        }

        private void initializeCachedLists(int defaultCapacity)
        {
            _verts = new List<Vector3>(defaultCapacity);
            _normals = new List<Vector3>(defaultCapacity);
            _colors = new List<Color32>(defaultCapacity);
            _uvs = new List<Vector2>(defaultCapacity);
            _indices = new List<int>(defaultCapacity);
            _alphaBlendIndices = new List<int>(defaultCapacity);
            _polyIndices = new List<int>(12); // at most can hold double sided quad
        }

        private void clearCachedLists()
        {
            _verts.Clear();
            _normals.Clear();
            _colors.Clear();
            _uvs.Clear();
            _indices.Clear();
            _alphaBlendIndices.Clear();
        }
    }
}


text:
set -e

export PATH=/usr/lib/llvm-3.5/bin:${PATH}
export LLVM_COMPILER=clang
export WLLVM_OUTPUT=WARNING

wllvm-sanity-checker

wget ${APACHE_URL}httpd-${APACHE_VER}.tar.gz

tar xfz httpd-${APACHE_VER}.tar.gz
mv httpd-${APACHE_VER} apache_clang

cd apache_clang
CC=wllvm ./configure
make
extract-bc httpd

if [ -s "httpd.bc" ]
then
    echo "httpd.bc built."
else
    exit 1
fi


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<service enable-namespace-folding="true" name="ErrorTestServiceV1" xmlns="http://www.ebay.com/soaframework/common/config">
    <package-map>
        <package xml-namespace="http://www.ebay.com/marketplace/error/v1/services" name="com.ebay.marketplace.error.v1.services.testservice"/>
        <package xml-namespace="http://www.ebay.com/marketplace/error/v1/services" name="com.ebay.marketplace.services"/>
    </package-map>
    <operation-list>
        <operation methodName="getVersion" name="getVersion">
            <request-message>
                <java-type-name>com.ebay.marketplace.error.v1.services.testservice.GetVersionRequest</java-type-name>
                <xml-type-name>GetVersionRequest</xml-type-name>
                <xml-element-name>{http://www.ebay.com/marketplace/error/v1/services}getVersionRequest</xml-element-name>
                <has-attachment>false</has-attachment>
            </request-message>
            <response-message>
                <java-type-name>com.ebay.marketplace.error.v1.services.testservice.GetVersionResponse</java-type-name>
                <xml-type-name>GetVersionResponse</xml-type-name>
                <xml-element-name>{http://www.ebay.com/marketplace/error/v1/services}getVersionResponse</xml-element-name>
                <has-attachment>false</has-attachment>
            </response-message>
            <error-message>
                <java-type-name>com.ebay.marketplace.services.ErrorMessage</java-type-name>
                <xml-type-name>ErrorMessage</xml-type-name>
                <xml-element-name>{http://www.ebay.com/marketplace/error/v1/services}errorMessage</xml-element-name>
            </error-message>
        </operation>
        <operation methodName="getPolymorphism" name="getPolymorphism">
            <request-message>
                <java-type-name>com.ebay.marketplace.error.v1.services.testservice.PolyType</java-type-name>
                <xml-type-name>PolyType</xml-type-name>
                <xml-element-name>{http://www.ebay.com/marketplace/error/v1/services}getPolymorphismRequest</xml-element-name>
                <has-attachment>false</has-attachment>
            </request-message>
            <response-message>
                <java-type-name>com.ebay.marketplace.error.v1.services.testservice.GetPolymorphismResponse</java-type-name>
                <xml-type-name>getPolymorphismResponse</xml-type-name>
                <xml-element-name>{http://www.ebay.com/marketplace/error/v1/services}getPolymorphismResponse</xml-element-name>
                <has-attachment>false</has-attachment>
            </response-message>
            <error-message>
                <java-type-name>com.ebay.marketplace.services.ErrorMessage</java-type-name>
                <xml-type-name>ErrorMessage</xml-type-name>
                <xml-element-name>{http://www.ebay.com/marketplace/error/v1/services}errorMessage</xml-element-name>
            </error-message>
        </operation>
        <operation methodName="getError" name="getError">
            <request-message>
                <java-type-name>com.ebay.marketplace.error.v1.services.testservice.GetErrorRequest</java-type-name>
                <xml-type-name>GetErrorRequest</xml-type-name>
                <xml-element-name>{http://www.ebay.com/marketplace/error/v1/services}getErrorRequest</xml-element-name>
                <has-attachment>false</has-attachment>
            </request-message>
            <response-message>
                <java-type-name>com.ebay.marketplace.error.v1.services.testservice.GetErrorResponse</java-type-name>
                <xml-type-name>GetErrorResponse</xml-type-name>
                <xml-element-name>{http://www.ebay.com/marketplace/error/v1/services}getErrorResponse</xml-element-name>
                <has-attachment>false</has-attachment>
            </response-message>
            <error-message>
                <java-type-name>com.ebay.marketplace.services.ErrorMessage</java-type-name>
                <xml-type-name>ErrorMessage</xml-type-name>
                <xml-element-name>{http://www.ebay.com/marketplace/error/v1/services}errorMessage</xml-element-name>
            </error-message>
        </operation>
    </operation-list>
    <java-type-list>
        <java-type-name>com.ebay.marketplace.error.v1.services.testservice.GetErrorRequest</java-type-name>
        <java-type-name>com.ebay.marketplace.error.v1.services.testservice.GetErrorResponse</java-type-name>
        <java-type-name>com.ebay.marketplace.error.v1.services.testservice.GetPolymorphismResponse</java-type-name>
        <java-type-name>com.ebay.marketplace.error.v1.services.testservice.GetVersionRequest</java-type-name>
        <java-type-name>com.ebay.marketplace.error.v1.services.testservice.GetVersionResponse</java-type-name>
        <java-type-name>com.ebay.marketplace.error.v1.services.testservice.PolyType</java-type-name>
        <java-type-name>com.ebay.marketplace.error.v1.services.testservice.TestRequest</java-type-name>
        <java-type-name>com.ebay.marketplace.error.v1.services.testservice.TestRequest1</java-type-name>
        <java-type-name>com.ebay.marketplace.error.v1.services.testservice.TestRequest2</java-type-name>
        <java-type-name>com.ebay.marketplace.services.BaseRequest</java-type-name>
        <java-type-name>com.ebay.marketplace.services.BaseResponse</java-type-name>
        <java-type-name>com.ebay.marketplace.services.ErrorData</java-type-name>
        <java-type-name>com.ebay.marketplace.services.ErrorMessage</java-type-name>
        <java-type-name>com.ebay.marketplace.services.ErrorParameter</java-type-name>
        <java-type-name>com.ebay.marketplace.services.ExtensionType</java-type-name>
    </java-type-list>
</service>


text:
import ray
from ray.tune import run_experiments
import os

from ray.tune.utils.release_test_util import ProgressCallback

num_redis_shards = 5
redis_max_memory = 10**8
object_store_memory = 10**8
num_nodes = 1

message = (
    "Make sure there is enough memory on this machine to run this "
    "workload. We divide the system memory by 2 to provide a buffer."
)
assert (
    num_nodes * object_store_memory + num_redis_shards * redis_max_memory
    < ray._private.utils.get_system_memory() / 2
), message

# Simulate a cluster on one machine.

# cluster = Cluster()
# for i in range(num_nodes):
#     cluster.add_node(
#         redis_port=6379 if i == 0 else None,
#         num_redis_shards=num_redis_shards if i == 0 else None,
#         num_cpus=10,
#         num_gpus=0,
#         resources={str(i): 2},
#         object_store_memory=object_store_memory,
#         redis_max_memory=redis_max_memory,
#         dashboard_host="0.0.0.0")
# ray.init(address=cluster.address)

if "RAY_ADDRESS" in os.environ:
    del os.environ["RAY_ADDRESS"]

ray.init()
# Run the workload.

# Whitespace diff to test things.
run_experiments(
    {
        "impala": {
            "run": "IMPALA",
            "env": "CartPole-v1",
            "config": {
                "num_workers": 8,
                "num_gpus": 0,
                "num_envs_per_worker": 5,
                "remote_worker_envs": True,
                "remote_env_batch_wait_ms": 99999999,
                "rollout_fragment_length": 50,
                "train_batch_size": 100,
            },
        },
    },
    callbacks=[ProgressCallback()],
)


text:
.class public Lcom/caverock/androidsvg/CSSParser$Rule;
.super Ljava/lang/Object;
.source "CSSParser.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/caverock/androidsvg/CSSParser;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x9
    name = "Rule"
.end annotation

# instance fields
.field public selector:Lcom/caverock/androidsvg/CSSParser$Selector;

.field public style:Lcom/caverock/androidsvg/SVG$Style;

# direct methods
.method public constructor <init>(Lcom/caverock/androidsvg/CSSParser$Selector;Lcom/caverock/androidsvg/SVG$Style;)V
    .locals 1

    const/4 v0, 0x0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lcom/caverock/androidsvg/CSSParser$Rule;->selector:Lcom/caverock/androidsvg/CSSParser$Selector;

    iput-object v0, p0, Lcom/caverock/androidsvg/CSSParser$Rule;->style:Lcom/caverock/androidsvg/SVG$Style;

    iput-object p1, p0, Lcom/caverock/androidsvg/CSSParser$Rule;->selector:Lcom/caverock/androidsvg/CSSParser$Selector;

    iput-object p2, p0, Lcom/caverock/androidsvg/CSSParser$Rule;->style:Lcom/caverock/androidsvg/SVG$Style;

    return-void
.end method

# virtual methods
.method public toString()Ljava/lang/String;
    .locals 3

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    iget-object v1, p0, Lcom/caverock/androidsvg/CSSParser$Rule;->selector:Lcom/caverock/androidsvg/CSSParser$Selector;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string/jumbo v2, " {}"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    return-object v1
.end method


text:
<resources>

    <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar" />

    <style name="AppTheme" parent="AppTheme.Base">
        <item name="spbStyle">@style/GNowProgressBar</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="colorControlNormal">@color/colorWhite</item>
        <item name="colorControlActivated">@color/pocket_color_3</item>
        <item name="android:textColorPrimary">@color/colorWhite</item>
        <item name="android:textColorHint">@android:color/darker_gray</item>
        <item name="android:fontFamily">sans-serif</item>
    </style>

</resources>


text:
package org.wso2.andes.server.logging;

import junit.framework.TestCase;
import org.wso2.andes.server.logging.messages.BrokerMessages;

import java.util.Locale;
import java.util.ResourceBundle;

public class LogMessageTest extends TestCase
{

    /**
     * Test that the US local has a loadable bundle.
     * No longer have a specific en_US bundle so cannot verify that that version
     * is loaded. Can only verify that we get a ResourceBundle loaded.
     */
    public void testBundle()
    {
        Locale usLocal = Locale.US;
        Locale.setDefault(usLocal);
        ResourceBundle _messages = ResourceBundle.getBundle("org.wso2.andes.server.logging.messages.Broker_logmessages",
                                                            usLocal);

        assertNotNull("Unable to load ResourceBundle", _messages);
    }

    /**
     * Test that loading an undefined locale will result in loading of the
     * default US locale.
     */
    public void testUndefinedLocale()
    {
        Locale japanese = Locale.JAPANESE;

        Locale.setDefault(japanese);
        try
        {
            ResourceBundle _messages = ResourceBundle.getBundle("org.wso2.andes.server.logging.messages.Broker_logmessages",
                                                                japanese);

            assertNotNull("Unable to load ResourceBundle", _messages);

            // If we attempt to load an undefined locale it should default to the Root locale.
            assertEquals("Loaded bundle has incorrect locale.", Locale.ROOT, _messages.getLocale());
        }
        catch (Throwable t)
        {
            fail(t.getMessage());
        }
    }

    /**
     * test Simultaneous log message generation.
     * QPID-2137 highlighted that log message generation was not thread-safe.
     * Test to ensure that simultaneous logging is possible and does not throw an exception.
     * @throws InterruptedException if there is a problem joining logging threads.
     */
    public void testSimultaneousLogging() throws InterruptedException
    {
        int LOGGERS = 10;
        int LOG_COUNT = 10;
        LogGenerator[] logGenerators = new LogGenerator[LOGGERS];
        Thread[] threads = new Thread[LOGGERS];

        //Create Loggers
        for (int i = 0; i < LOGGERS; i++)
        {
            logGenerators[i] = new LogGenerator(LOG_COUNT);
            threads[i] = new Thread(logGenerators[i]);
        }

        //Run Loggers
        for (int i = 0; i < LOGGERS; i++)
        {
            threads[i].start();
        }

        //End Loggers
        for (int i = 0; i < LOGGERS; i++)
        {
            threads[i].join();
            Exception e = logGenerators[i].getThrowException();
            // If we have an exception something went wrong.
            // Check and see if it was QPID-2137
            if (e != null)
            {
                // Just log out if we find the usual exception causing QPID-2137
                if (e instanceof StringIndexOutOfBoundsException)
                {
                    System.err.println("Detected QPID-2137");
                }
                fail("Exception thrown during log generation:" + e);
            }
        }
    }

    /**
     * Inner class used by testSimultaneousLogging.
     *
     * This class creates a given number of LogMessages using the BrokerMessages package.
     * CONFIG and LISTENING messages are both created per count.
     *
     * This class is run multiple times simultaneously so that we increase the chance of
     * reproducing QPID-2137. This is reproduced when the pattern string used in the MessageFormat
     * class is changed whilst formatting is taking place.
     *
     */
    class LogGenerator implements Runnable
    {
        private Exception _exception = null;
        private int _count;

        /**
         * @param count The number of Log Messages to generate
         */
        LogGenerator(int count)
        {
            _count = count;
        }

        public void run()
        {
            try
            {
                // try and generate _count iterations of Config & Listening messages.
                for (int i = 0; i < _count; i++)
                {
                    BrokerMessages.CONFIG("Config");
                    BrokerMessages.LISTENING("TCP", 1234);
                }
            }
            catch (Exception e)
            {
                // if something goes wrong recorded it for later analysis.
                _exception = e;
            }
        }

        /**
         * Return any exception that was thrown during the log generation.
         * @return Exception
         */
        public Exception getThrowException()
        {
            return _exception;
        }
    }

}


text:
<?php

 /**
  * This file contains configuration for the application.
  * It will be used by app/core/Config.php
  *
  * @license    http://opensource.org/licenses/MIT The MIT License (MIT)
  * @author     Omar El Gabry <omar.elgabry.93@gmail.com>
  */

return array(

    /**
     * Configuration for: Database Connection
     * Define database constants to establish a connection.
     *
     * It's important to set the charset for the database
     *
     * In the real world, you will have a database user with limited privileges(usually only CRUD).
     *
     */
    "DB_HOST" =>"localhost",
    "DB_NAME" => "miniphp_68dozftn",
    "DB_USER" => "root",
    "DB_PASS" => "",
    'DB_CHARSET' => 'utf8',

    /**
     * Configuration for: Paths
     * Paths from views directory
     */
    "VIEWS_PATH"  => APP . "views/",
    "ERRORS_PATH" => APP . "views/errors/",
    "LOGIN_PATH" => APP . "views/login/",
    "ADMIN_VIEWS_PATH" => APP . "views/admin/",

    /**
     * Configuration for: Cookies
     *
     * COOKIE_RUNTIME: How long should a cookie be valid by seconds.
     *      - 1209600 means 2 weeks
     *      - 604800 means 1 week
     * COOKIE_DOMAIN: The domain where the cookie is valid for.
     *      COOKIE_DOMAIN mightn't work with "localhost", ".localhost", "127.0.0.1", or ".127.0.0.1". If so, leave it as empty string, false or null.
     *      @see http://stackoverflow.com/questions/1134290/cookies-on-localhost-with-explicit-domain
     *      @see http://php.net/manual/en/function.setcookie.php#73107
     *
     * COOKIE_PATH: The path where the cookie is valid for. If set to '/', the cookie will be available within the entire COOKIE_DOMAIN.
     * COOKIE_SECURE: If the cookie will be transferred through secured connection(SSL). It's highly recommended to set it to true if you have secured connection
     * COOKIE_HTTP: If set to true, Cookies that can't be accessed by JS - Highly recommended!
     * COOKIE_SECRET_KEY: A random value to make the cookie more secure.
     *
     */
    "COOKIE_EXPIRY" => 1209600,
    "SESSION_COOKIE_EXPIRY" => 604800,
    "COOKIE_DOMAIN" => '',
    "COOKIE_PATH" => '/',
    "COOKIE_SECURE" => false,
    "COOKIE_HTTP" => true,
    "COOKIE_SECRET_KEY" => "af&70-GF^!a{f64r5@g38l]#kQ4B+43%",

    /**
     * Configuration for: Encryption Keys
     *
     */
    "ENCRYPTION_KEY" => "3¥‹a0cd@!$251Êìcef08%&",
    "HMAC_SALT" => "a8C7n7^Ed0%8Qfd9K4m6d$86Dab",
    "HASH_KEY" => "z4D8Mp7Jm5cH",

    /**
     * Configuration for: Email server credentials
     * Emails are sent using SMTP, Don't use built-in mail() function in PHP.
     *
     */
    "EMAIL_SMTP_DEBUG" => 2,
    "EMAIL_SMTP_AUTH" => true,
    "EMAIL_SMTP_SECURE" => "ssl",
    "EMAIL_SMTP_HOST" => "YOURSMTPHOST",
    "EMAIL_SMTP_PORT" => 465,
    "EMAIL_SMTP_USERNAME" => "YOURUSERNAME",
    "EMAIL_SMTP_PASSWORD" => "YOURPASSWORD",
    "EMAIL_FROM" => "info@YOURDOMAIN.com",
    "EMAIL_FROM_NAME" => "mini PHP",
    "EMAIL_REPLY_TO" => "no-reply@YOURDOMAIN.com",
    "ADMIN_EMAIL" => "YOUREMAIL",

    /**
     * Configuration for: Email Verification
     *
     * EMAIL_EMAIL_VERIFICATION_URL: Full URL must be provided
     *
     */
    "EMAIL_EMAIL_VERIFICATION" => "1",
    "EMAIL_EMAIL_VERIFICATION_URL" => PUBLIC_ROOT . "Login/verifyUser",
    "EMAIL_EMAIL_VERIFICATION_SUBJECT" => "[IMP] Please verify your account",

    /**
     * Configuration for: Revoke email change
     *
     * EMAIL_REVOKE_EMAIL_URL: Full URL must be provided
     *
     */
    "EMAIL_REVOKE_EMAIL" => "2",
    "EMAIL_REVOKE_EMAIL_URL" => PUBLIC_ROOT . "User/revokeEmail",
    "EMAIL_REVOKE_EMAIL_SUBJECT" => "[IMP] Your email has been changed",

    /**
     * Configuration for: Confirm pending(updated) email
     *
     * EMAIL_UPDATE_EMAIL_URL: Full URL must be provided
     *
     */
    "EMAIL_UPDATE_EMAIL" => "3",
    "EMAIL_UPDATE_EMAIL_URL" => PUBLIC_ROOT . "User/updateEmail",
    "EMAIL_UPDATE_EMAIL_SUBJECT" => "[IMP] Please confirm your new email",

    /**
     * Configuration for: Reset Password
     *
     * EMAIL_PASSWORD_RESET_URL: Full URL must be provided
     *
     */
    "EMAIL_PASSWORD_RESET" => "4",
    "EMAIL_PASSWORD_RESET_URL" => PUBLIC_ROOT . "Login/resetPassword",
    "EMAIL_PASSWORD_RESET_SUBJECT" => "[IMP] Reset your password",

    /**
     * Configuration for: Report Bug, Feature, or Enhancement
     */
    "EMAIL_REPORT_BUG" => "5",
    "EMAIL_REPORT_BUG_SUBJECT" => "Request",

    /**
     * Configuration for: Hashing strength
     *
     * It defines the strength of the password hashing/salting. "10" is the default value by PHP.
     * @see http://php.net/manual/en/function.password-hash.php
     *
     */
    "HASH_COST_FACTOR" => "10",

    /**
     * Configuration for: Pagination
     *
     */
    "PAGINATION_DEFAULT_LIMIT" => 10

);


text:
namespace Taller.HolaMundo
{
    partial class frmLoginV1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.label2 = new System.Windows.Forms.Label();
            this.txtEMail = new System.Windows.Forms.TextBox();
            this.txtPassword = new System.Windows.Forms.TextBox();
            this.cmdAceptar = new System.Windows.Forms.Button();
            this.cmdCancelar = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(12, 39);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(61, 13);
            this.label2.TabIndex = 1;
            this.label2.Text = "Contraseña";
            //
            // txtEMail
            //
            this.txtEMail.Location = new System.Drawing.Point(90, 10);
            this.txtEMail.Name = "txtEMail";
            this.txtEMail.Size = new System.Drawing.Size(194, 20);
            this.txtEMail.TabIndex = 2;
            this.txtEMail.TextChanged += new System.EventHandler(this.txtEMail_TextChanged);
            //
            // txtPassword
            //
            this.txtPassword.Location = new System.Drawing.Point(90, 36);
            this.txtPassword.Name = "txtPassword";
            this.txtPassword.Size = new System.Drawing.Size(194, 20);
            this.txtPassword.TabIndex = 3;
            this.txtPassword.TextChanged += new System.EventHandler(this.txtPassword_TextChanged);
            //
            // cmdAceptar
            //
            this.cmdAceptar.Enabled = false;
            this.cmdAceptar.Location = new System.Drawing.Point(128, 78);
            this.cmdAceptar.Name = "cmdAceptar";
            this.cmdAceptar.Size = new System.Drawing.Size(75, 23);
            this.cmdAceptar.TabIndex = 4;
            this.cmdAceptar.Text = "Aceptar";
            this.cmdAceptar.UseVisualStyleBackColor = true;
            //
            // cmdCancelar
            //
            this.cmdCancelar.Location = new System.Drawing.Point(209, 78);
            this.cmdCancelar.Name = "cmdCancelar";
            this.cmdCancelar.Size = new System.Drawing.Size(75, 23);
            this.cmdCancelar.TabIndex = 5;
            this.cmdCancelar.Text = "Cancelar";
            this.cmdCancelar.UseVisualStyleBackColor = false;
            this.cmdCancelar.Click += new System.EventHandler(this.cmdCancelar_Click);
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(35, 13);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(38, 13);
            this.label1.TabIndex = 6;
            this.label1.Text = "Correo";
            //
            // frmLoginV1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(297, 112);
            this.ControlBox = false;
            this.Controls.Add(this.label1);
            this.Controls.Add(this.cmdCancelar);
            this.Controls.Add(this.cmdAceptar);
            this.Controls.Add(this.txtPassword);
            this.Controls.Add(this.txtEMail);
            this.Controls.Add(this.label2);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.Name = "frmLoginV1";
            this.Text = "Inicie Session";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox txtEMail;
        private System.Windows.Forms.TextBox txtPassword;
        private System.Windows.Forms.Button cmdAceptar;
        private System.Windows.Forms.Button cmdCancelar;
        private System.Windows.Forms.Label label1;
    }
}


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = transformClass;

var _helperFunctionName = require("@babel/helper-function-name");

var _helperReplaceSupers = require("@babel/helper-replace-supers");

var _helperEnvironmentVisitor = require("@babel/helper-environment-visitor");

var _helperOptimiseCallExpression = require("@babel/helper-optimise-call-expression");

var _core = require("@babel/core");

var _helperAnnotateAsPure = require("@babel/helper-annotate-as-pure");

var _inlineCreateSuperHelpers = require("./inline-createSuper-helpers");

function buildConstructor(classRef, constructorBody, node) {
  const func = _core.types.functionDeclaration(_core.types.cloneNode(classRef), [], constructorBody);

  _core.types.inherits(func, node);

  return func;
}

function transformClass(path, file, builtinClasses, isLoose, assumptions) {
  const classState = {
    parent: undefined,
    scope: undefined,
    node: undefined,
    path: undefined,
    file: undefined,
    classId: undefined,
    classRef: undefined,
    superFnId: undefined,
    superName: undefined,
    superReturns: [],
    isDerived: false,
    extendsNative: false,
    construct: undefined,
    constructorBody: undefined,
    userConstructor: undefined,
    userConstructorPath: undefined,
    hasConstructor: false,
    staticPropBody: [],
    body: [],
    superThises: [],
    pushedConstructor: false,
    pushedInherits: false,
    pushedCreateClass: false,
    protoAlias: null,
    isLoose: false,
    dynamicKeys: new Map(),
    methods: {
      instance: {
        hasComputed: false,
        list: [],
        map: new Map()
      },
      static: {
        hasComputed: false,
        list: [],
        map: new Map()
      }
    }
  };

  const setState = newState => {
    Object.assign(classState, newState);
  };

  const findThisesVisitor = _core.traverse.visitors.merge([_helperEnvironmentVisitor.default, {
    ThisExpression(path) {
      classState.superThises.push(path);
    }

  }]);

  function createClassHelper(args) {
    return _core.types.callExpression(classState.file.addHelper("createClass"), args);
  }

  function maybeCreateConstructor() {
    let hasConstructor = false;
    const paths = classState.path.get("body.body");

    for (const path of paths) {
      hasConstructor = path.equals("kind", "constructor");
      if (hasConstructor) break;
    }

    if (hasConstructor) return;
    let params, body;

    if (classState.isDerived) {
      const constructor = _core.template.expression.ast`
        (function () {
          super(...arguments);
        })
      `;
      params = constructor.params;
      body = constructor.body;
    } else {
      params = [];
      body = _core.types.blockStatement([]);
    }

    classState.path.get("body").unshiftContainer("body", _core.types.classMethod("constructor", _core.types.identifier("constructor"), params, body));
  }

  function buildBody() {
    maybeCreateConstructor();
    pushBody();
    verifyConstructor();

    if (classState.userConstructor) {
      const {
        constructorBody,
        userConstructor,
        construct
      } = classState;
      constructorBody.body.push(...userConstructor.body.body);

      _core.types.inherits(construct, userConstructor);

      _core.types.inherits(constructorBody, userConstructor.body);
    }

    pushDescriptors();
  }

  function pushBody() {
    const classBodyPaths = classState.path.get("body.body");

    for (const path of classBodyPaths) {
      const node = path.node;

      if (path.isClassProperty()) {
        throw path.buildCodeFrameError("Missing class properties transform.");
      }

      if (node.decorators) {
        throw path.buildCodeFrameError("Method has decorators, put the decorator plugin before the classes one.");
      }

      if (_core.types.isClassMethod(node)) {
        const isConstructor = node.kind === "constructor";
        const replaceSupers = new _helperReplaceSupers.default({
          methodPath: path,
          objectRef: classState.classRef,
          superRef: classState.superName,
          constantSuper: assumptions.constantSuper,
          file: classState.file,
          refToPreserve: classState.classRef
        });
        replaceSupers.replace();
        const superReturns = [];
        path.traverse(_core.traverse.visitors.merge([_helperEnvironmentVisitor.default, {
          ReturnStatement(path) {
            if (!path.getFunctionParent().isArrowFunctionExpression()) {
              superReturns.push(path);
            }
          }

        }]));

        if (isConstructor) {
          pushConstructor(superReturns, node, path);
        } else {
          pushMethod(node, path);
        }
      }
    }
  }

  function pushDescriptors() {
    pushInheritsToBody();
    const {
      body
    } = classState;
    const props = {
      instance: null,
      static: null
    };

    for (const placement of ["static", "instance"]) {
      if (classState.methods[placement].list.length) {
        props[placement] = classState.methods[placement].list.map(desc => {
          const obj = _core.types.objectExpression([_core.types.objectProperty(_core.types.identifier("key"), desc.key)]);

          for (const kind of ["get", "set", "value"]) {
            if (desc[kind] != null) {
              obj.properties.push(_core.types.objectProperty(_core.types.identifier(kind), desc[kind]));
            }
          }

          return obj;
        });
      }
    }

    if (props.instance || props.static) {
      let args = [_core.types.cloneNode(classState.classRef), props.instance ? _core.types.arrayExpression(props.instance) : _core.types.nullLiteral(), props.static ? _core.types.arrayExpression(props.static) : _core.types.nullLiteral()];
      let lastNonNullIndex = 0;

      for (let i = 0; i < args.length; i++) {
        if (!_core.types.isNullLiteral(args[i])) lastNonNullIndex = i;
      }

      args = args.slice(0, lastNonNullIndex + 1);
      body.push(_core.types.expressionStatement(createClassHelper(args)));
      classState.pushedCreateClass = true;
    }
  }

  function wrapSuperCall(bareSuper, superRef, thisRef, body) {
    const bareSuperNode = bareSuper.node;
    let call;

    if (assumptions.superIsCallableConstructor) {
      bareSuperNode.arguments.unshift(_core.types.thisExpression());

      if (bareSuperNode.arguments.length === 2 && _core.types.isSpreadElement(bareSuperNode.arguments[1]) && _core.types.isIdentifier(bareSuperNode.arguments[1].argument, {
        name: "arguments"
      })) {
        bareSuperNode.arguments[1] = bareSuperNode.arguments[1].argument;
        bareSuperNode.callee = _core.types.memberExpression(_core.types.cloneNode(superRef), _core.types.identifier("apply"));
      } else {
        bareSuperNode.callee = _core.types.memberExpression(_core.types.cloneNode(superRef), _core.types.identifier("call"));
      }

      call = _core.types.logicalExpression("||", bareSuperNode, _core.types.thisExpression());
    } else {
      call = (0, _helperOptimiseCallExpression.default)(_core.types.cloneNode(classState.superFnId), _core.types.thisExpression(), bareSuperNode.arguments, false);
    }

    if (bareSuper.parentPath.isExpressionStatement() && bareSuper.parentPath.container === body.node.body && body.node.body.length - 1 === bareSuper.parentPath.key) {
      if (classState.superThises.length) {
        call = _core.types.assignmentExpression("=", thisRef(), call);
      }

      bareSuper.parentPath.replaceWith(_core.types.returnStatement(call));
    } else {
      bareSuper.replaceWith(_core.types.assignmentExpression("=", thisRef(), call));
    }
  }

  function verifyConstructor() {
    if (!classState.isDerived) return;
    const path = classState.userConstructorPath;
    const body = path.get("body");
    path.traverse(findThisesVisitor);

    let thisRef = function () {
      const ref = path.scope.generateDeclaredUidIdentifier("this");

      thisRef = () => _core.types.cloneNode(ref);

      return ref;
    };

    for (const thisPath of classState.superThises) {
      const {
        node,
        parentPath
      } = thisPath;

      if (parentPath.isMemberExpression({
        object: node
      })) {
        thisPath.replaceWith(thisRef());
        continue;
      }

      thisPath.replaceWith(_core.types.callExpression(classState.file.addHelper("assertThisInitialized"), [thisRef()]));
    }

    const bareSupers = new Set();
    path.traverse(_core.traverse.visitors.merge([_helperEnvironmentVisitor.default, {
      Super(path) {
        const {
          node,
          parentPath
        } = path;

        if (parentPath.isCallExpression({
          callee: node
        })) {
          bareSupers.add(parentPath);
        }
      }

    }]));
    let guaranteedSuperBeforeFinish = !!bareSupers.size;

    for (const bareSuper of bareSupers) {
      wrapSuperCall(bareSuper, classState.superName, thisRef, body);

      if (guaranteedSuperBeforeFinish) {
        bareSuper.find(function (parentPath) {
          if (parentPath === path) {
            return true;
          }

          if (parentPath.isLoop() || parentPath.isConditional() || parentPath.isArrowFunctionExpression()) {
            guaranteedSuperBeforeFinish = false;
            return true;
          }
        });
      }
    }

    let wrapReturn;

    if (classState.isLoose) {
      wrapReturn = returnArg => {
        const thisExpr = _core.types.callExpression(classState.file.addHelper("assertThisInitialized"), [thisRef()]);

        return returnArg ? _core.types.logicalExpression("||", returnArg, thisExpr) : thisExpr;
      };
    } else {
      wrapReturn = returnArg => _core.types.callExpression(classState.file.addHelper("possibleConstructorReturn"), [thisRef()].concat(returnArg || []));
    }

    const bodyPaths = body.get("body");

    if (!bodyPaths.length || !bodyPaths.pop().isReturnStatement()) {
      body.pushContainer("body", _core.types.returnStatement(guaranteedSuperBeforeFinish ? thisRef() : wrapReturn()));
    }

    for (const returnPath of classState.superReturns) {
      returnPath.get("argument").replaceWith(wrapReturn(returnPath.node.argument));
    }
  }

  function pushMethod(node, path) {
    const scope = path ? path.scope : classState.scope;

    if (node.kind === "method") {
      if (processMethod(node, scope)) return;
    }

    const placement = node.static ? "static" : "instance";
    const methods = classState.methods[placement];
    const descKey = node.kind === "method" ? "value" : node.kind;
    const key = _core.types.isNumericLiteral(node.key) || _core.types.isBigIntLiteral(node.key) ? _core.types.stringLiteral(String(node.key.value)) : _core.types.toComputedKey(node);

    let fn = _core.types.toExpression(node);

    if (_core.types.isStringLiteral(key)) {
      if (node.kind === "method") {
        fn = (0, _helperFunctionName.default)({
          id: key,
          node: node,
          scope
        });
      }
    } else {
      methods.hasComputed = true;
    }

    let descriptor;

    if (!methods.hasComputed && methods.map.has(key.value)) {
      descriptor = methods.map.get(key.value);
      descriptor[descKey] = fn;

      if (descKey === "value") {
        descriptor.get = null;
        descriptor.set = null;
      } else {
        descriptor.value = null;
      }
    } else {
      descriptor = {
        key: key,
        [descKey]: fn
      };
      methods.list.push(descriptor);

      if (!methods.hasComputed) {
        methods.map.set(key.value, descriptor);
      }
    }
  }

  function processMethod(node, scope) {
    if (assumptions.setClassMethods && !node.decorators) {
      let {
        classRef
      } = classState;

      if (!node.static) {
        insertProtoAliasOnce();
        classRef = classState.protoAlias;
      }

      const methodName = _core.types.memberExpression(_core.types.cloneNode(classRef), node.key, node.computed || _core.types.isLiteral(node.key));

      let func = _core.types.functionExpression(null, node.params, node.body, node.generator, node.async);

      _core.types.inherits(func, node);

      const key = _core.types.toComputedKey(node, node.key);

      if (_core.types.isStringLiteral(key)) {
        func = (0, _helperFunctionName.default)({
          node: func,
          id: key,
          scope
        });
      }

      const expr = _core.types.expressionStatement(_core.types.assignmentExpression("=", methodName, func));

      _core.types.inheritsComments(expr, node);

      classState.body.push(expr);
      return true;
    }

    return false;
  }

  function insertProtoAliasOnce() {
    if (classState.protoAlias === null) {
      setState({
        protoAlias: classState.scope.generateUidIdentifier("proto")
      });

      const classProto = _core.types.memberExpression(classState.classRef, _core.types.identifier("prototype"));

      const protoDeclaration = _core.types.variableDeclaration("var", [_core.types.variableDeclarator(classState.protoAlias, classProto)]);

      classState.body.push(protoDeclaration);
    }
  }

  function pushConstructor(superReturns, method, path) {
    setState({
      userConstructorPath: path,
      userConstructor: method,
      hasConstructor: true,
      superReturns
    });
    const {
      construct
    } = classState;

    _core.types.inheritsComments(construct, method);

    construct.params = method.params;

    _core.types.inherits(construct.body, method.body);

    construct.body.directives = method.body.directives;
    pushConstructorToBody();
  }

  function pushConstructorToBody() {
    if (classState.pushedConstructor) return;
    classState.pushedConstructor = true;

    if (classState.hasInstanceDescriptors || classState.hasStaticDescriptors) {
      pushDescriptors();
    }

    classState.body.push(classState.construct);
    pushInheritsToBody();
  }

  function pushInheritsToBody() {
    if (!classState.isDerived || classState.pushedInherits) return;
    const superFnId = path.scope.generateUidIdentifier("super");
    setState({
      pushedInherits: true,
      superFnId
    });

    if (!assumptions.superIsCallableConstructor) {
      classState.body.unshift(_core.types.variableDeclaration("var", [_core.types.variableDeclarator(superFnId, _core.types.callExpression((0, _inlineCreateSuperHelpers.default)(classState.file), [_core.types.cloneNode(classState.classRef)]))]));
    }

    classState.body.unshift(_core.types.expressionStatement(_core.types.callExpression(classState.file.addHelper(classState.isLoose ? "inheritsLoose" : "inherits"), [_core.types.cloneNode(classState.classRef), _core.types.cloneNode(classState.superName)])));
  }

  function extractDynamicKeys() {
    const {
      dynamicKeys,
      node,
      scope
    } = classState;

    for (const elem of node.body.body) {
      if (!_core.types.isClassMethod(elem) || !elem.computed) continue;
      if (scope.isPure(elem.key, true)) continue;
      const id = scope.generateUidIdentifierBasedOnNode(elem.key);
      dynamicKeys.set(id.name, elem.key);
      elem.key = id;
    }
  }

  function setupClosureParamsArgs() {
    const {
      superName,
      dynamicKeys
    } = classState;
    const closureParams = [];
    const closureArgs = [];

    if (classState.isDerived) {
      let arg = _core.types.cloneNode(superName);

      if (classState.extendsNative) {
        arg = _core.types.callExpression(classState.file.addHelper("wrapNativeSuper"), [arg]);
        (0, _helperAnnotateAsPure.default)(arg);
      }

      const param = classState.scope.generateUidIdentifierBasedOnNode(superName);
      closureParams.push(param);
      closureArgs.push(arg);
      setState({
        superName: _core.types.cloneNode(param)
      });
    }

    for (const [name, value] of dynamicKeys) {
      closureParams.push(_core.types.identifier(name));
      closureArgs.push(value);
    }

    return {
      closureParams,
      closureArgs
    };
  }

  function classTransformer(path, file, builtinClasses, isLoose) {
    setState({
      parent: path.parent,
      scope: path.scope,
      node: path.node,
      path,
      file,
      isLoose
    });
    setState({
      classId: classState.node.id,
      classRef: classState.node.id ? _core.types.identifier(classState.node.id.name) : classState.scope.generateUidIdentifier("class"),
      superName: classState.node.superClass,
      isDerived: !!classState.node.superClass,
      constructorBody: _core.types.blockStatement([])
    });
    setState({
      extendsNative: classState.isDerived && builtinClasses.has(classState.superName.name) && !classState.scope.hasBinding(classState.superName.name, true)
    });
    const {
      classRef,
      node,
      constructorBody
    } = classState;
    setState({
      construct: buildConstructor(classRef, constructorBody, node)
    });
    extractDynamicKeys();
    const {
      body
    } = classState;
    const {
      closureParams,
      closureArgs
    } = setupClosureParamsArgs();
    buildBody();

    if (!assumptions.noClassCalls) {
      constructorBody.body.unshift(_core.types.expressionStatement(_core.types.callExpression(classState.file.addHelper("classCallCheck"), [_core.types.thisExpression(), _core.types.cloneNode(classState.classRef)])));
    }

    body.push(...classState.staticPropBody.map(fn => fn(_core.types.cloneNode(classState.classRef))));
    const isStrict = path.isInStrictMode();
    let constructorOnly = classState.classId && body.length === 1;

    if (constructorOnly && !isStrict) {
      for (const param of classState.construct.params) {
        if (!_core.types.isIdentifier(param)) {
          constructorOnly = false;
          break;
        }
      }
    }

    const directives = constructorOnly ? body[0].body.directives : [];

    if (!isStrict) {
      directives.push(_core.types.directive(_core.types.directiveLiteral("use strict")));
    }

    if (constructorOnly) {
      const expr = _core.types.toExpression(body[0]);

      return classState.isLoose ? expr : createClassHelper([expr]);
    }

    let returnArg = _core.types.cloneNode(classState.classRef);

    if (!classState.pushedCreateClass && !classState.isLoose) {
      returnArg = createClassHelper([returnArg]);
    }

    body.push(_core.types.returnStatement(returnArg));

    const container = _core.types.arrowFunctionExpression(closureParams, _core.types.blockStatement(body, directives));

    return _core.types.callExpression(container, closureArgs);
  }

  return classTransformer(path, file, builtinClasses, isLoose);
}