module Test.Kore.Step
    ( test_constructorRewriting
    , test_ruleThatDoesn'tApply
    , test_stepStrategy
    , test_SMT
    , test_unificationError
    ) where

import Prelude.Kore

import Test.Tasty

import qualified Control.Exception as Exception
import qualified Control.Lens as Lens
import Data.Default
    ( def
    )
import Data.Generics.Product

import Data.Limit
    ( Limit (..)
    )
import Data.Text
    ( Text
    )
import qualified Kore.Attribute.Symbol as Attribute
import Kore.IndexedModule.MetadataTools
    ( MetadataTools (..)
    , SmtMetadataTools
    )
import Kore.Internal.Condition
    ( Condition
    )
import qualified Kore.Internal.Condition as Condition
import Kore.Internal.Conditional as Conditional
    ( Conditional (Conditional)
    )
import Kore.Internal.Pattern
    ( Pattern
    )
import qualified Kore.Internal.Pattern as Pattern
import Kore.Internal.Predicate
    ( Predicate
    , makeEqualsPredicate
    , makeEqualsPredicate_
    , makeTruePredicate
    , makeTruePredicate_
    )
import Kore.Internal.Symbol
    ( Symbol (Symbol, symbolConstructor)
    , constructor
    , functional
    )
import qualified Kore.Internal.Symbol as Symbol
import Kore.Internal.TermLike
    ( TermLike
    , mkApplySymbol
    , mkElemVar
    , mkImplies
    )
import qualified Kore.Internal.TermLike as TermLike
import Kore.Rewriting.RewritingVariable
import Kore.Sort
    ( Sort (..)
    )
import Kore.Step
import Kore.Step.RulePattern
    ( RewriteRule (RewriteRule)
    , injectTermIntoRHS
    , mkRewritingRule
    )
import Kore.Step.RulePattern as RulePattern
    ( RulePattern (..)
    , rulePattern
    )
import qualified Kore.Step.Strategy as Strategy
import Kore.Syntax.Variable

import Test.Kore
import qualified Test.Kore.Step.MockSymbols as Mock
import Test.Kore.Step.Simplification
import Test.Tasty.HUnit.Ext

{-
    Tests of running a strategy by checking if the expected
    endpoint of the rewrites is achieved.

    These tests are concise examples of common situations.
    They are more integration tests than unit tests.
-}

-- DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER
-- The names of constructors ("c1", etc.) must match those in
-- `mockMetadataTools. `
test_constructorRewriting :: TestTree
test_constructorRewriting =
    applyStrategy                              "a constructor applied to a var"
        ( Start $ cons c1 ["var"])
        [ Axiom $ cons c1 ["x1"] `rewritesTo` cons c2 ["x1"]
        , Axiom $ cons c2 ["x2"] `rewritesTo` cons c3 ["x2"]
        ]
        ( Expect $                            cons c3 ["var"])
      where
        cons = applyConstructorToVariables

constructorSymbol :: Text -> Symbol
constructorSymbol name = symbol name & functional & constructor

c1, c2, c3, unused :: Symbol
c1 = constructorSymbol "c1"
c2 = constructorSymbol "c2"
c3 = constructorSymbol "c3"
unused = constructorSymbol "unused"

test_ruleThatDoesn'tApply :: TestTree
test_ruleThatDoesn'tApply =
    applyStrategy                              "unused rewrite rule"
        ( Start $ cons c1     ["var"])
        [ Axiom $ cons c1     ["x1"] `rewritesTo`  cons c2 ["x1"]
        , Axiom $ cons unused ["x2"] `rewritesTo`  var "x2"
        ]
        ( Expect $                                 cons c2 ["var"])
      where
        cons = applyConstructorToVariables

        {- Test API -}

applyStrategy
    :: HasCallStack
    => TestName -> Start -> [Axiom] -> Expect -> TestTree
applyStrategy testName start axioms expected =
    testCase testName $
        takeSteps (start, axioms) >>= compareTo expected

        {- API Helpers -}

takeSteps :: (Start, [Axiom]) -> IO Actual
takeSteps (Start start, wrappedAxioms) =
    (<$>) pickLongest
    $ runSimplifier mockEnv
    $ makeExecutionGraph
        (makeRewritingTerm start)
        (mkRewritingRule . unAxiom <$> wrappedAxioms)
  where
    makeExecutionGraph configuration axioms =
        Strategy.runStrategy
            Unlimited
            transitionRule
            (repeat $ priorityAllStrategy axioms)
            (pure configuration)
    makeRewritingTerm = TermLike.mapVariables (pure mkConfigVariable)

compareTo
    :: HasCallStack
    => Expect -> Actual -> IO ()
compareTo (Expect expected) actual =
    assertEqual
        ""
        (mkRewritingPattern . Pattern.fromTermLike $ expected)
        actual

    {- Types used in this file -}

type CommonTermLike = TermLike VariableName

-- Test types
type TestPattern = CommonTermLike
newtype Start = Start TestPattern
newtype Axiom = Axiom { unAxiom :: RewriteRule VariableName }
newtype Expect = Expect TestPattern

type Actual = Pattern RewritingVariableName

-- Builders -- should these find a better home?

-- | Create a function pattern from a function name and list of argnames.
applyConstructorToVariables :: Symbol -> [Text] -> TestPattern
applyConstructorToVariables constr arguments =
    mkApplySymbol constr (var <$> arguments)

-- | Do the busywork of converting a name into a variable pattern.
var :: Text -> TestPattern
var name =
    mkElemVar $ mkElementVariable (testId name) Mock.testSort
-- can the above be more abstract?

rewritesTo :: TestPattern -> TestPattern -> RewriteRule VariableName
rewritesTo = (RewriteRule .) . rulePattern

{-

    The following tests are old and should eventually be rewritten.

    They should perhaps be rewritten to use individual Kore.Step functions
    like `rewriteStep`.
-}

v1, a1, b1, x1 :: Sort -> ElementVariable VariableName
v1 = mkElementVariable (testId "v1")
a1 = mkElementVariable (testId "a1")
b1 = mkElementVariable (testId "b1")
x1 = mkElementVariable (testId "x1")

rewriteIdentity :: RewriteRule VariableName
rewriteIdentity =
    RewriteRule $ rulePattern
        (mkElemVar (x1 Mock.testSort))
        (mkElemVar (x1 Mock.testSort))

rewriteImplies :: RewriteRule VariableName
rewriteImplies =
    RewriteRule $ rulePattern
        (mkElemVar (x1 Mock.testSort))
        (mkImplies
                (mkElemVar $ x1 Mock.testSort)
                (mkElemVar $ x1 Mock.testSort)
        )

expectTwoAxioms :: [Pattern RewritingVariableName]
expectTwoAxioms =
    [ Pattern.fromTermLike (mkElemVar $ v1 Mock.testSort)
    , Pattern.fromTermLike
        $ mkImplies
            (mkElemVar $ v1 Mock.testSort)
            (mkElemVar $ v1 Mock.testSort)
    ]
    & fmap mkRewritingPattern

actualTwoAxioms :: IO [Pattern RewritingVariableName]
actualTwoAxioms =
    runStep
        Conditional
            { term = mkElemVar (v1 Mock.testSort)
            , predicate = makeTruePredicate_
            , substitution = mempty
            }
        [ mkRewritingRule rewriteIdentity
        , mkRewritingRule rewriteImplies
        ]

initialFailSimple :: Pattern VariableName
initialFailSimple =
    Conditional
        { term =
            metaSigma
                (metaG (mkElemVar $ a1 Mock.testSort))
                (metaF (mkElemVar $ b1 Mock.testSort))
        , predicate = makeTruePredicate_
        , substitution = mempty
        }

expectFailSimple :: [Pattern RewritingVariableName]
expectFailSimple = [initialFailSimple & mkRewritingPattern]

actualFailSimple :: IO [Pattern RewritingVariableName]
actualFailSimple =
    runStep
        initialFailSimple
        [ mkRewritingRule . RewriteRule $ rulePattern
            (metaSigma
                    (mkElemVar $ x1 Mock.testSort)
                    (mkElemVar $ x1 Mock.testSort)
            )
            (mkElemVar (x1 Mock.testSort))
        ]

initialFailCycle :: Pattern VariableName
initialFailCycle =
    Conditional
        { term =
            metaSigma
                (mkElemVar $ a1 Mock.testSort)
                (mkElemVar $ a1 Mock.testSort)
        , predicate = makeTruePredicate_
        , substitution = mempty
        }

expectFailCycle :: [Pattern RewritingVariableName]
expectFailCycle = [initialFailCycle & mkRewritingPattern]

actualFailCycle :: IO [Pattern RewritingVariableName]
actualFailCycle =
    runStep
        initialFailCycle
        [ mkRewritingRule . RewriteRule $ rulePattern
            (metaSigma
                    (metaF (mkElemVar $ x1 Mock.testSort))
                    (mkElemVar $ x1 Mock.testSort)
            )
            (mkElemVar (x1 Mock.testSort))
        ]

initialIdentity :: Pattern VariableName
initialIdentity =
    Conditional
        { term = mkElemVar (v1 Mock.testSort)
        , predicate = makeTruePredicate Mock.testSort
        , substitution = mempty
        }

expectIdentity :: [Pattern RewritingVariableName]
expectIdentity = [initialIdentity & mkRewritingPattern]

actualIdentity :: IO [Pattern RewritingVariableName]
actualIdentity =
    runStep
        initialIdentity
        [ mkRewritingRule rewriteIdentity ]

test_stepStrategy :: [TestTree]
test_stepStrategy =
    [ testCase "Applies a simple axiom"
        -- Axiom: X1 => X1
        -- Start pattern: V1
        -- Expected: V1
        (assertEqual "" expectIdentity =<< actualIdentity)
    , testCase "Applies two simple axioms"
        -- Axiom: X1 => X1
        -- Axiom: X1 => implies(X1, X1)
        -- Start pattern: V1
        -- Expected: V1
        -- Expected: implies(V1, V1)
        (assertEqual "" expectTwoAxioms =<< actualTwoAxioms)
    , testCase "Fails to apply a simple axiom"      --- unification failure
        -- Axiom: sigma(X1, X1) => X1
        -- Start pattern: sigma(f(A1), g(B1))
        -- Expected: empty result list
        (assertEqual "" expectFailSimple =<< actualFailSimple)
    , testCase "Fails to apply a simple axiom due to cycle."
        -- unification error constructor based
        -- Axiom: sigma(f(X1), X1) => X1
        -- Start pattern: sigma(A1, A1)
        -- Expected: empty result list
        (assertEqual "" expectFailCycle =<< actualFailCycle)
    ]

data PredicateState = PredicatePositive | PredicateNegated

predicateStateToBool :: PredicateState -> Bool
predicateStateToBool PredicatePositive = True
predicateStateToBool PredicateNegated = False

smtTerm :: TermLike VariableName -> TermLike VariableName
smtTerm term = Mock.functionalConstr10 term

smtSyntaxPredicate
    :: TermLike VariableName -> PredicateState -> Predicate VariableName
smtSyntaxPredicate term predicateState =
    makeEqualsPredicate_
        (Mock.lessInt
            (Mock.fTestInt term)
            (Mock.builtinInt 0)
        )
        (Mock.builtinBool (predicateStateToBool predicateState))

smtCondition :: TermLike VariableName -> PredicateState -> Condition VariableName
smtCondition term predicateState =
    Condition.fromPredicate (smtSyntaxPredicate term predicateState)

smtPattern :: TermLike VariableName -> PredicateState -> Pattern VariableName
smtPattern term predicateState =
    smtTerm term `Pattern.withCondition` smtCondition term predicateState

test_SMT :: [TestTree]
test_SMT =
    [ testCase "Branching with SMT pruning" $ do
        -- Target: a
        -- Coinductive axiom: n/a
        -- Normal axiom: constr10(b) => c | f(b) >= 0
        -- Normal axiom: constr10(b) => a | f(b) < 0
        -- Start pattern: constr10(b) | f(b) < 0
        -- Expected: a | f(b) < 0
        [ _actual1 ] <- runStepMockEnv
            (smtPattern Mock.b PredicatePositive)
            [ mkRewritingRule $ RewriteRule RulePattern
                { left = smtTerm (TermLike.mkElemVar Mock.x)
                , antiLeft = Nothing
                , requires =
                    smtSyntaxPredicate (TermLike.mkElemVar Mock.x) PredicatePositive
                , rhs = injectTermIntoRHS Mock.a
                , attributes = def
                }
            , mkRewritingRule $ RewriteRule RulePattern
                { left = smtTerm (TermLike.mkElemVar Mock.x)
                , antiLeft = Nothing
                , rhs = injectTermIntoRHS Mock.c
                , requires =
                    smtSyntaxPredicate (TermLike.mkElemVar Mock.x) PredicateNegated
                , attributes = def
                }
            ]
        assertEqual ""
            [ Mock.a
                `Pattern.withCondition` smtCondition Mock.b PredicatePositive
                & mkRewritingPattern
            ]
            [ _actual1 ]
    , testCase "Remainder with SMT pruning" $ do
        -- Target: a
        -- Coinductive axiom: n/a
        -- Normal axiom: constr10(b) => a | f(b) < 0
        -- Start pattern: constr10(b) | f(b) < 0
        -- Expected: a | f(b) < 0
        [ _actual1 ] <- runStepMockEnv
            Conditional
                { term = Mock.functionalConstr10 Mock.b
                , predicate = makeEqualsPredicate_
                    (Mock.lessInt
                        (Mock.fTestInt Mock.b)
                        (Mock.builtinInt 0)
                    )
                    (Mock.builtinBool True)
                , substitution = mempty
                }
            [ mkRewritingRule $ RewriteRule RulePattern
                { left = Mock.functionalConstr10 (TermLike.mkElemVar Mock.x)
                , antiLeft = Nothing
                , rhs = injectTermIntoRHS Mock.a
                , requires =
                    makeEqualsPredicate_
                        (Mock.lessInt
                            (Mock.fTestInt (TermLike.mkElemVar Mock.x))
                            (Mock.builtinInt 0)
                        )
                        (Mock.builtinBool True)
                , attributes = def
                }
            ]
        assertEqual ""
            [ Conditional
                { term = Mock.a
                , predicate =
                    makeEqualsPredicate Mock.testSort
                        (Mock.lessInt
                            (Mock.fTestInt Mock.b)
                            (Mock.builtinInt 0)
                        )
                        (Mock.builtinBool True)
                , substitution = mempty
                }
            ]
            [ _actual1 ]
    ]

test_unificationError :: TestTree
test_unificationError =
    testCase "Throws unification error" $ do
        result <- Exception.try actualUnificationError
        case result of
            Left (Exception.ErrorCall _) -> return ()
            Right _ -> assertFailure "Expected unification error"

actualUnificationError :: IO [Pattern RewritingVariableName]
actualUnificationError =
    runStep
        Conditional
            { term =
                metaSigma
                    (mkElemVar $ a1 Mock.testSort)
                    (metaI (mkElemVar $ b1 Mock.testSort))
            , predicate = makeTruePredicate_
            , substitution = mempty
            }
        [mkRewritingRule axiomMetaSigmaId]

mockMetadataTools :: SmtMetadataTools Attribute.Symbol
mockMetadataTools = MetadataTools
    { sortAttributes = const def
    , applicationSorts = undefined
    , symbolAttributes = undefined
    , smtData = undefined
    , sortConstructors = undefined
    }

mockEnv :: Env Simplifier
mockEnv = Mock.env { metadataTools = mockMetadataTools }

sigmaSymbol :: Symbol
sigmaSymbol =
    symbol "#sigma"
    & functional & constructor
    & Lens.set (field @"symbolSorts") sorts
  where
    sorts = Symbol.applicationSorts [Mock.testSort, Mock.testSort] Mock.testSort

metaSigma
    :: TermLike VariableName
    -> TermLike VariableName
    -> TermLike VariableName
metaSigma p1 p2 = mkApplySymbol sigmaSymbol [p1, p2]

axiomMetaSigmaId :: RewriteRule VariableName
axiomMetaSigmaId =
    RewriteRule $ rulePattern
        (metaSigma
                (mkElemVar $ x1 Mock.testSort)
                (mkElemVar $ x1 Mock.testSort)
        )
        (mkElemVar $ x1 Mock.testSort)

symbol :: Text -> Symbol
symbol name =
    Symbol
        { symbolConstructor = testId name
        , symbolParams = []
        , symbolAttributes = Attribute.defaultSymbolAttributes
        , symbolSorts = Symbol.applicationSorts [Mock.testSort] Mock.testSort
        }

fSymbol :: Symbol
fSymbol = symbol "#f" & functional & constructor

metaF :: TermLike VariableName -> TermLike VariableName
metaF p = mkApplySymbol fSymbol [p]

gSymbol :: Symbol
gSymbol = symbol "#g" & functional & constructor

metaG :: TermLike VariableName -> TermLike VariableName
metaG p = mkApplySymbol gSymbol [p]

iSymbol :: Symbol
iSymbol = symbol "#i"

metaI :: TermLike VariableName -> TermLike VariableName
metaI p = mkApplySymbol iSymbol [p]

runStep
    :: Pattern VariableName
    -- ^left-hand-side of unification
    -> [RewriteRule RewritingVariableName]
    -> IO [Pattern RewritingVariableName]
runStep configuration axioms =
    (<$>) pickFinal
    $ runSimplifier mockEnv
    $ runStrategy Unlimited transitionRule [priorityAllStrategy axioms] (mkRewritingPattern configuration)

runStepMockEnv
    :: Pattern VariableName
    -- ^left-hand-side of unification
    -> [RewriteRule RewritingVariableName]
    -> IO [Pattern RewritingVariableName]
runStepMockEnv configuration axioms =
    (<$>) pickFinal
    $ runSimplifier Mock.env
    $ runStrategy Unlimited transitionRule [priorityAllStrategy axioms] (mkRewritingPattern configuration)

{'repo_name': 'kframework/kore', 'stars': '125', 'repo_language': 'Haskell', 'file_name': 'sources.json', 'mime_type': 'text/plain', 'hash': -763316522429298393, 'source_dataset': 'data'}


///
///  Fast and simple IO library for Arduino compatible boards.
///  Not the fastest, but simplest to use (for me at least).
///  Created for personal use, use it at your own risk and benefit.
///	 https://github.com/GitMoDu/Fast
///

#ifndef _FAST_h
#define _FAST_h

#include <Arduino.h>

class Fast
{

protected:
#define INVALID_PIN 254
	uint8_t *Mode;
	volatile uint8_t *OutPin;
	volatile uint8_t *InPin;
	uint8_t PinAddressMaskOn, PinAddressMaskOff;

	bool Get();

public:
	Fast(const uint8_t pin = INVALID_PIN);
	bool virtual Setup(const uint8_t pin);
};

class FastOut : public Fast
{
public:
	FastOut(const uint8_t pin = INVALID_PIN, const bool startValue = false);
	FastOut& operator = (boolean value)
	{
		Set(value);
		return *this;
	}

	bool Setup(const uint8_t pin, const bool startValue);
	void Set(const bool value);
	void Toggle();
};

class FastOutCached : public FastOut
{
private:
	bool LastValueCache = false;

public:
	FastOutCached(const uint8_t pin = INVALID_PIN, const bool startValue = false);
	FastOutCached& operator = (boolean value)
	{
		Set(value);
		return *this;
	}

	bool Setup(const uint8_t pin, const bool startValue = false);
	void Set(const bool value);
	void Toggle();
};

class FastIn : public Fast
{
public:
	FastIn(const uint8_t pin = INVALID_PIN, const bool startValue = false);

	operator bool() {
		return Get();
	}
};

class FastShifter : public FastOut
{
public:
	virtual bool Setup(const uint8_t pin, const bool startValue = false);
	void PulseLow();
	void PulseHigh();
	void PulseLow(const uint16_t pulseIntervalMicros);
	void PulseHigh(const int16_t pulseIntervalMicros);
};

#endif

{'repo_name': 'mixly/Mixly_Arduino', 'stars': '145', 'repo_language': 'C', 'file_name': 'ZT16K33.h', 'mime_type': 'text/x-c++', 'hash': -7677753224824309887, 'source_dataset': 'data'}


# -*- coding: utf-8 -*-
"""
Tests for nltk.pos_tag
"""

import unittest

from nltk import word_tokenize, pos_tag

class TestPosTag(unittest.TestCase):
    def test_pos_tag_eng(self):
        text = "John's big idea isn't all that bad."
        expected_tagged = [
            ('John', 'NNP'),
            ("'s", 'POS'),
            ('big', 'JJ'),
            ('idea', 'NN'),
            ('is', 'VBZ'),
            ("n't", 'RB'),
            ('all', 'PDT'),
            ('that', 'DT'),
            ('bad', 'JJ'),
            ('.', '.'),
        ]
        assert pos_tag(word_tokenize(text)) == expected_tagged

    def test_pos_tag_eng_universal(self):
        text = "John's big idea isn't all that bad."
        expected_tagged = [
            ('John', 'NOUN'),
            ("'s", 'PRT'),
            ('big', 'ADJ'),
            ('idea', 'NOUN'),
            ('is', 'VERB'),
            ("n't", 'ADV'),
            ('all', 'DET'),
            ('that', 'DET'),
            ('bad', 'ADJ'),
            ('.', '.'),
        ]
        assert pos_tag(word_tokenize(text), tagset='universal') == expected_tagged

    def test_pos_tag_rus(self):
        text = u"Илья оторопел и дважды перечитал бумажку."
        expected_tagged = [
            ('Илья', 'S'),
            ('оторопел', 'V'),
            ('и', 'CONJ'),
            ('дважды', 'ADV'),
            ('перечитал', 'V'),
            ('бумажку', 'S'),
            ('.', 'NONLEX'),
        ]
        assert pos_tag(word_tokenize(text), lang='rus') == expected_tagged

    def test_pos_tag_rus_universal(self):
        text = u"Илья оторопел и дважды перечитал бумажку."
        expected_tagged = [
            ('Илья', 'NOUN'),
            ('оторопел', 'VERB'),
            ('и', 'CONJ'),
            ('дважды', 'ADV'),
            ('перечитал', 'VERB'),
            ('бумажку', 'NOUN'),
            ('.', '.'),
        ]
        assert (
            pos_tag(word_tokenize(text), tagset='universal', lang='rus')
            == expected_tagged
        )

    def test_pos_tag_unknown_lang(self):
        text = u"모르겠 습니 다"
        self.assertRaises(NotImplementedError, pos_tag, word_tokenize(text), lang='kor')
        # Test for default kwarg, `lang=None`
        self.assertRaises(NotImplementedError, pos_tag, word_tokenize(text), lang=None)

    def test_unspecified_lang(self):
        # Tries to force the lang='eng' option.
        text = u"모르겠 습니 다"
        expected_but_wrong = [('모르겠', 'JJ'), ('습니', 'NNP'), ('다', 'NN')]
        assert pos_tag(word_tokenize(text)) == expected_but_wrong

{'repo_name': 'nltk/nltk', 'stars': '9066', 'repo_language': 'Python', 'file_name': 'test.cfg', 'mime_type': 'text/plain', 'hash': -7770420631676062186, 'source_dataset': 'data'}


/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

#ifndef ASSIMPHELPERS_H
#define ASSIMPHELPERS_H

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

// ASSIMP INCLUDES
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <QtCore/QIODevice>

QT_BEGIN_NAMESPACE

namespace Qt3DRender {
namespace AssimpHelper {

//CUSTOM FILE STREAM
class AssimpIOStream : public Assimp::IOStream
{
public :
    AssimpIOStream(QIODevice *device);
    ~AssimpIOStream();

    size_t Read(void *pvBuffer, size_t pSize, size_t pCount) override;
    size_t Write(const void *pvBuffer, size_t pSize, size_t pCount) override;
    aiReturn Seek(size_t pOffset, aiOrigin pOrigin) override;
    size_t Tell() const override;
    size_t FileSize() const override;
    void Flush() override;

private:
    QIODevice *const m_device;
};

//CUSTOM FILE IMPORTER TO HANDLE QT RESOURCES WITHIN ASSIMP
class AssimpIOSystem : public Assimp::IOSystem
{
public :
    bool Exists(const char *pFile) const override;
    char getOsSeparator() const override;
    Assimp::IOStream *Open(const char *pFile, const char *pMode) override;
    void Close(Assimp::IOStream *pFile) override;
};

} // namespace AssimpHelper
} // namespace Qt3DRender

QT_END_NAMESPACE

#endif // ASSIMPHELPERS_H

{'repo_name': 'qt/qt3d', 'stars': '127', 'repo_language': 'C++', 'file_name': 'FindWrapAssimp.cmake', 'mime_type': 'text/plain', 'hash': 558629920328883624, 'source_dataset': 'data'}


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

# buildconf: Build the support scripts needed to compile from a
#            checked-out version of the source code.

if [ "$1" = "--verbose" -o "$1" = "-v" ]; then
    verbose="--verbose"
    shift
fi

# Verify that the builder has the right config tools installed
#
build/buildcheck.sh $verbose || exit 1

libtoolize=`build/PrintPath glibtoolize1 glibtoolize libtoolize15 libtoolize14 libtoolize`
if [ "x$libtoolize" = "x" ]; then
    echo "libtoolize not found in path"
    exit 1
fi

# Create the libtool helper files
#
# Note: we copy (rather than link) them to simplify distribution.
# Note: APR supplies its own config.guess and config.sub -- we do not
#       rely on libtool's versions
#
echo "buildconf: copying libtool helper files using $libtoolize"

# Remove any libtool files so one can switch between libtool versions
# by simply rerunning the buildconf script.
rm -f aclocal.m4 libtool.m4
(cd build ; rm -f ltconfig ltmain.sh argz.m4 libtool.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4)

# Determine libtool version, because --copy behaves differently
# w.r.t. copying libtool.m4
lt_pversion=`$libtoolize --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
IFS=.; set $lt_version; IFS=' '

# libtool 1
if test "$1" = "1"; then
  $libtoolize --copy --automake
  # Unlikely, maybe for old versions the file exists
  if [ -f libtool.m4 ]; then
    ltfile=`pwd`/libtool.m4
  else

    # Extract all lines setting variables from libtoolize up until
    # libtool_m4 gets set
    ltfindcmd="`sed -n \"/=[^\\\`]/p;/libtool_m4=/{s/.*=/echo /p;q;}\" \
                   < $libtoolize`"

    # Get path to libtool.m4 either from LIBTOOL_M4 env var or our libtoolize based script
    ltfile=${LIBTOOL_M4-`eval "$ltfindcmd"`}

    # Expecting the code above to be very portable, but just in case...
    if [ -z "$ltfile" -o ! -f "$ltfile" ]; then
      ltpath=`dirname $libtoolize`
      ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
    fi
  fi
  if [ ! -f $ltfile ]; then
    echo "$ltfile not found"
    exit 1
  fi
  # Do we need this anymore?
  echo "buildconf: Using libtool.m4 at ${ltfile}."
  rm -f build/libtool.m4
  cp -p $ltfile build/libtool.m4

# libtool 2
elif test "$1" = "2"; then
  $libtoolize --copy --quiet $verbose
fi

# Replace top_builddir by apr_builddir.
# Wouldn't it just be better to define top_builddir??
# Not sure, would it interfere with httpd top_builddir when bundled?
mv build/libtool.m4 build/libtool.m4.$$
sed -e 's/\(LIBTOOL=.*\)top_build/\1apr_build/' < build/libtool.m4.$$ > build/libtool.m4
rm -f build/libtool.m4.$$

# Clean up any leftovers
rm -f aclocal.m4 libtool.m4

#
# Generate the autoconf header and ./configure
#
echo "buildconf: creating include/arch/unix/apr_private.h.in ..."
${AUTOHEADER:-autoheader} $verbose

echo "buildconf: creating configure ..."
### do some work to toss config.cache?
${AUTOCONF:-autoconf} $verbose

# Remove autoconf 2.5x's cache directory
rm -rf autom4te*.cache

echo "buildconf: generating 'make' outputs ..."
build/gen-build.py $verbose make

# Create RPM Spec file
if [ -f `which cut` ]; then
  echo "buildconf: rebuilding rpm spec file"
  ( REVISION=`build/get-version.sh all include/apr_version.h APR`
    VERSION=`echo $REVISION | cut -d- -s -f1`
    RELEASE=`echo $REVISION | cut -d- -s -f2`
    if [ "x$VERSION" = "x" ]; then
      VERSION=$REVISION
      RELEASE=1
    fi
    cat ./build/rpm/apr.spec.in | \
    sed -e "s/APR_VERSION/$VERSION/" \
        -e "s/APR_RELEASE/$RELEASE/" \
    > apr.spec )
fi

exit 0

{'repo_name': 'smartdevicelink/sdl_core', 'stars': '191', 'repo_language': 'C++', 'file_name': 'mainpage.dox', 'mime_type': 'text/plain', 'hash': -4609485196349012137, 'source_dataset': 'data'}


// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//

// Preprocessed version of "boost/mpl/aux_/advance_forward.hpp" header
// -- DO NOT modify by hand!

namespace boost { namespace mpl { namespace aux {

template< long N > struct advance_forward;
template<>
struct advance_forward<0>
{
    template< typename Iterator > struct apply
    {
        typedef Iterator iter0;
        typedef iter0 type;
    };
};

template<>
struct advance_forward<1>
{
    template< typename Iterator > struct apply
    {
        typedef Iterator iter0;
        typedef typename next<iter0>::type iter1;
        typedef iter1 type;
    };
};

template<>
struct advance_forward<2>
{
    template< typename Iterator > struct apply
    {
        typedef Iterator iter0;
        typedef typename next<iter0>::type iter1;
        typedef typename next<iter1>::type iter2;
        typedef iter2 type;
    };
};

template<>
struct advance_forward<3>
{
    template< typename Iterator > struct apply
    {
        typedef Iterator iter0;
        typedef typename next<iter0>::type iter1;
        typedef typename next<iter1>::type iter2;
        typedef typename next<iter2>::type iter3;
        typedef iter3 type;
    };
};

template<>
struct advance_forward<4>
{
    template< typename Iterator > struct apply
    {
        typedef Iterator iter0;
        typedef typename next<iter0>::type iter1;
        typedef typename next<iter1>::type iter2;
        typedef typename next<iter2>::type iter3;
        typedef typename next<iter3>::type iter4;
        typedef iter4 type;
    };
};

template< long N >
struct advance_forward
{
    template< typename Iterator > struct apply
    {
        typedef typename apply_wrap1<
              advance_forward<4>
            , Iterator
            >::type chunk_result_;

        typedef typename apply_wrap1<
              advance_forward<(
                (N - 4) < 0
                    ? 0
                    : N - 4
                    )>
            , chunk_result_
            >::type type;
    };
};

}}}

{'repo_name': 'notjosh/Marzipants', 'stars': '144', 'repo_language': 'Objective-C', 'file_name': 'BUCK', 'mime_type': 'text/plain', 'hash': 1470270017932170272, 'source_dataset': 'data'}


/* SimpleAutoComplete.java

{{IS_NOTE
	Purpose:

	Description:

	History:
		Jan 4, 2008 5:57:30 PM , Created by jumperchen
}}IS_NOTE

Copyright (C) 2007 Potix Corporation. All Rights Reserved.

{{IS_RIGHT
	This program is distributed under GPL Version 3.0 in the hope that
	it will be useful, but WITHOUT ANY WARRANTY.
}}IS_RIGHT
*/
package org.zkoss.zksandbox;

import java.util.Arrays;

import org.zkoss.zul.Combobox;
import org.zkoss.zul.SimpleListModel;

/**
 * This class is an example of auto-complete with combobox via SimpleListModel to achieve.
 * @author jumperchen
 *
 */
public class SimpleAutoComplete extends Combobox {
	private static String[] _dict = { //alphabetic order
		"abacus", "accuracy", "acuity", "adage", "afar", "after", "apple",
		"bible", "bird", "bingle", "blog",
		"cabane", "cape", "cease", "cedar",
		"dacron", "defacto", "definable", "deluxe",
		"each", "eager", "effect", "efficacy",
		"far", "far from",
		"girl", "gigantean", "giant",
		"home", "honest", "huge",
		"information", "inner",
		"jump", "jungle", "jungle fever",
		"kaka", "kale", "kame",
		"lamella", "lane", "lemma",
		"master", "maxima", "music",
		"nerve", "new", "number",
		"omega", "opera",
		"pea", "peace", "peaceful",
		"rock",
		"sound", "spread", "student", "super",
		"tea", "teacher",
		"unit", "universe",
		"vector", "victory",
		"wake", "wee", "weak",
		"xeme",
		"yea", "yellow",
		"zebra", "zk",
	};
	static {
		Arrays.sort(_dict);
	}
	public SimpleAutoComplete() {
		setModel(new SimpleListModel(_dict, true));
	}
}

{'repo_name': 'zkoss/zk', 'stars': '317', 'repo_language': 'Java', 'file_name': 'MANIFEST.MF', 'mime_type': 'text/plain', 'hash': 2720017620216312974, 'source_dataset': 'data'}


/*
* Conditions Of Use
*
* This software was developed by employees of the National Institute of
* Standards and Technology (NIST), an agency of the Federal Government.
* Pursuant to title 15 Untied States Code Section 105, works of NIST
* employees are not subject to copyright protection in the United States
* and are considered to be in the public domain.  As a result, a formal
* license is not needed to use the software.
*
* This software is provided by NIST as a service and is expressly
* provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
* AND DATA ACCURACY.  NIST does not warrant or make any representations
* regarding the use of the software or the results thereof, including but
* not limited to the correctness, accuracy, reliability or usefulness of
* the software.
*
* Permission to use this software is contingent upon your acceptance
* of the terms of this agreement
*
* .
*
*/
/*******************************************************************************
* Product of NIST/ITL Advanced Networking Technologies Division (ANTD).        *
*******************************************************************************/
package gov.nist.javax.sdp.fields;
import gov.nist.core.*;
import java.util.LinkedList;
import java.util.ListIterator;
import javax.sdp.*;
/**
* Repeat SDP Field (part of the time field).
*
*@version  JSR141-PUBLIC-REVIEW (subject to change).
*
*@author Olivier Deruelle <deruelle@antd.nist.gov>
*@author M. Ranganathan   <br/>
*
*
*
*/
public class RepeatField extends SDPField implements javax.sdp.RepeatTime {

    private static final long serialVersionUID = -6415338212212641819L;
    protected TypedTime repeatInterval;
    protected TypedTime activeDuration;
    protected SDPObjectList offsets;

    public RepeatField() {
        super(REPEAT_FIELD);
        offsets = new SDPObjectList();
    }

    public void setRepeatInterval(TypedTime interval) {
        repeatInterval = interval;
    }

    public void setActiveDuration(TypedTime duration) {
        activeDuration = duration;
    }

    public void addOffset(TypedTime offset) {
        offsets.add(offset);
    }

    public LinkedList getOffsets() {
        return offsets;
    }

    /** Returns the "repeat interval" in seconds.
    * @throws SdpParseException
    * @return the "repeat interval" in seconds.
    */
    public int getRepeatInterval() throws SdpParseException {
        if (repeatInterval == null)
            return -1;
        else {
            return repeatInterval.getTime();
        }
    }

    /** Set the "repeat interval" in seconds.
     * @param repeatInterval the "repeat interval" in seconds.
     * @throws SdpException if repeatInterval is <0
     */
    public void setRepeatInterval(int repeatInterval) throws SdpException {
        if (repeatInterval < 0)
            throw new SdpException("The repeat interval is <0");
        else {
            if (this.repeatInterval == null)
                this.repeatInterval = new TypedTime();
            this.repeatInterval.setTime(repeatInterval);
        }
    }

    /** Returns the "active duration" in seconds.
     * @throws SdpParseException
     * @return the "active duration" in seconds.
     */
    public int getActiveDuration() throws SdpParseException {
        if (activeDuration == null)
            return -1;
        else {
            return activeDuration.getTime();
        }
    }

    /** Sets the "active duration" in seconds.
     * @param activeDuration the "active duration" in seconds.
     * @throws SdpException if the active duration is <0
     */
    public void setActiveDuration(int activeDuration) throws SdpException {
        if (activeDuration < 0)
            throw new SdpException("The active Duration is <0");
        else {
            if (this.activeDuration == null)
                this.activeDuration = new TypedTime();
            this.activeDuration.setTime(activeDuration);
        }
    }

    /** Returns the list of offsets. These are relative to the start-time given
     * in the Time object (t=
     *     field) with which this RepeatTime is associated.
     * @throws SdpParseException
     * @return the list of offsets
     */
    public int[] getOffsetArray() throws SdpParseException {
        LinkedList linkedList = getOffsets();
        int[] result = new int[linkedList.size()];
        for (int i = 0; i < linkedList.size(); i++) {
            TypedTime typedTime = (TypedTime) linkedList.get(i);
            result[i] = typedTime.getTime();
        }
        return result;
    }

    /** Set the list of offsets. These are relative to the start-time given in the
     * Time object (t=
     *     field) with which this RepeatTime is associated.
     * @param offsets array of repeat time offsets
     * @throws SdpException
     */
    public void setOffsetArray(int[] offsets) throws SdpException {
        for (int i = 0; i < offsets.length; i++) {
            TypedTime typedTime = new TypedTime();
            typedTime.setTime(offsets[i]);
            addOffset(typedTime);
        }

    }

    /** Returns whether the field will be output as a typed time or a integer value.
     *
     *     Typed time is formatted as an integer followed by a unit character. The unit indicates an
     *     appropriate multiplier for the integer.
     *
     *     The following unit types are allowed.
     *          d - days (86400 seconds)
     *          h - hours (3600 seconds)
     *          m - minutes (60 seconds)
     *          s - seconds ( 1 seconds)
     * @throws SdpParseException
     * @return true, if the field will be output as a typed time; false, if as an integer value.
     */
    public boolean getTypedTime() throws SdpParseException {
        return true;
    }

    /** Sets whether the field will be output as a typed time or a integer value.
     *
     *     Typed time is formatted as an integer followed by a unit character. The unit indicates an
     *     appropriate multiplier for the integer.
     *
     *     The following unit types are allowed.
     *          d - days (86400 seconds)
     *          h - hours (3600 seconds)
     *          m - minutes (60 seconds)
     *          s - seconds ( 1 seconds)
     * @param typedTime typedTime - if set true, the start and stop times will be output in an optimal typed
     *          time format; if false, the times will be output as integers.
     */
    public void setTypedTime(boolean typedTime) {

    }

    public String encode() {
        StringBuilder retval = new StringBuilder();
    retval.append(REPEAT_FIELD)
      .append(repeatInterval.encode())
            .append(Separators.SP)
          .append(activeDuration.encode());
        ListIterator li = offsets.listIterator();
        while (li.hasNext()) {
            TypedTime off = (TypedTime) li.next();
            retval.append (Separators.SP).append (off.encode());
        }
        retval.append (Separators.NEWLINE);
        return retval.toString ();
    }

    public Object clone() {
        RepeatField retval = (RepeatField) super.clone();
        if (this.repeatInterval != null)
            retval.repeatInterval = (TypedTime) this.repeatInterval.clone();
        if (this.activeDuration != null)
            retval.activeDuration = (TypedTime) this.activeDuration.clone();
        if (this.offsets != null)
            retval.offsets = (SDPObjectList) this.offsets.clone();
        return retval;
    }

}

{'repo_name': 'usnistgov/jsip', 'stars': '161', 'repo_language': 'Java', 'file_name': 'jain-sip-ri-1.2.pom', 'mime_type': 'text/plain', 'hash': -8249573552876857195, 'source_dataset': 'data'}


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

package org.waveprotocol.wave.client.wave;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;

import org.waveprotocol.wave.client.scheduler.Scheduler.IncrementalTask;
import org.waveprotocol.wave.client.scheduler.SchedulerInstance;
import org.waveprotocol.wave.client.scheduler.TimerService;
import org.waveprotocol.wave.model.conversation.ConversationBlip;
import org.waveprotocol.wave.model.supplement.ObservableSupplementedWave;
import org.waveprotocol.wave.model.supplement.SupplementedWaveWrapper;
import org.waveprotocol.wave.model.util.CollectionUtils;
import org.waveprotocol.wave.model.util.IdentityMap;
import org.waveprotocol.wave.model.util.IdentityMap.ProcV;
import org.waveprotocol.wave.model.util.IdentitySet;
import org.waveprotocol.wave.model.util.ReadableIdentitySet.Proc;
import org.waveprotocol.wave.model.wave.Blip;
import org.waveprotocol.wave.model.wave.ObservableWavelet;
import org.waveprotocol.wave.model.wave.WaveViewListener;
import org.waveprotocol.wave.model.wave.WaveletListener;
import org.waveprotocol.wave.model.wave.opbased.ObservableWaveView;
import org.waveprotocol.wave.model.wave.opbased.WaveletListenerImpl;

/**
 * Optimistic implementation of a wave supplement.
 *

 * Because read state is based on versions, and versions increment
 * asynchronously after local operations have been applied, performing actions
 * on the regular supplement model synchronously with reading actions does not
 * bring the supplement into the correct state, since the modification versions
 * of waves and blips will not have been updated. This class addresses that
 * synchronization issue.
 *

 * This class decorates a regular supplement, and keeps track of two kinds of
 * blips: a blip that is currently being read, and blips that have been marked
 * as read. This class overrides the read state queries of the regular
 * supplement in order that a blip that is being read is always revealed to be
 * read by the supplement API. Blips that have been marked as read are
 * continuously marked as read in the background if they are modified, until a
 * remote change occurs on them. This is to ensure local operations, whose
 * version increments only occur asynchronously after server acknowledgements,
 * appear to be read. Note that server acknowledgements of local operations are
 * observed as version increments, while incoming remote operations are observed
 * as version increments accompanied by a
 * {@link WaveletListener#onRemoteBlipContentModified} event. The observation of
 * that event on a blip removes it from the set being automatically read.
 *

 * Since it is not possible to detect, with the wavelet API, when all local
 * operations have been acknowledged, the automatically-read blip collection can
 * grow quite large. In order not to leak memory from continuous growth, a blip
 * in that is evicted after a generous amount of time, within which it is
 * assumed that the server acknowledgements for local operations on that blip
 * will have arrived.
 *
 * @author hearnden@google.com (David Hearnden)
 */
public final class LocalSupplementedWaveImpl extends SupplementedWaveWrapper<
    ObservableSupplementedWave>
    implements WaveViewListener, LocalSupplementedWave, IncrementalTask {

  /** How often to mark auto-read blips as read. */
  @VisibleForTesting
  static final int REPEAT_MS = 10 * 1000;

  /**
   * Background auto-read is stopped for blips that have not changed for longer
   * than this.
   */
  @VisibleForTesting
  static final int EVICT_TIME_MS = 60 * 1000;

  private final TimerService timer;
  private final ObservableWaveView wave;

  /**
   * Blips in this collection are periodically (in intervals of
   * {@link #REPEAT_MS}) marked as read. Each blip maps to the last time it was
   * marked as read. Blips are evicted either when they are unchanged for a long
   * time, or a remote operation occurs on them.
   */
  private final IdentityMap<ConversationBlip, Double> autoRead =
      CollectionUtils.createIdentityMap();

  /**
   * The same blips as in {@link #autoRead}, but with their raw versions, for
   * cross-referencing with {@link WaveletListener#onRemoteBlipContentModified}
   * events.
   */
  private final IdentityMap<Blip, ConversationBlip> rawAutoRead =
      CollectionUtils.createIdentityMap();

  /** Listener that detects remote changes on blips. */
  private final WaveletListener remoteChangeDetector = new WaveletListenerImpl() {
    @Deprecated
    @Override
    public void onRemoteBlipContentModified(ObservableWavelet wavelet, Blip blip) {
      onRemoteChange(blip);
    }
  };

  /** The blip that is actively being read, if there is one. */
  private ConversationBlip reading;

  LocalSupplementedWaveImpl(
      TimerService timer, ObservableWaveView wave, ObservableSupplementedWave delegate) {
    super(delegate);
    this.timer = timer;
    this.wave = wave;
  }

  public static LocalSupplementedWaveImpl create(
      ObservableWaveView wave, ObservableSupplementedWave delegate) {
    TimerService timer = SchedulerInstance.getLowPriorityTimer();
    LocalSupplementedWaveImpl supplement = new LocalSupplementedWaveImpl(timer, wave, delegate);
    supplement.init();
    return supplement;
  }

  @VisibleForTesting
  void init() {
    wave.addListener(this);
    for (ObservableWavelet wavelet : wave.getWavelets()) {
      wavelet.addListener(remoteChangeDetector);
    }
    timer.scheduleRepeating(this, REPEAT_MS, REPEAT_MS);
  }

  public void destroy() {
    timer.cancel(this);
    for (ObservableWavelet wavelet : wave.getWavelets()) {
      wavelet.removeListener(remoteChangeDetector);
    }
    wave.removeListener(this);
  }

  @Override
  public void startReading(ConversationBlip blip) {
    Preconditions.checkState(reading == null);
    reading = blip;
    startAutoReading(reading);
  }

  @Override
  public void stopReading(ConversationBlip blip) {
    Preconditions.checkState(reading != null);
    Preconditions.checkArgument(reading == blip);
    // Continue marking this blip as read while the acks come in. Delay eviction
    // by refreshing its timestamp.
    assert autoRead.has(reading);
    delegate.markAsRead(reading);
    autoRead.put(reading, timer.currentTimeMillis());
    reading = null;
  }

  /**
   * Puts a blip into the auto-read collection.
   */
  private void startAutoReading(ConversationBlip blip) {
    // Mark it as read first, before putting in the auto-read override, in order
    // to generate the correct read events.
    delegate.markAsRead(blip);
    autoRead.put(blip, timer.currentTimeMillis());
    rawAutoRead.put(blip.hackGetRaw(), blip);
  }

  /**
   * Removes a blip from the auto-read collection.
   */
  private void stopAutoReading(ConversationBlip blip) {
    assert blip != reading : "not allowed to remove the reading blip";
    autoRead.remove(blip);
    rawAutoRead.remove(blip.hackGetRaw());
  }

  @Override
  public boolean isUnread(ConversationBlip blip) {
    // All blips in autoRead are treated as read.
    return !autoRead.has(blip) && delegate.isUnread(blip);
  }

  @Override
  public void markAsRead(ConversationBlip blip) {
    startAutoReading(blip);
  }

  @Override
  public void markAsUnread() {
    autoRead.clear();
    rawAutoRead.clear();
    delegate.markAsUnread();
    if (reading != null) {
      startAutoReading(reading);
    }
  }

  @Override
  public boolean execute() {
    // Mark as read all blips in the auto-read list.
    // Evict any blips that have not been touched for more than some threshold,
    // but never evict the currently-reading blip.
    final IdentitySet<ConversationBlip> toEvict = CollectionUtils.createIdentitySet();
    if (reading != null) {
      delegate.markAsRead(reading);
    }
    autoRead.each(new ProcV<ConversationBlip, Double>() {
      final double now = timer.currentTimeMillis();

      @Override
      public void apply(ConversationBlip blip, Double touched) {
        delegate.markAsRead(blip);
        if (blip != reading && (now - touched >= EVICT_TIME_MS)) {
          toEvict.add(blip);
        }
      }
    });
    toEvict.each(new Proc<ConversationBlip>() {
      @Override
      public void apply(ConversationBlip blip) {
        stopAutoReading(blip);
      }
    });
    return true; // Run forever
  }

  //
  // Wave events.
  //

  @Override
  public void onWaveletAdded(ObservableWavelet wavelet) {
    wavelet.addListener(remoteChangeDetector);
  }

  @Override
  public void onWaveletRemoved(ObservableWavelet wavelet) {
    wavelet.removeListener(remoteChangeDetector);
  }

  private void onRemoteChange(Blip raw) {
    // Some op caused by someone else occurred. Stop auto-reading.
    ConversationBlip blip = rawAutoRead.get(raw);
    if (blip != null && blip != reading) {
      stopAutoReading(blip);
    }
  }

  //
  // Events.
  //

  @Override
  public void addListener(Listener listener) {
    delegate.addListener(listener);
  }

  @Override
  public void removeListener(Listener listener) {
    delegate.removeListener(listener);
  }
}

{'repo_name': 'SwellRT/swellrt', 'stars': '194', 'repo_language': 'Java', 'file_name': 'example.proto', 'mime_type': 'text/plain', 'hash': 579219194747388324, 'source_dataset': 'data'}


somesub

headed text

second text

unknown title

unknown body

{'repo_name': 'Camelcade/Perl5-IDEA', 'stars': '324', 'repo_language': 'Java', 'file_name': 'hurricup.xml', 'mime_type': 'text/plain', 'hash': 8169133886100540098, 'source_dataset': 'data'}


// Copyright (c) 2014 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.

#pragma once

#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "rocksdb/compaction_job_stats.h"
#include "rocksdb/status.h"
#include "rocksdb/table_properties.h"

namespace rocksdb {

typedef std::unordered_map<std::string, std::shared_ptr<const TableProperties>>
    TablePropertiesCollection;

class DB;
class ColumnFamilyHandle;
class Status;
struct CompactionJobStats;
enum CompressionType : unsigned char;

enum class TableFileCreationReason {
  kFlush,
  kCompaction,
  kRecovery,
};

struct TableFileCreationBriefInfo {
  // the name of the database where the file was created
  std::string db_name;
  // the name of the column family where the file was created.
  std::string cf_name;
  // the path to the created file.
  std::string file_path;
  // the id of the job (which could be flush or compaction) that
  // created the file.
  int job_id;
  // reason of creating the table.
  TableFileCreationReason reason;
};

struct TableFileCreationInfo : public TableFileCreationBriefInfo {
  TableFileCreationInfo() = default;
  explicit TableFileCreationInfo(TableProperties&& prop)
      : table_properties(prop) {}
  // the size of the file.
  uint64_t file_size;
  // Detailed properties of the created file.
  TableProperties table_properties;
  // The status indicating whether the creation was successful or not.
  Status status;
};

enum class CompactionReason {
  kUnknown,
  // [Level] number of L0 files > level0_file_num_compaction_trigger
  kLevelL0FilesNum,
  // [Level] total size of level > MaxBytesForLevel()
  kLevelMaxLevelSize,
  // [Universal] Compacting for size amplification
  kUniversalSizeAmplification,
  // [Universal] Compacting for size ratio
  kUniversalSizeRatio,
  // [Universal] number of sorted runs > level0_file_num_compaction_trigger
  kUniversalSortedRunNum,
  // [FIFO] total size > max_table_files_size
  kFIFOMaxSize,
  // [FIFO] reduce number of files.
  kFIFOReduceNumFiles,
  // [FIFO] files with creation time < (current_time - interval)
  kFIFOTtl,
  // Manual compaction
  kManualCompaction,
  // DB::SuggestCompactRange() marked files for compaction
  kFilesMarkedForCompaction,
  // [Level] Automatic compaction within bottommost level to cleanup duplicate
  // versions of same user key, usually due to a released snapshot.
  kBottommostFiles,
};

enum class BackgroundErrorReason {
  kFlush,
  kCompaction,
  kWriteCallback,
  kMemTable,
};

enum class WriteStallCondition {
  kNormal,
  kDelayed,
  kStopped,
};

struct WriteStallInfo {
  // the name of the column family
  std::string cf_name;
  // state of the write controller
  struct {
    WriteStallCondition cur;
    WriteStallCondition prev;
  } condition;
};

#ifndef ROCKSDB_LITE

struct TableFileDeletionInfo {
  // The name of the database where the file was deleted.
  std::string db_name;
  // The path to the deleted file.
  std::string file_path;
  // The id of the job which deleted the file.
  int job_id;
  // The status indicating whether the deletion was successful or not.
  Status status;
};

struct FlushJobInfo {
  // the name of the column family
  std::string cf_name;
  // the path to the newly created file
  std::string file_path;
  // the id of the thread that completed this flush job.
  uint64_t thread_id;
  // the job id, which is unique in the same thread.
  int job_id;
  // If true, then rocksdb is currently slowing-down all writes to prevent
  // creating too many Level 0 files as compaction seems not able to
  // catch up the write request speed.  This indicates that there are
  // too many files in Level 0.
  bool triggered_writes_slowdown;
  // If true, then rocksdb is currently blocking any writes to prevent
  // creating more L0 files.  This indicates that there are too many
  // files in level 0.  Compactions should try to compact L0 files down
  // to lower levels as soon as possible.
  bool triggered_writes_stop;
  // The smallest sequence number in the newly created file
  SequenceNumber smallest_seqno;
  // The largest sequence number in the newly created file
  SequenceNumber largest_seqno;
  // Table properties of the table being flushed
  TableProperties table_properties;
};

struct CompactionJobInfo {
  CompactionJobInfo() = default;
  explicit CompactionJobInfo(const CompactionJobStats& _stats) :
      stats(_stats) {}

  // the name of the column family where the compaction happened.
  std::string cf_name;
  // the status indicating whether the compaction was successful or not.
  Status status;
  // the id of the thread that completed this compaction job.
  uint64_t thread_id;
  // the job id, which is unique in the same thread.
  int job_id;
  // the smallest input level of the compaction.
  int base_input_level;
  // the output level of the compaction.
  int output_level;
  // the names of the compaction input files.
  std::vector<std::string> input_files;

  // the names of the compaction output files.
  std::vector<std::string> output_files;
  // Table properties for input and output tables.
  // The map is keyed by values from input_files and output_files.
  TablePropertiesCollection table_properties;

  // Reason to run the compaction
  CompactionReason compaction_reason;

  // Compression algorithm used for output files
  CompressionType compression;

  // If non-null, this variable stores detailed information
  // about this compaction.
  CompactionJobStats stats;
};

struct MemTableInfo {
  // the name of the column family to which memtable belongs
  std::string cf_name;
  // Sequence number of the first element that was inserted
  // into the memtable.
  SequenceNumber first_seqno;
  // Sequence number that is guaranteed to be smaller than or equal
  // to the sequence number of any key that could be inserted into this
  // memtable. It can then be assumed that any write with a larger(or equal)
  // sequence number will be present in this memtable or a later memtable.
  SequenceNumber earliest_seqno;
  // Total number of entries in memtable
  uint64_t num_entries;
  // Total number of deletes in memtable
  uint64_t num_deletes;

};

struct ExternalFileIngestionInfo {
  // the name of the column family
  std::string cf_name;
  // Path of the file outside the DB
  std::string external_file_path;
  // Path of the file inside the DB
  std::string internal_file_path;
  // The global sequence number assigned to keys in this file
  SequenceNumber global_seqno;
  // Table properties of the table being flushed
  TableProperties table_properties;
};

// A call-back function to RocksDB which will be called when the compaction
// iterator is compacting values. It is mean to be returned from
// EventListner::GetCompactionEventListner() at the beginning of compaction
// job.
class CompactionEventListener {
 public:
  enum CompactionListenerValueType {
    kValue,
    kMergeOperand,
    kDelete,
    kSingleDelete,
    kRangeDelete,
    kBlobIndex,
    kInvalid,
  };

  virtual void OnCompaction(int level, const Slice& key,
                            CompactionListenerValueType value_type,
                            const Slice& existing_value,
                            const SequenceNumber& sn, bool is_new) = 0;

  virtual ~CompactionEventListener() = default;
};

// EventListener class contains a set of call-back functions that will
// be called when specific RocksDB event happens such as flush.  It can
// be used as a building block for developing custom features such as
// stats-collector or external compaction algorithm.
//
// Note that call-back functions should not run for an extended period of
// time before the function returns, otherwise RocksDB may be blocked.
// For example, it is not suggested to do DB::CompactFiles() (as it may
// run for a long while) or issue many of DB::Put() (as Put may be blocked
// in certain cases) in the same thread in the EventListener callback.
// However, doing DB::CompactFiles() and DB::Put() in another thread is
// considered safe.
//
// [Threading] All EventListener callback will be called using the
// actual thread that involves in that specific event.   For example, it
// is the RocksDB background flush thread that does the actual flush to
// call EventListener::OnFlushCompleted().
//
// [Locking] All EventListener callbacks are designed to be called without
// the current thread holding any DB mutex. This is to prevent potential
// deadlock and performance issue when using EventListener callback
// in a complex way. However, all EventListener call-back functions
// should not run for an extended period of time before the function
// returns, otherwise RocksDB may be blocked. For example, it is not
// suggested to do DB::CompactFiles() (as it may run for a long while)
// or issue many of DB::Put() (as Put may be blocked in certain cases)
// in the same thread in the EventListener callback. However, doing
// DB::CompactFiles() and DB::Put() in a thread other than the
// EventListener callback thread is considered safe.
class EventListener {
 public:
  // A call-back function to RocksDB which will be called whenever a
  // registered RocksDB flushes a file.  The default implementation is
  // no-op.
  //
  // Note that the this function must be implemented in a way such that
  // it should not run for an extended period of time before the function
  // returns.  Otherwise, RocksDB may be blocked.
  virtual void OnFlushCompleted(DB* /*db*/,
                                const FlushJobInfo& /*flush_job_info*/) {}

  // A call-back function to RocksDB which will be called before a
  // RocksDB starts to flush memtables.  The default implementation is
  // no-op.
  //
  // Note that the this function must be implemented in a way such that
  // it should not run for an extended period of time before the function
  // returns.  Otherwise, RocksDB may be blocked.
  virtual void OnFlushBegin(DB* /*db*/,
                            const FlushJobInfo& /*flush_job_info*/) {}

  // A call-back function for RocksDB which will be called whenever
  // a SST file is deleted.  Different from OnCompactionCompleted and
  // OnFlushCompleted, this call-back is designed for external logging
  // service and thus only provide string parameters instead
  // of a pointer to DB.  Applications that build logic basic based
  // on file creations and deletions is suggested to implement
  // OnFlushCompleted and OnCompactionCompleted.
  //
  // Note that if applications would like to use the passed reference
  // outside this function call, they should make copies from the
  // returned value.
  virtual void OnTableFileDeleted(const TableFileDeletionInfo& /*info*/) {}

  // A call-back function for RocksDB which will be called whenever
  // a registered RocksDB compacts a file. The default implementation
  // is a no-op.
  //
  // Note that this function must be implemented in a way such that
  // it should not run for an extended period of time before the function
  // returns. Otherwise, RocksDB may be blocked.
  //
  // @param db a pointer to the rocksdb instance which just compacted
  //   a file.
  // @param ci a reference to a CompactionJobInfo struct. 'ci' is released
  //  after this function is returned, and must be copied if it is needed
  //  outside of this function.
  virtual void OnCompactionCompleted(DB* /*db*/,
                                     const CompactionJobInfo& /*ci*/) {}

  // A call-back function for RocksDB which will be called whenever
  // a SST file is created.  Different from OnCompactionCompleted and
  // OnFlushCompleted, this call-back is designed for external logging
  // service and thus only provide string parameters instead
  // of a pointer to DB.  Applications that build logic basic based
  // on file creations and deletions is suggested to implement
  // OnFlushCompleted and OnCompactionCompleted.
  //
  // Historically it will only be called if the file is successfully created.
  // Now it will also be called on failure case. User can check info.status
  // to see if it succeeded or not.
  //
  // Note that if applications would like to use the passed reference
  // outside this function call, they should make copies from these
  // returned value.
  virtual void OnTableFileCreated(const TableFileCreationInfo& /*info*/) {}

  // A call-back function for RocksDB which will be called before
  // a SST file is being created. It will follow by OnTableFileCreated after
  // the creation finishes.
  //
  // Note that if applications would like to use the passed reference
  // outside this function call, they should make copies from these
  // returned value.
  virtual void OnTableFileCreationStarted(
      const TableFileCreationBriefInfo& /*info*/) {}

  // A call-back function for RocksDB which will be called before
  // a memtable is made immutable.
  //
  // Note that the this function must be implemented in a way such that
  // it should not run for an extended period of time before the function
  // returns.  Otherwise, RocksDB may be blocked.
  //
  // Note that if applications would like to use the passed reference
  // outside this function call, they should make copies from these
  // returned value.
  virtual void OnMemTableSealed(
    const MemTableInfo& /*info*/) {}

  // A call-back function for RocksDB which will be called before
  // a column family handle is deleted.
  //
  // Note that the this function must be implemented in a way such that
  // it should not run for an extended period of time before the function
  // returns.  Otherwise, RocksDB may be blocked.
  // @param handle is a pointer to the column family handle to be deleted
  // which will become a dangling pointer after the deletion.
  virtual void OnColumnFamilyHandleDeletionStarted(ColumnFamilyHandle* handle) {
  }

  // A call-back function for RocksDB which will be called after an external
  // file is ingested using IngestExternalFile.
  //
  // Note that the this function will run on the same thread as
  // IngestExternalFile(), if this function is blocked, IngestExternalFile()
  // will be blocked from finishing.
  virtual void OnExternalFileIngested(
      DB* /*db*/, const ExternalFileIngestionInfo& /*info*/) {}

  // A call-back function for RocksDB which will be called before setting the
  // background error status to a non-OK value. The new background error status
  // is provided in `bg_error` and can be modified by the callback. E.g., a
  // callback can suppress errors by resetting it to Status::OK(), thus
  // preventing the database from entering read-only mode. We do not provide any
  // guarantee when failed flushes/compactions will be rescheduled if the user
  // suppresses an error.
  //
  // Note that this function can run on the same threads as flush, compaction,
  // and user writes. So, it is extremely important not to perform heavy
  // computations or blocking calls in this function.
  virtual void OnBackgroundError(BackgroundErrorReason /* reason */,
                                 Status* /* bg_error */) {}

  // A call-back function for RocksDB which will be called whenever a change
  // of superversion triggers a change of the stall conditions.
  //
  // Note that the this function must be implemented in a way such that
  // it should not run for an extended period of time before the function
  // returns.  Otherwise, RocksDB may be blocked.
  virtual void OnStallConditionsChanged(const WriteStallInfo& /*info*/) {}

  // Factory method to return CompactionEventListener. If multiple listeners
  // provides CompactionEventListner, only the first one will be used.
  virtual CompactionEventListener* GetCompactionEventListener() {
    return nullptr;
  }

  virtual ~EventListener() {}
};

#else

class EventListener {
};

#endif  // ROCKSDB_LITE

}  // namespace rocksdb

{'repo_name': 'chubaofs/chubaofs', 'stars': '1840', 'repo_language': 'Go', 'file_name': 'data_partition.go', 'mime_type': 'text/plain', 'hash': -4748233909818525114, 'source_dataset': 'data'}


from model_io import *
import sys
from loss_function import *
import math
import time

def train_model(model, outputChannels, learningRate, trainFeeder, valFeeder,
                modelSavePath=None, savePrefix=None, initialIteration=1, batchSize=1):
    with tf.Session() as sess:
        tfBatchImages = tf.placeholder("float")
        tfBatchGT = tf.placeholder("float")
        tfBatchWeight = tf.placeholder("float")
        tfBatchSS = tf.placeholder("float")
        tfBatchSSMask = tf.placeholder("float")
        keepProb = tf.placeholder("float")

        with tf.name_scope("model_builder"):
            print "attempting to build model"
            model.build(tfBatchImages, tfBatchSS, tfBatchSSMask, keepProb=keepProb)
            print "built the model"
        sys.stdout.flush()

        loss = modelTotalLoss(pred=model.outputData, gt=tfBatchGT, weight=tfBatchWeight, ss=tfBatchSS, outputChannels=outputChannels)
        numPredictedWeighted = countTotalWeighted(ss=tfBatchSS, weight=tfBatchWeight)
        numPredicted = countTotal(ss=tfBatchSS)
        numCorrect = countCorrect(pred=model.outputData, gt=tfBatchGT, ss=tfBatchSS, k=1, outputChannels=outputChannels)

        print "setting adam optimizer"
        sys.stdout.flush()

        train_op = tf.train.AdamOptimizer(learning_rate=learningRate).minimize(loss=loss)

        init = tf.initialize_all_variables()
        print "attempting to run init"
        sys.stdout.flush()

        sess.run(init)
        print "completed init"
        sys.stdout.flush()

        iteration = initialIteration

        while iteration < 1000:
            batchLosses = []
            totalPredictedWeighted = 0
            totalPredicted = 0
            totalCorrect = 0

            for k in range(int(math.floor(valFeeder.total_samples() / batchSize))):
                imageBatch, gtBatch, weightBatch, ssBatch, ssMaskBatch, _ = valFeeder.next_batch()

                batchLoss, batchPredicted, batchPredictedWeighted, batchCorrect = sess.run(
                    [loss, numPredicted, numPredictedWeighted, numCorrect],
                    feed_dict={tfBatchImages: imageBatch,
                               tfBatchGT: gtBatch,
                               tfBatchWeight: weightBatch,
                               tfBatchSS: ssBatch,
                               tfBatchSSMask: ssMaskBatch,
                               keepProb: 1.0})

                batchLosses.append(batchLoss)
                totalPredicted += batchPredicted
                totalPredictedWeighted += batchPredictedWeighted
                totalCorrect += batchCorrect

            if np.isnan(np.mean(batchLosses)):
                print "LOSS RETURNED NaN"
                sys.stdout.flush()
                return 1

            print "%s Itr: %d - val loss: %.6f, correct: %.6f" % (time.strftime("%H:%M:%S"),
            iteration, float(np.mean(batchLosses)), totalCorrect / totalPredicted)
            sys.stdout.flush()

            if (iteration > 0 and iteration % 5 == 0) or checkSaveFlag(modelSavePath):
                modelSaver(sess, modelSavePath, savePrefix, iteration)

            #for j in range(10):
            for j in range(int(math.floor(trainFeeder.total_samples() / batchSize))):
                # print "attempting to run train batch"
                # sys.stdout.flush()

                imageBatch, gtBatch, weightBatch, ssBatch, ssMaskBatch, _ = trainFeeder.next_batch()
                sess.run(train_op, feed_dict={tfBatchImages: imageBatch,
                                              tfBatchGT: gtBatch,
                                              tfBatchWeight: weightBatch,
                                              tfBatchSS: ssBatch,
                                              tfBatchSSMask: ssMaskBatch,
                                              keepProb: 0.7})
                # print "ran one iteration"

            iteration += 1

{'repo_name': 'min2209/dwt', 'stars': '165', 'repo_language': 'Python', 'file_name': 'lossFunction.py', 'mime_type': 'text/x-python', 'hash': -1953359648198201561, 'source_dataset': 'data'}


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

        <title>CSS Test: Border Conflict Resolution (by border width): 'hidden' vs. 'dotted' - a border style of 'hidden' is always the dominant border</title>
        <link rel="author" title="W3C" href="http://www.w3c.org/" />
        <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
        <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#border-conflict-resolution" />
        <meta name="flags" content="" />
        <meta name="assert" content="The 'hidden' border style takes precedence over all style and width definitions." />

Test passes if there is no red visible on the page.

                hidden
                hidden
                hidden

                hidden
                dotted
                hidden

                hidden
                hidden
                hidden

{'repo_name': 'web-platform-tests/wpt', 'stars': '2923', 'repo_language': 'HTML', 'file_name': 'newtarget.html', 'mime_type': 'text/html', 'hash': -8770179533291288602, 'source_dataset': 'data'}


<?xml version="1.0"?>

<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">

   <!-- ResourceConfigurationUpdate History -->
   <navigation-rule>
      <from-view-id>/rhq/subsystem/configurationUpdate.xhtml</from-view-id>

      <navigation-case>
         <from-outcome>success</from-outcome>
         <to-view-id>/rhq/subsystem/configurationUpdate.xhtml</to-view-id>
         <redirect/>
      </navigation-case>

      <navigation-case>
         <from-outcome>sort</from-outcome>
         <to-view-id>/rhq/subsystem/configurationUpdate.xhtml</to-view-id>
         <redirect/>
      </navigation-case>
   </navigation-rule>

   <!-- Suspect Metrics History -->
   <navigation-rule>
      <from-view-id>/rhq/subsystem/oobHistory.xhtml</from-view-id>

      <navigation-case>
         <from-outcome>success</from-outcome>
         <to-view-id>/rhq/subsystem/oobHistory.xhtml</to-view-id>
         <redirect/>
      </navigation-case>

      <navigation-case>
         <from-outcome>sort</from-outcome>
         <to-view-id>/rhq/subsystem/oobHistory.xhtml</to-view-id>
         <redirect/>
      </navigation-case>
   </navigation-rule>

   <!-- Operations History -->
   <navigation-rule>
      <from-view-id>/rhq/subsystem/operationHistory.xhtml</from-view-id>

      <navigation-case>
         <from-outcome>success</from-outcome>
         <to-view-id>/rhq/subsystem/operationHistory.xhtml</to-view-id>
         <redirect/>
      </navigation-case>

      <navigation-case>
         <from-outcome>sort</from-outcome>
         <to-view-id>/rhq/subsystem/operationHistory.xhtml</to-view-id>
         <redirect/>
      </navigation-case>
   </navigation-rule>

   <!-- Alert History -->
   <navigation-rule>
      <from-view-id>/rhq/subsystem/alertHistory.xhtml</from-view-id>

      <navigation-case>
         <from-outcome>success</from-outcome>
         <to-view-id>/rhq/subsystem/alertHistory.xhtml</to-view-id>
         <redirect/>
      </navigation-case>

      <navigation-case>
         <from-outcome>sort</from-outcome>
         <to-view-id>/rhq/subsystem/alertHistory.xhtml</to-view-id>
         <redirect/>
      </navigation-case>
   </navigation-rule>

   <!-- Alert Definition History -->
   <navigation-rule>
      <from-view-id>/rhq/subsystem/alertDefinitions.xhtml</from-view-id>

      <navigation-case>
         <from-outcome>success</from-outcome>
         <to-view-id>/rhq/subsystem/alertDefinitions.xhtml</to-view-id>
         <redirect/>
      </navigation-case>

      <navigation-case>
         <from-outcome>sort</from-outcome>
         <to-view-id>/rhq/subsystem/alertDefinitions.xhtml</to-view-id>
         <redirect/>
      </navigation-case>
   </navigation-rule>

</faces-config>

{'repo_name': 'rhq-project/rhq', 'stars': '150', 'repo_language': 'Java', 'file_name': 'unitils.properties', 'mime_type': 'text/plain', 'hash': 5666669382141701868, 'source_dataset': 'data'}


// swift-tools-version:4.2
import PackageDescription

let package = Package(
  name: "PathKit",
  products: [
    .library(name: "PathKit", targets: ["PathKit"]),
  ],
  dependencies: [
    .package(url:"https://github.com/kylef/Spectre.git", .upToNextMinor(from:"0.9.0"))
  ],
  targets: [
    .target(name: "PathKit", dependencies: [], path: "Sources"),
    .testTarget(name: "PathKitTests", dependencies: ["PathKit", "Spectre"], path:"Tests/PathKitTests")
  ]
)

{'repo_name': 'kylef/PathKit', 'stars': '1197', 'repo_language': 'Swift', 'file_name': 'hello', 'mime_type': 'text/plain', 'hash': -6193589010908730889, 'source_dataset': 'data'}


<AnalogEfexPro2_preset>
	<filter name="TauronGlobalAdjustments">
		<parameter name="strengthFactor" value="16" valueType="float"/>
		<parameter name="brightness" value="4" valueType="float"/>
		<parameter name="contrast" value="32" valueType="float"/>
		<parameter name="saturation" value="80" valueType="float"/>
		<parameter name="DisableFilter" value="0" valueType="float"/>
	</filter>
	<filter name="TauronLensDistortion">
		<parameter name="defocus_radius" value="25" valueType="float"/>
		<parameter name="strength" value="-24" valueType="float"/>
		<parameter name="ChromaStrength" value="0.0700001" valueType="float"/>
		<parameter name="ChromaType" value="0" valueType="int"/>
		<parameter name="DisableFilter" value="1" valueType="float"/>
	</filter>
	<filter name="TauronBokehEllipse">
		<parameter name="radius_mode" value="0" valueType="int"/>
		<parameter name="apertureType" value="0" valueType="int"/>
		<parameter name="alpha" value="0" valueType="float"/>
		<parameter name="apertureRotation" value="0" valueType="float"/>
		<parameter name="radius" value="0.028" valueType="float"/>
		<parameter name="outerRadiusFactor" value="2.94677" valueType="float"/>
		<parameter name="apertureParameter" value="0" valueType="float"/>
		<parameter name="gamma" value="3.5" valueType="float"/>
		<parameter name="centerX" value="0.5" valueType="float"/>
		<parameter name="centerY" value="0.5" valueType="float"/>
		<parameter name="innerRadiusX" value="0.349206" valueType="float"/>
		<parameter name="innerRadiusY" value="0.34373" valueType="float"/>
		<parameter name="upperRadiusPositive" value="0.2" valueType="float"/>
		<parameter name="lowerRadiusPositive" value="0.07" valueType="float"/>
		<parameter name="upperRadiusNegative" value="0.2" valueType="float"/>
		<parameter name="lowerRadiusNegative" value="0.07" valueType="float"/>
		<parameter name="DisableFilter" value="1" valueType="float"/>
	</filter>
	<filter name="DoubleExposure">
		<parameter name="TextureFileName" value="" valueType="utf8string"/>
		<parameter name="TextureType" value="1" valueType="int"/>
		<parameter name="TextureConvertToWorkingColorSpace" value="1" valueType="int"/>
		<parameter name="TextureUseThumbnail" value="0" valueType="float"/>
		<parameter name="centerX" value="0.500165" valueType="float"/>
		<parameter name="centerY" value="0.501815" valueType="float"/>
		<parameter name="protectCenter" value="0" valueType="float"/>
		<parameter name="zoomStrength" value="45" valueType="float"/>
		<parameter name="rotateStrength" value="0" valueType="float"/>
		<parameter name="scaleFactor" value="1" valueType="float"/>
		<parameter name="angle" value="0" valueType="float"/>
		<parameter name="posX" value="0.5" valueType="float"/>
		<parameter name="posY" value="0.5" valueType="float"/>
		<parameter name="exposure" value="102.5" valueType="float"/>
		<parameter name="exposure_balance" value="0" valueType="float"/>
		<parameter name="DisableFilter" value="0" valueType="float"/>
	</filter>
	<filter name="TauronTextureDirt">
		<parameter name="TextureType" value="3" valueType="int"/>
		<parameter name="TextureConvertToWorkingColorSpace" value="1" valueType="int"/>
		<parameter name="TextureUseThumbnail" value="0" valueType="float"/>
		<parameter name="strengthScratch" value="93" valueType="float"/>
		<parameter name="posXScratch" value="0.5" valueType="float"/>
		<parameter name="posYScratch" value="0.5" valueType="float"/>
		<parameter name="ScratchCombo" value="36" valueType="int"/>
		<parameter name="DisableFilter" value="1" valueType="float"/>
	</filter>
	<filter name="TauronLensVignette">
		<parameter name="vignetteCenterX" value="0.5" valueType="float"/>
		<parameter name="vignetteCenterY" value="0.5" valueType="float"/>
		<parameter name="vigStrength" value="-14" valueType="float"/>
		<parameter name="vigSize" value="84.0686" valueType="float"/>
		<parameter name="vigShape" value="4.5" valueType="float"/>
		<parameter name="DisableFilter" value="0" valueType="float"/>
	</filter>
	<filter name="NewFilmType">
		<parameter name="filmTypePresets" value="15" valueType="int"/>
		<parameter name="strength" value="100" valueType="float"/>
		<parameter name="fade" value="-68" valueType="float"/>
		<parameter name="grainSliderStrength" value="500" valueType="float"/>
		<parameter name="grainSliderSoftness" value="0" valueType="float"/>
		<parameter name="DisableFilter" value="0" valueType="float"/>
	</filter>
	<filter name="LevelsAndCurvesFilter">
		<parameter name="lacdataRGB" value='<Lac_serialization>
	<key name="lowNodeX" value="0"/>
	<key name="lowNodeY" value="0"/>
	<key name="highNodeX" value="1"/>
	<key name="highNodeY" value="1"/>
	<key name="gamma" value="0"/>
	<key name="intNodeCount" value="1"/>
	<key name="intNodeX0" value="0.127778"/>
	<key name="intNodeY0" value="0.111111"/>
</Lac_serialization>
' valueType="unknown"/>
		<parameter name="lacdataSmartBrightness" value='<Lac_serialization>
	<key name="lowNodeX" value="0"/>
	<key name="lowNodeY" value="0"/>
	<key name="highNodeX" value="1"/>
	<key name="highNodeY" value="1"/>
	<key name="gamma" value="0"/>
	<key name="intNodeCount" value="0"/>
</Lac_serialization>
' valueType="unknown"/>
		<parameter name="lacdataR" value='<Lac_serialization>
	<key name="lowNodeX" value="0"/>
	<key name="lowNodeY" value="0"/>
	<key name="highNodeX" value="1"/>
	<key name="highNodeY" value="1"/>
	<key name="gamma" value="0"/>
	<key name="intNodeCount" value="1"/>
	<key name="intNodeX0" value="0.288889"/>
	<key name="intNodeY0" value="0.211111"/>
</Lac_serialization>
' valueType="unknown"/>
		<parameter name="lacdataG" value='<Lac_serialization>
	<key name="lowNodeX" value="0"/>
	<key name="lowNodeY" value="0"/>
	<key name="highNodeX" value="1"/>
	<key name="highNodeY" value="1"/>
	<key name="gamma" value="0"/>
	<key name="intNodeCount" value="0"/>
</Lac_serialization>
' valueType="unknown"/>
		<parameter name="lacdataB" value='<Lac_serialization>
	<key name="lowNodeX" value="0"/>
	<key name="lowNodeY" value="0"/>
	<key name="highNodeX" value="1"/>
	<key name="highNodeY" value="1"/>
	<key name="gamma" value="0"/>
	<key name="intNodeCount" value="0"/>
</Lac_serialization>
' valueType="unknown"/>
		<parameter name="strength" value="100" valueType="float"/>
		<parameter name="DisableFilter" value="1" valueType="float"/>
	</filter>
	<group name="general">
		<key name="name" type="string" value="sogrid"/>
		<key name="uid" type="string" value="2018-12-15T03:12:02291074011"/>
		<key name="tags" type="string_array">
			<string value="Custom"/>
		</key>
	</group>
</AnalogEfexPro2_preset>

{'repo_name': 'manoloide/AllSketchs', 'stars': '393', 'repo_language': 'Processing', 'file_name': 'ordeco.np', 'mime_type': 'text/plain', 'hash': 4674748438638252696, 'source_dataset': 'data'}