text:
package toolset.mappers;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;
import java.util.StringTokenizer;

/**
 * Created by seb on 26.04.16.
 */
public class TextMapper
        extends Mapper<Object, Text, IntWritable, IntWritable> {
    private IntWritable id = new IntWritable();
    private IntWritable friend = new IntWritable();

    @SuppressWarnings("unused")
    public void map(Object key, Text value, Context context)
            throws IOException, InterruptedException {
        StringTokenizer it = new StringTokenizer(value.toString());
        id.set(Integer.parseInt(it.nextToken()));
        friend.set(Integer.parseInt(it.nextToken()));
        context.write(id, friend);
    }
}

redpajama_set_name: RedPajamaGithub


text:
dashboardApp.factory('dataFactory', function($http) {

    var locationport = location.port;
    if(locationport){
        var urlBase = 'http://'+window.location.hostname+':'+locationport+'/computedashboard/instances';
    }else{
        var urlBase = 'https://'+window.location.hostname+'/computedashboard/instances';
    }

    var _instFactory = {};
    _instFactory.getInstances = function() {
        return $http.get(urlBase);
    };
    return _instFactory;
});


text:
var fs = require("fs");

fs.readdir("depends", function (err, files) {
	if (err) throw err;

	var minimizedFile = "";
	for (var fKey = 0; fKey < files.length; fKey++) {
		minimizedFile += fs.readFileSync("depends/" + files[fKey], {encoding: "utf-8"});
	}

	minimizedFile += fs.readFileSync("Paint.js", {encoding: "utf-8"});

	fs.writeFile("Paint.min.js", minimizedFile, function (err) {
		if (err) throw err;
	});
});


text:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
#if FEATURE_TAP
using System.Threading;
using System.Threading.Tasks;
#endif // FEATURE_TAP

namespace MsgPack.Serialization.DefaultSerializers
{
	[Preserve( AllMembers = true )]
	internal sealed class ImmutableDictionarySerializer<T, TKey, TValue> : MessagePackSerializer<T>
		where T : IEnumerable<KeyValuePair<TKey, TValue>>
	{
		private readonly Func<KeyValuePair<TKey, TValue>[], T> _factory;

		private static Func<KeyValuePair<TKey, TValue>[], T> FindFactory()
		{
			var factoryType =
				typeof( T ).GetAssembly().GetType(
					typeof( T ).FullName.Remove( typeof( T ).FullName.IndexOf( '`' ) )
				);

			if ( factoryType == null )
			{
				return
					_ =>
					{
						throw new NotSupportedException(
							String.Format(
								CultureInfo.CurrentCulture,
								"'{0}' may not be an immutable collection.",
								typeof( T ).AssemblyQualifiedName
							)
						);
					};
			}

			var methods =
				factoryType
				.GetMethods()
				.Where(
					m =>
					m.IsStatic
					&& m.IsPublic
					&& m.IsGenericMethod
					&& m.Name == "CreateRange"
					&& m.GetParameters().Length == 1
				);

			var method = methods.FirstOrDefault();

			if ( method == null )
			{
				return
					_ =>
					{
						throw new NotSupportedException(
							String.Format(
								CultureInfo.CurrentCulture,
								"'{0}' does not have CreateRange({1}[]) public static method.",
								factoryType.AssemblyQualifiedName,
								typeof( KeyValuePair<TKey, TValue> )
							)
						);
					};
			}

			var result = method.MakeGenericMethod( typeof( TKey ), typeof( TValue ) );
#if !UNITY
			return result.CreateDelegate( typeof( Func<KeyValuePair<TKey, TValue>[], T> ) ) as Func<KeyValuePair<TKey, TValue>[], T>;
#else
			return Delegate.CreateDelegate( typeof( Func<KeyValuePair<TKey, TValue>[], T> ), result ) as Func<KeyValuePair<TKey, TValue>[], T>;
#endif // !UNITY
		}

		private readonly MessagePackSerializer<TKey> _keySerializer;
		private readonly MessagePackSerializer<TValue> _valueSerializer;

		public ImmutableDictionarySerializer( SerializationContext ownerContext, PolymorphismSchema keysSchema, PolymorphismSchema valuesSchema )
			: base( ownerContext, SerializerCapabilities.PackTo | SerializerCapabilities.UnpackFrom )
		{
			this._keySerializer = ownerContext.GetSerializer<TKey>( keysSchema );
			this._valueSerializer = ownerContext.GetSerializer<TValue>( valuesSchema );
			this._factory = FindFactory();
		}

		[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )]
		protected internal override void PackToCore( Packer packer, T objectTree )
		{
			packer.PackMapHeader( objectTree.Count() );

			foreach ( var item in objectTree )
			{
				this._keySerializer.PackTo( packer, item.Key );
				this._valueSerializer.PackTo( packer, item.Value );
			}
		}

		[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )]
		protected internal override T UnpackFromCore( Unpacker unpacker )
		{
			if ( !unpacker.IsMapHeader )
			{
				SerializationExceptions.ThrowIsNotMapHeader( unpacker );
			}

			var buffer = new KeyValuePair<TKey, TValue>[ UnpackHelpers.GetItemsCount( unpacker ) ];

			using ( var subTreeUnpacker = unpacker.ReadSubtree() )
			{
				for ( int i = 0; i < buffer.Length; i++ )
				{
					if ( !subTreeUnpacker.Read() )
					{
						SerializationExceptions.ThrowUnexpectedEndOfStream( unpacker );
					}

					var key = this._keySerializer.UnpackFrom( unpacker );

					if ( !subTreeUnpacker.Read() )
					{
						SerializationExceptions.ThrowUnexpectedEndOfStream( unpacker );
					}

					var value = this._valueSerializer.UnpackFrom( unpacker );

					buffer[ i ] = new KeyValuePair<TKey, TValue>( key, value );
				}
			}

			return this._factory( buffer );
		}

		protected internal override void UnpackToCore( Unpacker unpacker, T collection )
		{
			throw new NotSupportedException(
				String.Format(
					CultureInfo.CurrentCulture,
					"Unable to unpack items to existing immutable dictioary '{0}'.",
					typeof( T )
				)
			);
		}

#if FEATURE_TAP

		protected internal override async Task PackToAsyncCore( Packer packer, T objectTree, CancellationToken cancellationToken )
		{
			await packer.PackMapHeaderAsync( objectTree.Count(), cancellationToken ).ConfigureAwait( false );

			foreach ( var item in objectTree )
			{
				await this._keySerializer.PackToAsync( packer, item.Key, cancellationToken ).ConfigureAwait( false );
				await this._valueSerializer.PackToAsync( packer, item.Value, cancellationToken ).ConfigureAwait( false );
			}
		}

		protected internal override async Task<T> UnpackFromAsyncCore( Unpacker unpacker, CancellationToken cancellationToken )
		{
			if ( !unpacker.IsMapHeader )
			{
				SerializationExceptions.ThrowIsNotMapHeader( unpacker );
			}

			var buffer = new KeyValuePair<TKey, TValue>[ UnpackHelpers.GetItemsCount( unpacker ) ];

			using ( var subTreeUnpacker = unpacker.ReadSubtree() )
			{
				for ( int i = 0; i < buffer.Length; i++ )
				{
					if ( !await subTreeUnpacker.ReadAsync( cancellationToken ).ConfigureAwait( false ) )
					{
						SerializationExceptions.ThrowUnexpectedEndOfStream( unpacker );
					}

					var key = await this._keySerializer.UnpackFromAsync( unpacker, cancellationToken ).ConfigureAwait( false );

					if ( !await subTreeUnpacker.ReadAsync( cancellationToken ).ConfigureAwait( false ) )
					{
						SerializationExceptions.ThrowUnexpectedEndOfStream( unpacker );
					}

					var value = await this._valueSerializer.UnpackFromAsync( unpacker, cancellationToken ).ConfigureAwait( false );

					buffer[ i ] = new KeyValuePair<TKey, TValue>( key, value );
				}
			}

			return this._factory( buffer );
		}

		protected internal override Task UnpackToAsyncCore( Unpacker unpacker, T collection, CancellationToken cancellationToken )
		{
			throw new NotSupportedException(
				String.Format(
					CultureInfo.CurrentCulture,
					"Unable to unpack items to existing immutable dictioary '{0}'.",
					typeof( T )
				)
			);
		}

#endif // FEATURE_TAP

	}
}


text:
{-# LANGUAGE CPP, MagicHash, UnboxedTuples, DeriveDataTypeable, BangPatterns #-}

-- |
-- Module      : Data.Primitive.Array
-- Copyright   : (c) Roman Leshchinskiy 2009-2012
-- License     : BSD-style
--
-- Maintainer  : Roman Leshchinskiy <rl@cse.unsw.edu.au>
-- Portability : non-portable
--
-- Primitive boxed arrays
--

module Data.Primitive.Array (
  Array(..), MutableArray(..),

  newArray, readArray, writeArray, indexArray, indexArrayM,
  unsafeFreezeArray, unsafeThawArray, sameMutableArray,
  copyArray, copyMutableArray,
  cloneArray, cloneMutableArray
) where

import Control.Monad.Primitive

import GHC.Base  ( Int(..) )
import GHC.Prim

import Data.Typeable ( Typeable )
import Data.Data ( Data(..) )
import Data.Primitive.Internal.Compat ( isTrue#, mkNoRepType )

import Control.Monad.ST(runST)

-- | Boxed arrays
data Array a = Array (Array# a) deriving ( Typeable )

-- | Mutable boxed arrays associated with a primitive state token.
data MutableArray s a = MutableArray (MutableArray# s a)
                                deriving ( Typeable )

-- | Create a new mutable array of the specified size and initialise all
-- elements with the given value.
newArray :: PrimMonad m => Int -> a -> m (MutableArray (PrimState m) a)
{-# INLINE newArray #-}
newArray (I# n#) x = primitive
   (\s# -> case newArray# n# x s# of
             (# s'#, arr# #) -> (# s'#, MutableArray arr# #))

-- | Read a value from the array at the given index.
readArray :: PrimMonad m => MutableArray (PrimState m) a -> Int -> m a
{-# INLINE readArray #-}
readArray (MutableArray arr#) (I# i#) = primitive (readArray# arr# i#)

-- | Write a value to the array at the given index.
writeArray :: PrimMonad m => MutableArray (PrimState m) a -> Int -> a -> m ()
{-# INLINE writeArray #-}
writeArray (MutableArray arr#) (I# i#) x = primitive_ (writeArray# arr# i# x)

-- | Read a value from the immutable array at the given index.
indexArray :: Array a -> Int -> a
{-# INLINE indexArray #-}
indexArray (Array arr#) (I# i#) = case indexArray# arr# i# of (# x #) -> x

-- | Monadically read a value from the immutable array at the given index.
-- This allows us to be strict in the array while remaining lazy in the read
-- element which is very useful for collective operations. Suppose we want to
-- copy an array. We could do something like this:
--
-- > copy marr arr ... = do ...
-- >                        writeArray marr i (indexArray arr i) ...
-- >                        ...
--
-- But since primitive arrays are lazy, the calls to 'indexArray' will not be
-- evaluated. Rather, @marr@ will be filled with thunks each of which would
-- retain a reference to @arr@. This is definitely not what we want!
--
-- With 'indexArrayM', we can instead write
--
-- > copy marr arr ... = do ...
-- >                        x <- indexArrayM arr i
-- >                        writeArray marr i x
-- >                        ...
--
-- Now, indexing is executed immediately although the returned element is
-- still not evaluated.
--
indexArrayM :: Monad m => Array a -> Int -> m a
{-# INLINE indexArrayM #-}
indexArrayM (Array arr#) (I# i#)
  = case indexArray# arr# i# of (# x #) -> return x

-- | Convert a mutable array to an immutable one without copying. The
-- array should not be modified after the conversion.
unsafeFreezeArray :: PrimMonad m => MutableArray (PrimState m) a -> m (Array a)
{-# INLINE unsafeFreezeArray #-}
unsafeFreezeArray (MutableArray arr#)
  = primitive (\s# -> case unsafeFreezeArray# arr# s# of
                        (# s'#, arr'# #) -> (# s'#, Array arr'# #))

-- | Convert an immutable array to an mutable one without copying. The
-- immutable array should not be used after the conversion.
unsafeThawArray :: PrimMonad m => Array a -> m (MutableArray (PrimState m) a)
{-# INLINE unsafeThawArray #-}
unsafeThawArray (Array arr#)
  = primitive (\s# -> case unsafeThawArray# arr# s# of
                        (# s'#, arr'# #) -> (# s'#, MutableArray arr'# #))

-- | Check whether the two arrays refer to the same memory block.
sameMutableArray :: MutableArray s a -> MutableArray s a -> Bool
{-# INLINE sameMutableArray #-}
sameMutableArray (MutableArray arr#) (MutableArray brr#)
  = isTrue# (sameMutableArray# arr# brr#)

-- | Copy a slice of an immutable array to a mutable array.
copyArray :: PrimMonad m
          => MutableArray (PrimState m) a    -- ^ destination array
          -> Int                             -- ^ offset into destination array
          -> Array a                         -- ^ source array
          -> Int                             -- ^ offset into source array
          -> Int                             -- ^ number of elements to copy
          -> m ()
{-# INLINE copyArray #-}
#if __GLASGOW_HASKELL__ > 706
-- NOTE: copyArray# and copyMutableArray# are slightly broken in GHC 7.6.* and earlier
copyArray (MutableArray dst#) (I# doff#) (Array src#) (I# soff#) (I# len#)
  = primitive_ (copyArray# src# soff# dst# doff# len#)
#else
copyArray !dst !doff !src !soff !len = go 0
  where
    go i | i < len = do
                       x <- indexArrayM src (soff+i)
                       writeArray dst (doff+i) x
                       go (i+1)
         | otherwise = return ()
#endif

-- | Copy a slice of a mutable array to another array. The two arrays may
-- not be the same.
copyMutableArray :: PrimMonad m
          => MutableArray (PrimState m) a    -- ^ destination array
          -> Int                             -- ^ offset into destination array
          -> MutableArray (PrimState m) a    -- ^ source array
          -> Int                             -- ^ offset into source array
          -> Int                             -- ^ number of elements to copy
          -> m ()
{-# INLINE copyMutableArray #-}
#if __GLASGOW_HASKELL__ >= 706
-- NOTE: copyArray# and copyMutableArray# are slightly broken in GHC 7.6.* and earlier
copyMutableArray (MutableArray dst#) (I# doff#)
                 (MutableArray src#) (I# soff#) (I# len#)
  = primitive_ (copyMutableArray# src# soff# dst# doff# len#)
#else
copyMutableArray !dst !doff !src !soff !len = go 0
  where
    go i | i < len = do
                       x <- readArray src (soff+i)
                       writeArray dst (doff+i) x
                       go (i+1)
         | otherwise = return ()
#endif

-- | Return a newly allocated Array with the specified subrange of the
-- provided Array. The provided Array should contain the full subrange
-- specified by the two Ints, but this is not checked.
cloneArray :: Array a -- ^ source array
           -> Int     -- ^ offset into destination array
           -> Int     -- ^ number of elements to copy
           -> Array a
{-# INLINE cloneArray #-}
#if __GLASGOW_HASKELL__ >= 702
cloneArray (Array arr#) (I# off#) (I# len#)
  = case cloneArray# arr# off# len# of arr'# -> Array arr'#
#else
cloneArray arr off len = runST $ do
    marr2 <- newArray len (error "Undefined element")
    copyArray marr2 0 arr off len
    unsafeFreezeArray marr2
#endif

-- | Return a newly allocated MutableArray. with the specified subrange of
-- the provided MutableArray. The provided MutableArray should contain the
-- full subrange specified by the two Ints, but this is not checked.
cloneMutableArray :: PrimMonad m
        => MutableArray (PrimState m) a -- ^ source array
        -> Int                          -- ^ offset into destination array
        -> Int                          -- ^ number of elements to copy
        -> m (MutableArray (PrimState m) a)
{-# INLINE cloneMutableArray #-}
#if __GLASGOW_HASKELL__ >= 702
cloneMutableArray (MutableArray arr#) (I# off#) (I# len#) = primitive
   (\s# -> case cloneMutableArray# arr# off# len# s# of
             (# s'#, arr'# #) -> (# s'#, MutableArray arr'# #))
#else
cloneMutableArray marr off len = do
        marr2 <- newArray len (error "Undefined element")
        let go !i !j c
                | c >= len = return marr2
                | otherwise = do
                    b <- readArray marr i
                    writeArray marr2 j b
                    go (i+1) (j+1) (c+1)
        go off 0 0
#endif

instance Typeable a => Data (Array a) where
  toConstr _ = error "toConstr"
  gunfold _ _ = error "gunfold"
  dataTypeOf _ = mkNoRepType "Data.Primitive.Array.Array"

instance (Typeable s, Typeable a) => Data (MutableArray s a) where
  toConstr _ = error "toConstr"
  gunfold _ _ = error "gunfold"
  dataTypeOf _ = mkNoRepType "Data.Primitive.Array.MutableArray"


text:
using namespace flat2d;

TEST_CASE("UID Generation sequence test", "[UID]")
{
	const int thread_count = 20;
	std::set<int> idSet;
	flat2d::SpinLock lock;

	auto call_from_thread = [&]() {
		lock.lock();
		size_t id = UID::generate();
		REQUIRE(idSet.find(id) == idSet.end());
		idSet.insert(id);
		lock.unlock();
	};

	REQUIRE(idSet.size() == 0);

	std::thread threads[thread_count];
	for (auto i = 0; i < thread_count; i++) {
		threads[i] = std::thread(call_from_thread);
	}

	for (auto i = 0; i < thread_count; i++) {
		threads[i].join();
	}

	REQUIRE(idSet.size() == thread_count);
}


text:
import warnings
from typing import Callable, Dict, Optional, Sequence, Tuple, Union

from google.api_core import grpc_helpers
from google.api_core import operations_v1
from google.api_core import gapic_v1
import google.auth                         # type: ignore
from google.auth import credentials as ga_credentials  # type: ignore
from google.auth.transport.grpc import SslCredentials  # type: ignore

import grpc  # type: ignore

from google.cloud.eventarc_v1.types import eventarc
from google.cloud.eventarc_v1.types import trigger
from google.longrunning import operations_pb2  # type: ignore
from .base import EventarcTransport, DEFAULT_CLIENT_INFO

class EventarcGrpcTransport(EventarcTransport):
    """gRPC backend transport for Eventarc.

    Eventarc allows users to subscribe to various events that are
    provided by Google Cloud services and forward them to supported
    destinations.

    This class defines the same methods as the primary client, so the
    primary client can load the underlying transport implementation
    and call it.

    It sends protocol buffers over the wire using gRPC (which is built on
    top of HTTP/2); the ``grpcio`` package must be installed.
    """
    _stubs: Dict[str, Callable]

    def __init__(self, *,
            host: str = 'eventarc.googleapis.com',
            credentials: Optional[ga_credentials.Credentials] = None,
            credentials_file: Optional[str] = None,
            scopes: Optional[Sequence[str]] = None,
            channel: Optional[grpc.Channel] = None,
            api_mtls_endpoint: Optional[str] = None,
            client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
            ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
            client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
            quota_project_id: Optional[str] = None,
            client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
            always_use_jwt_access: Optional[bool] = False,
            api_audience: Optional[str] = None,
            ) -> None:
        """Instantiate the transport.

        Args:
            host (Optional[str]):
                 The hostname to connect to.
            credentials (Optional[google.auth.credentials.Credentials]): The
                authorization credentials to attach to requests. These
                credentials identify the application to the service; if none
                are specified, the client will attempt to ascertain the
                credentials from the environment.
                This argument is ignored if ``channel`` is provided.
            credentials_file (Optional[str]): A file with credentials that can
                be loaded with :func:`google.auth.load_credentials_from_file`.
                This argument is ignored if ``channel`` is provided.
            scopes (Optional(Sequence[str])): A list of scopes. This argument is
                ignored if ``channel`` is provided.
            channel (Optional[grpc.Channel]): A ``Channel`` instance through
                which to make calls.
            api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
                If provided, it overrides the ``host`` argument and tries to create
                a mutual TLS channel with client SSL credentials from
                ``client_cert_source`` or application default SSL credentials.
            client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
                Deprecated. A callback to provide client SSL certificate bytes and
                private key bytes, both in PEM format. It is ignored if
                ``api_mtls_endpoint`` is None.
            ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
                for the grpc channel. It is ignored if ``channel`` is provided.
            client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
                A callback to provide client certificate bytes and private key bytes,
                both in PEM format. It is used to configure a mutual TLS channel. It is
                ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
            quota_project_id (Optional[str]): An optional project to use for billing
                and quota.
            client_info (google.api_core.gapic_v1.client_info.ClientInfo):
                The client info used to send a user-agent string along with
                API requests. If ``None``, then default info will be used.
                Generally, you only need to set this if you're developing
                your own client library.
            always_use_jwt_access (Optional[bool]): Whether self signed JWT should
                be used for service account credentials.

        Raises:
          google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
              creation failed for any reason.
          google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
              and ``credentials_file`` are passed.
        """
        self._grpc_channel = None
        self._ssl_channel_credentials = ssl_channel_credentials
        self._stubs: Dict[str, Callable] = {}
        self._operations_client: Optional[operations_v1.OperationsClient] = None

        if api_mtls_endpoint:
            warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
        if client_cert_source:
            warnings.warn("client_cert_source is deprecated", DeprecationWarning)

        if channel:
            # Ignore credentials if a channel was passed.
            credentials = False
            # If a channel was explicitly provided, set it.
            self._grpc_channel = channel
            self._ssl_channel_credentials = None

        else:
            if api_mtls_endpoint:
                host = api_mtls_endpoint

                # Create SSL credentials with client_cert_source or application
                # default SSL credentials.
                if client_cert_source:
                    cert, key = client_cert_source()
                    self._ssl_channel_credentials = grpc.ssl_channel_credentials(
                        certificate_chain=cert, private_key=key
                    )
                else:
                    self._ssl_channel_credentials = SslCredentials().ssl_credentials

            else:
                if client_cert_source_for_mtls and not ssl_channel_credentials:
                    cert, key = client_cert_source_for_mtls()
                    self._ssl_channel_credentials = grpc.ssl_channel_credentials(
                        certificate_chain=cert, private_key=key
                    )

        # The base transport sets the host, credentials and scopes
        super().__init__(
            host=host,
            credentials=credentials,
            credentials_file=credentials_file,
            scopes=scopes,
            quota_project_id=quota_project_id,
            client_info=client_info,
            always_use_jwt_access=always_use_jwt_access,
            api_audience=api_audience,
        )

        if not self._grpc_channel:
            self._grpc_channel = type(self).create_channel(
                self._host,
                # use the credentials which are saved
                credentials=self._credentials,
                # Set ``credentials_file`` to ``None`` here as
                # the credentials that we saved earlier should be used.
                credentials_file=None,
                scopes=self._scopes,
                ssl_credentials=self._ssl_channel_credentials,
                quota_project_id=quota_project_id,
                options=[
                    ("grpc.max_send_message_length", -1),
                    ("grpc.max_receive_message_length", -1),
                ],
            )

        # Wrap messages. This must be done after self._grpc_channel exists
        self._prep_wrapped_messages(client_info)

    @classmethod
    def create_channel(cls,
                       host: str = 'eventarc.googleapis.com',
                       credentials: Optional[ga_credentials.Credentials] = None,
                       credentials_file: Optional[str] = None,
                       scopes: Optional[Sequence[str]] = None,
                       quota_project_id: Optional[str] = None,
                       **kwargs) -> grpc.Channel:
        """Create and return a gRPC channel object.
        Args:
            host (Optional[str]): The host for the channel to use.
            credentials (Optional[~.Credentials]): The
                authorization credentials to attach to requests. These
                credentials identify this application to the service. If
                none are specified, the client will attempt to ascertain
                the credentials from the environment.
            credentials_file (Optional[str]): A file with credentials that can
                be loaded with :func:`google.auth.load_credentials_from_file`.
                This argument is mutually exclusive with credentials.
            scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
                service. These are only used when credentials are not specified and
                are passed to :func:`google.auth.default`.
            quota_project_id (Optional[str]): An optional project to use for billing
                and quota.
            kwargs (Optional[dict]): Keyword arguments, which are passed to the
                channel creation.
        Returns:
            grpc.Channel: A gRPC channel object.

        Raises:
            google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
              and ``credentials_file`` are passed.
        """

        return grpc_helpers.create_channel(
            host,
            credentials=credentials,
            credentials_file=credentials_file,
            quota_project_id=quota_project_id,
            default_scopes=cls.AUTH_SCOPES,
            scopes=scopes,
            default_host=cls.DEFAULT_HOST,
            **kwargs
        )

    @property
    def grpc_channel(self) -> grpc.Channel:
        """Return the channel designed to connect to this service.
        """
        return self._grpc_channel

    @property
    def operations_client(self) -> operations_v1.OperationsClient:
        """Create the client designed to process long-running operations.

        This property caches on the instance; repeated calls return the same
        client.
        """
        # Quick check: Only create a new client if we do not already have one.
        if self._operations_client is None:
            self._operations_client = operations_v1.OperationsClient(
                self.grpc_channel
            )

        # Return the client from cache.
        return self._operations_client

    @property
    def get_trigger(self) -> Callable[
            [eventarc.GetTriggerRequest],
            trigger.Trigger]:
        r"""Return a callable for the get trigger method over gRPC.

        Get a single trigger.

        Returns:
            Callable[[~.GetTriggerRequest],
                    ~.Trigger]:
                A function that, when called, will call the underlying RPC
                on the server.
        """
        # Generate a "stub function" on-the-fly which will actually make
        # the request.
        # gRPC handles serialization and deserialization, so we just need
        # to pass in the functions for each.
        if 'get_trigger' not in self._stubs:
            self._stubs['get_trigger'] = self.grpc_channel.unary_unary(
                '/google.cloud.eventarc.v1.Eventarc/GetTrigger',
                request_serializer=eventarc.GetTriggerRequest.serialize,
                response_deserializer=trigger.Trigger.deserialize,
            )
        return self._stubs['get_trigger']

    @property
    def list_triggers(self) -> Callable[
            [eventarc.ListTriggersRequest],
            eventarc.ListTriggersResponse]:
        r"""Return a callable for the list triggers method over gRPC.

        List triggers.

        Returns:
            Callable[[~.ListTriggersRequest],
                    ~.ListTriggersResponse]:
                A function that, when called, will call the underlying RPC
                on the server.
        """
        # Generate a "stub function" on-the-fly which will actually make
        # the request.
        # gRPC handles serialization and deserialization, so we just need
        # to pass in the functions for each.
        if 'list_triggers' not in self._stubs:
            self._stubs['list_triggers'] = self.grpc_channel.unary_unary(
                '/google.cloud.eventarc.v1.Eventarc/ListTriggers',
                request_serializer=eventarc.ListTriggersRequest.serialize,
                response_deserializer=eventarc.ListTriggersResponse.deserialize,
            )
        return self._stubs['list_triggers']

    @property
    def create_trigger(self) -> Callable[
            [eventarc.CreateTriggerRequest],
            operations_pb2.Operation]:
        r"""Return a callable for the create trigger method over gRPC.

        Create a new trigger in a particular project and
        location.

        Returns:
            Callable[[~.CreateTriggerRequest],
                    ~.Operation]:
                A function that, when called, will call the underlying RPC
                on the server.
        """
        # Generate a "stub function" on-the-fly which will actually make
        # the request.
        # gRPC handles serialization and deserialization, so we just need
        # to pass in the functions for each.
        if 'create_trigger' not in self._stubs:
            self._stubs['create_trigger'] = self.grpc_channel.unary_unary(
                '/google.cloud.eventarc.v1.Eventarc/CreateTrigger',
                request_serializer=eventarc.CreateTriggerRequest.serialize,
                response_deserializer=operations_pb2.Operation.FromString,
            )
        return self._stubs['create_trigger']

    @property
    def update_trigger(self) -> Callable[
            [eventarc.UpdateTriggerRequest],
            operations_pb2.Operation]:
        r"""Return a callable for the update trigger method over gRPC.

        Update a single trigger.

        Returns:
            Callable[[~.UpdateTriggerRequest],
                    ~.Operation]:
                A function that, when called, will call the underlying RPC
                on the server.
        """
        # Generate a "stub function" on-the-fly which will actually make
        # the request.
        # gRPC handles serialization and deserialization, so we just need
        # to pass in the functions for each.
        if 'update_trigger' not in self._stubs:
            self._stubs['update_trigger'] = self.grpc_channel.unary_unary(
                '/google.cloud.eventarc.v1.Eventarc/UpdateTrigger',
                request_serializer=eventarc.UpdateTriggerRequest.serialize,
                response_deserializer=operations_pb2.Operation.FromString,
            )
        return self._stubs['update_trigger']

    @property
    def delete_trigger(self) -> Callable[
            [eventarc.DeleteTriggerRequest],
            operations_pb2.Operation]:
        r"""Return a callable for the delete trigger method over gRPC.

        Delete a single trigger.

        Returns:
            Callable[[~.DeleteTriggerRequest],
                    ~.Operation]:
                A function that, when called, will call the underlying RPC
                on the server.
        """
        # Generate a "stub function" on-the-fly which will actually make
        # the request.
        # gRPC handles serialization and deserialization, so we just need
        # to pass in the functions for each.
        if 'delete_trigger' not in self._stubs:
            self._stubs['delete_trigger'] = self.grpc_channel.unary_unary(
                '/google.cloud.eventarc.v1.Eventarc/DeleteTrigger',
                request_serializer=eventarc.DeleteTriggerRequest.serialize,
                response_deserializer=operations_pb2.Operation.FromString,
            )
        return self._stubs['delete_trigger']

    def close(self):
        self.grpc_channel.close()

    @property
    def kind(self) -> str:
        return "grpc"

__all__ = (
    'EventarcGrpcTransport',
)


text:
static PlutoAPIEngine *singleton = nil;
@implementation PlutoAPIEngine
//缓存优先回调到页面上,缓存没有或者过期后才获取网络数据,转化成Model回调到页面
-(MKNetworkOperation *) apiModelCacheAdvanceGet:(Class) clazz apiURL:(NSString *)apiURL params:(NSDictionary *)params cacheKey:(NSString *)key callBackHandler:(CallBackHandler)
callBackHandler{

    NSData *cacheContent = [[DataManagerProxy getInstance:FILECACHE] queryData:key];

    if (cacheContent&&cacheContent.length>0) {
        NSString *jsonString = [[NSString alloc] initWithData:cacheContent encoding:NSUTF8StringEncoding];
        NSLog(@"apiModelCacheAdvanceGet缓存-->%@",jsonString);

        callBackHandler(200,[clazz yy_modelWithJSON:jsonString],@"success");
    }

    MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"GET"];

    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {

        NSString *jsonStr = [completedOperation responseString];
        NSLog(@"获取有缓存单个实体网络数据-->%@",[completedOperation responseString]);

        Result *result = [Result yy_modelWithJSON:jsonStr];

        if (result!=nil) {

            if (result.status==200) {//请求成功

                id data = [clazz yy_modelWithJSON:result.content];

                if (data!=nil) {

                    NSData *jsonData = [data yy_modelToJSONData];
                    [[DataManagerProxy getInstance:FILECACHE] saveData:jsonData key:key];
                    callBackHandler(200,data,@"success");
                }else{
                    callBackHandler(400,nil,@"content中的json部分不是一个NSArray或者是NSDictionary");
                }

            }else {//请求失败
                //NSLog(@"请求数据为不符合");
                callBackHandler(result.status,nil,result.errorMsg);
            }
        }else{
            callBackHandler(500,nil,@"failed");
        }
    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
        callBackHandler(600,error,[error localizedDescription]);
    }];

    [singleton enqueueOperation:op];

    return op;

}

//显示缓存,如果缓存没有或者过期获取网路数据并保存
-(MKNetworkOperation *) apiModelReturnCacheAdvanceGet:(Class) clazz apiURL:(NSString *)apiURL params:(NSDictionary *)params cacheKey:(NSString *)key callBackHandler:(CallBackHandler)
callBackHandler{

    NSData *cacheContent =  [[DataManagerProxy getInstance:FILECACHE] queryData:key];

    if (cacheContent&&cacheContent.length>0) {
        NSString *jsonString = [[NSString alloc] initWithData:cacheContent encoding:NSUTF8StringEncoding];
        NSLog(@"apiModelCacheAdvanceGet缓存-->%@",jsonString);

        callBackHandler(200,[clazz yy_modelWithJSON:jsonString],@"success");
    }else{

        MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"GET"];

        [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {

            //NSDictionary *data = [completedOperation responseJSON];
            NSString *jsonStr = [completedOperation responseString];
            NSLog(@"获取有缓存单个实体网络数据-->%@",[completedOperation responseString]);

            //Result *result = [[Result alloc] initWithString:jsonStr error:nil];
            Result *result = [Result yy_modelWithJSON:jsonStr];

            if (result!=nil) {

                if (result.status==200) {//请求成功

                    id data = [clazz yy_modelWithJSON:result.content];

                    if (data!=nil) {

                        NSData *jsonData = [data yy_modelToJSONData];

                        [[DataManagerProxy getInstance:FILECACHE] saveData:jsonData key:key];
                        callBackHandler(200,data,@"success");
                    }else{
                        callBackHandler(400,nil,@"content中的json部分不是一个NSArray或者是NSDictionary");
                    }

                }else {//请求失败
                    //NSLog(@"请求数据为不符合");
                    callBackHandler(result.status,nil,result.errorMsg);
                }
            }else{
                callBackHandler(500,nil,@"failed");
            }
        } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
            callBackHandler(600,error,[error localizedDescription]);
        }];

        [singleton enqueueOperation:op];
        return op;
    }
    return nil;

}

//缓存优先回调到页面上,缓存没有或者过期后才获取网络数据,转化成Model缓存下来不返回页面
-(MKNetworkOperation *) apiModelFromNetThanCached:(Class) clazz apiURL:(NSString *)apiURL params:(NSDictionary *)params cacheKey:(NSString *)key callBackHandler:(CallBackHandler)callBackHandler{

    MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"GET"];

    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {

        //NSDictionary *data = [completedOperation responseJSON];
        NSLog(@"获取有缓存单个实体网络数据-->%@",[completedOperation responseString]);
        NSString *jsonstr = [completedOperation responseString];
        //Result *result = [[Result alloc] initWithString:jsonstr error:nil];
        Result *result = [Result yy_modelWithJSON:jsonstr];
        if (result!=nil) {
            if (result.status==200) {//请求成功
                //  NSLog(@"保存用户信息%@",[data objectForKey:@"content"]);

                //id data = [[clazz alloc] initWithString:result.content error:nil];
                id data = [clazz yy_modelWithJSON:result.content];
                if (data!=nil) {
                    NSData *jsonData = [data yy_modelToJSONData];

                    [[DataManagerProxy getInstance:FILECACHE] saveData:jsonData key:key];
                    callBackHandler(200,data,@"success");
                }else{
                    callBackHandler(400,nil,@"content中的json部分不是一个NSArray或者是NSDictionary");
                }

            }else {//请求失败
                //NSLog(@"请求数据为不符合");
                callBackHandler(result.status,nil,result.errorMsg);
            }
        }else{
            callBackHandler(500,nil,@"failed");
        }
    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
        callBackHandler(600,error,[error localizedDescription]);
    }];

    [singleton enqueueOperation:op];

    return op;

}

//不考虑缓存,直接获取网络数据,转化成model回调到页面上
-(MKNetworkOperation *) apiModelNoCacheGet:(Class) clazz apiURL:(NSString *) apiURL params:(NSDictionary *)params callBackHandler:(CallBackHandler)
callBackHandler{

    MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"GET"];

    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {

        //NSDictionary *data = [completedOperation responseJSON];

        NSLog(@"获取无缓存单个实体网络数据-->%@",[completedOperation responseString]);

        NSString *jsonStr = [completedOperation responseString];
        //Result *result = [[Result alloc] initWithString:jsonStr error:nil];
        Result *result = [Result yy_modelWithJSON:jsonStr];

        if (result!=nil) {
            //NSNumber *status = [data objectForKey:@"status"];
            // NSLog(@"获取的内容-->%@",contentStr);

            if (result.status==200) {//请求成功
                callBackHandler(200,[clazz yy_modelWithJSON:result.content],@"success");
            }else{//请求失败
                callBackHandler(result.status,nil,result.errorMsg);
            }
        }else{
            callBackHandler(500,nil,@"failed");
        }
    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
        callBackHandler(600,nil,[error localizedDescription]);
    }];

    [singleton enqueueOperation:op];

    return op;
}

//不考虑缓存,直接获取网络数据,转化成model回调到页面上
-(MKNetworkOperation *) apiModelNoCachePost:(Class) clazz apiURL:(NSString *) apiURL params:(NSDictionary *)params callBackHandler:(CallBackHandler)callBackHandler{

    MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"POST"];

    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {

        //NSDictionary *data = [completedOperation responseJSON];

        NSLog(@"获取无缓存单个实体网络数据-->%@",[completedOperation responseString]);

        NSString *jsonStr = [completedOperation responseString];

        //Result *result = [[Result alloc] initWithString:jsonStr error:nil];

        Result *result = [Result yy_modelWithJSON:jsonStr];

        if (result!=nil) {

            if (result.status==200) {//请求成功
                callBackHandler(200,[clazz yy_modelWithJSON:result.content],@"success");
            }else{//请求失败
                callBackHandler(result.status,nil,result.errorMsg);
            }
        }else{
            callBackHandler(500,nil,@"failed");
        }
    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
        callBackHandler(600,nil,[error localizedDescription]);
    }];

    [singleton enqueueOperation:op];

    return op;
}

//不考虑缓存,直接获取网络数据,转化成model回调到页面上[上传图片]
-(MKNetworkOperation *) apiModelNoCacheImagePost:(Class) clazz apiURL:(NSString *) apiURL filePath:(NSString *)filePath fileKey:(NSString *) key params:(NSDictionary *)params callBackHandler:(CallBackHandler)callBackHandler{

    MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"POST"];
    [op addFile:filePath forKey:key];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {

        //NSDictionary *data = [completedOperation responseJSON];

        NSLog(@"获取无缓存单个实体网络数据-->%@",[completedOperation responseString]);

        NSString *jsonStr = [completedOperation responseString];

        //Result *result = [[Result alloc] initWithString:jsonStr error:nil];

        Result *result = [Result yy_modelWithJSON:jsonStr];

        if (result!=nil) {

            if (result.status==200) {//请求成功
                callBackHandler(200,[clazz yy_modelWithJSON:result.content],@"success");
            }else{//请求失败
                callBackHandler(result.status,nil,result.errorMsg);
            }
        }else{
            callBackHandler(500,nil,@"failed");
        }
    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
        callBackHandler(600,nil,[error localizedDescription]);
    }];

    [singleton enqueueOperation:op];

    return op;
}

-(MKNetworkOperation *) apiModelNoCachePostWithReturn:(Class) clazz apiURL:(NSString *) apiURL params:(NSDictionary *)params callBackHandler:(BOOL(^)(int status,id data,NSString *errorMsg)) callBackHandler{
    MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"POST"];

    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {

        //NSDictionary *data = [completedOperation responseJSON];

        NSLog(@"获取无缓存单个实体网络数据-->%@",[completedOperation responseString]);

        NSString *jsonStr = [completedOperation responseString];

        //Result *result = [[Result alloc] initWithString:jsonStr error:nil];
        Result *result = [Result yy_modelWithJSON:jsonStr];
        if (result!=nil) {

            if (result.status==200) {//请求成功
                callBackHandler(200,[clazz yy_modelWithJSON:result.content],@"success");
            }else{//请求失败
                callBackHandler(result.status,nil,result.errorMsg);
            }
        }else{
            callBackHandler(500,nil,@"failed");
        }

    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
        callBackHandler(600,nil,[error localizedDescription]);
    }];

    [singleton enqueueOperation:op];

    return op;

}

//缓存优先,缓存没有或者过期才获取网络数据,转成成List回调到页面上
-(MKNetworkOperation *) apiListCacheAdvacneGet:(Class) clazz apiURL:(NSString *) apiURL params:(NSDictionary *) params cacheKey:(NSString *)key  callBackHandler:(CallBackHandler) callBackHandler{

    NSData *cacheContent =  [[DataManagerProxy getInstance:FILECACHE] queryData:key];

    //NSLog(@"列表缓存信息%@",[[NSString alloc] initWithData:cacheContent encoding:NSUTF8StringEncoding]);
    if (cacheContent!=nil) {
        //NSString *jsonCache = [[NSString alloc] initWithData:cacheContent encoding:NSUTF8StringEncoding];
        //NSMutableArray *list = [clazz arrayOfModelsFromData:cacheContent error:nil];
        NSMutableArray *list =[NSMutableArray arrayWithArray:[NSArray yy_modelArrayWithClass:clazz json:cacheContent]];
        NSLog(@"缓存不为空");
        callBackHandler(200,list,@"success");
    }else{
        if (cacheContent==nil) {
            NSLog(@"缓存数据为nil");
        }
        // NSLog(@"缓存数据为空");
    }

    MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"GET"];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {

        //NSDictionary *data = [completedOperation responseJSON];
        NSLog(@"获取有缓存列表网络数据-->%@",[completedOperation responseString]);
        NSString *jsonStr = [completedOperation responseString];

        //Result *result = [[Result alloc] initWithString:jsonStr error:nil];
        Result *result = [Result yy_modelWithJSON:jsonStr];
        if (result!=nil) {
            NSLog(@"获取列表结果回来了");
            if (result.status==200) {

                NSData *data = [result.content yy_modelToJSONData];

                NSMutableArray *dataList = [NSMutableArray arrayWithArray:[NSArray yy_modelArrayWithClass:clazz json:data]];
                //NSLog(@"获取列表的长度-->%lu",(unsigned long)[dataList count]);
                if (dataList&&dataList.count>0) {

                    [[DataManagerProxy getInstance:FILECACHE] saveData:data key:key];

                    callBackHandler(200,dataList,@"success");
                }else{
                    callBackHandler(400,nil,@"返回的content中的内容部分json格式不正确");
                }

            }else{
                callBackHandler(result.status,nil,result.errorMsg);
            }

        }else{
            callBackHandler(500,nil,@"failed");

        }

    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
        callBackHandler(600,nil,[error localizedDescription]);
    }];

    [singleton enqueueOperation:op];

    return op;
}

//网络数据优先,返回数据保存下来
-(MKNetworkOperation *) apiListNetAdvacneThenSaveGet:(Class) clazz apiURL:(NSString *) apiURL params:(NSDictionary *) params cacheKey:(NSString *)key  callBackHandler:(CallBackHandler) callBackHandler{

    MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"GET"];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {

        NSLog(@"获取有缓存列表网络数据-->%@",[completedOperation responseString]);
        NSString *jsonStr = [completedOperation responseString];

        Result *result = [Result yy_modelWithJSON:jsonStr];
        if (result!=nil) {
            NSLog(@"获取列表结果回来了");
            if (result.status==200) {
                NSData *data = [result.content yy_modelToJSONData];
                NSMutableArray *dataList = [NSMutableArray arrayWithArray:[NSArray yy_modelArrayWithClass:clazz json:data]];
                [[DataManagerProxy getInstance:FILECACHE] saveData:data key:key];
                callBackHandler(200,dataList,@"success");
            }else{
                callBackHandler(result.status,nil,result.errorMsg);
            }
        }else{
            callBackHandler(500,nil,@"failed");
        }

    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
        callBackHandler(600,nil,[error localizedDescription]);
    }];

    [singleton enqueueOperation:op];

    return op;

}

//网络数据优先,网络无数据显示缓存,转成成List回调到页面上
-(MKNetworkOperation *) apiListNetAdvacneGet:(Class) clazz apiURL:(NSString *) apiURL params:(NSDictionary *) params cacheKey:(NSString *)key  callBackHandler:(CallBackHandler) callBackHandler{

    NSData *cacheContent =  [[DataManagerProxy getInstance:FILECACHE] queryData:key];
    NSMutableArray *list = nil;
    //NSLog(@"列表缓存信息%@",[[NSString alloc] initWithData:cacheContent encoding:NSUTF8StringEncoding]);
    if (cacheContent!=nil) {
        //NSString *jsonCache = [[NSString alloc] initWithData:cacheContent encoding:NSUTF8StringEncoding];
        //NSMutableArray *list = [clazz arrayOfModelsFromData:cacheContent error:nil];
        list =[NSMutableArray arrayWithArray:[NSArray yy_modelArrayWithClass:clazz json:cacheContent]];
        NSLog(@"缓存不为空");
        //callBackHandler(200,list,@"success");
    }else{
        if (cacheContent==nil) {
            NSLog(@"缓存数据为nil");
        }
        // NSLog(@"缓存数据为空");
    }

    MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"GET"];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {

        //NSDictionary *data = [completedOperation responseJSON];
        NSLog(@"获取有缓存列表网络数据-->%@",[completedOperation responseString]);
        NSString *jsonStr = [completedOperation responseString];

        //Result *result = [[Result alloc] initWithString:jsonStr error:nil];
        Result *result = [Result yy_modelWithJSON:jsonStr];
        if (result!=nil) {
            NSLog(@"获取列表结果回来了");
            if (result.status==200) {

                NSData *data = [result.content yy_modelToJSONData];

                //NSMutableArray *dataList = [clazz arrayOfModelsFromData:data error:nil];
                NSMutableArray *dataList = [NSMutableArray arrayWithArray:[NSArray yy_modelArrayWithClass:clazz json:data]];
                //NSLog(@"获取列表的长度-->%lu",(unsigned long)[dataList count]);
                if (dataList&&dataList.count>0) {

                    [[DataManagerProxy getInstance:FILECACHE] saveData:data key:key];

                    callBackHandler(200,dataList,@"success");
                }else{
                    if (list!=nil&&list.count>0) {
                        callBackHandler(200,list,@"success");
                    }else{
                        callBackHandler(400,nil,@"返回的content中的内容部分json格式不正确");
                    }

                }

            }else{
                if (list!=nil&&list.count>0) {
                    callBackHandler(200,list,@"success");
                }else{
                    callBackHandler(result.status,nil,result.errorMsg);
                }
            }

        }else{
            if (list!=nil&&list.count>0) {
                callBackHandler(200,list,@"success");
            }else{
                callBackHandler(500,nil,@"failed");
            }
        }

    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
        if (list!=nil&&list.count>0) {
            callBackHandler(200,list,@"success");
        }else{
            callBackHandler(600,nil,[error localizedDescription]);
        }
    }];

    [singleton enqueueOperation:op];

    return op;
}

//先获取缓存显示页面,再判断缓存是否过期,如过期获取网络数据缓存下来,不再返回页面
-(MKNetworkOperation *) apiListCacheAdvacneThanNetSaveGet:(Class) clazz apiURL:(NSString *) apiURL params:(NSDictionary *) params cacheKey:(NSString *)key  callBackHandler:(CallBackHandler) callBackHandler{

    NSData *cacheContent =  [[DataManagerProxy getInstance:FILECACHE] queryData:key];

    //NSLog(@"列表缓存信息%@",[[NSString alloc] initWithData:cacheContent encoding:NSUTF8StringEncoding]);
    if (cacheContent!=nil) {
        NSLog(@"缓存不为空");
        callBackHandler(200,[NSArray yy_modelArrayWithClass:clazz json:cacheContent],@"success");
    }else{
        if (cacheContent==nil) {
            NSLog(@"缓存数据为nil");
        }
        // NSLog(@"缓存数据为空");
        MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"GET"];
        [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {

            //NSDictionary *data = [completedOperation responseJSON];
            NSLog(@"获取有缓存列表网络数据-->%@",[completedOperation responseString]);
            NSString *jsonStr = [completedOperation responseString];
            // Result *result = [[Result alloc] initWithString:jsonStr error:nil];
            Result *result = [Result yy_modelWithJSON:jsonStr];
            if (result!=nil) {
                if (result.status==200) {
                    NSData *jsondata = [result.content yy_modelToJSONData];
                    //NSMutableArray *dataList = [clazz arrayOfModelsFromData:jsondata error:nil];
                    NSMutableArray *dataList = [NSMutableArray arrayWithArray:[NSArray yy_modelArrayWithClass:clazz json:jsondata]];
                    NSLog(@"获取列表的长度-->%lu",(unsigned long)[dataList count]);
                    if (dataList&&dataList.count>0) {
                        NSData *jsonData = [result.content yy_modelToJSONData];
                        [[DataManagerProxy getInstance:FILECACHE] saveData:jsonData key:key];

                        callBackHandler(200,dataList,@"success");

                    }else{
                        callBackHandler(result.status,dataList,@"list is nil");
                    }
                }else{
                    callBackHandler(result.status,nil,result.errorMsg);
                }

            }else{
                callBackHandler(500,nil,@"failed");

            }

        } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
            callBackHandler(600,nil,[error localizedDescription]);
        }];

        [singleton enqueueOperation:op];

        return op;
    }
    return nil;
}

//先获取缓存显示页面,有缓存返回,没有则获取网络数返回页面,有则据缓存网络数据下来,不再返回页面
-(MKNetworkOperation *) apiListCacheReturnThanNetSaveGet:(Class) clazz apiURL:(NSString *) apiURL params:(NSDictionary *) params cacheKey:(NSString *)key  callBackHandler:(CallBackHandler) callBackHandler{

    //不需要判断过期
    NSData *cacheContent =  [[DataManagerProxy getInstance:FILECACHE] queryData:key];

    //NSLog(@"列表缓存信息%@",[[NSString alloc] initWithData:cacheContent encoding:NSUTF8StringEncoding]);
    if (cacheContent!=nil) {
        NSLog(@"缓存不为空");
        callBackHandler(200,[NSArray yy_modelArrayWithClass:clazz json:cacheContent],@"success");
    }else{
        if (cacheContent==nil) {
            NSLog(@"缓存数据为nil");
        }
        // NSLog(@"缓存数据为空");
    }
    MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"GET"];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {

        //NSDictionary *data = [completedOperation responseJSON];
        NSLog(@"获取有缓存列表网络数据-->%@",[completedOperation responseString]);
        NSString *jsonStr = [completedOperation responseString];
        //Result *result = [[Result alloc] initWithString:jsonStr error:nil];
        Result *result = [Result yy_modelWithJSON:jsonStr];
        if (result!=nil) {
            if (result.status==200) {
                NSData *jsondata = [result.content yy_modelToJSONData];
                //NSMutableArray *dataList = [clazz arrayOfModelsFromData:jsondata error:nil];
                NSMutableArray *dataList = [NSMutableArray arrayWithArray:[NSArray yy_modelArrayWithClass:clazz json:jsondata]];
                NSLog(@"获取列表的长度-->%lu",(unsigned long)[dataList count]);
                if (dataList&&dataList.count>0) {

                    NSData *jsonData = [result.content yy_modelToJSONData];
                    [[DataManagerProxy getInstance:FILECACHE] saveData:jsonData key:key];
                    if (cacheContent==nil||cacheContent.length==0) {
                        callBackHandler(200,dataList,@"success");
                    }

                }else{
                    callBackHandler(300,dataList,@"list is nil");
                }
            }else{
                callBackHandler(result.status,nil,result.errorMsg);
            }

        }else{
            callBackHandler(500,nil,@"failed");

        }

    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
        callBackHandler(600,nil,[error localizedDescription]);
    }];

    [singleton enqueueOperation:op];

    return op;

}

//不考虑缓存,直接获取获取网络数据,转成List回调到页面上
-(MKNetworkOperation *) apiListCacheNoCacheGet:(Class) clazz apiURL:(NSString *) apiURL params:(NSDictionary *) params callBackHandler:(CallBackHandler) callBackHandler{

    MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"GET"];
    //op.stringEncoding = NSUTF8StringEncoding;

    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        //NSDictionary *data = [completedOperation responseJSON];

        NSLog(@"获取无缓存列表网络数据-->%@",[completedOperation responseString]);

        NSString *jsonStr = [completedOperation responseString];
        //Result *result = [[Result alloc] initWithString:jsonStr error:nil];
        Result *result = [Result yy_modelWithJSON:jsonStr];
        if (result!=nil) {

            if (result.status==200) {

                NSMutableArray *clazzList = [NSMutableArray arrayWithArray:[NSArray yy_modelArrayWithClass:clazz json:result.content]];
                //NSData *jsondata = [result.content dataUsingEncoding:NSUTF8StringEncoding];
                //NSMutableArray *clazzList = [clazz arrayOfModelsFromData:jsondata error:nil];
                if (clazzList&&clazzList.count>0) {
                    callBackHandler(200,clazzList,@"success");
                }else{
                    callBackHandler(300,nil,@"clazzList is empty");
                }
            }else{
                callBackHandler(result.status,nil,result.errorMsg);
            }
        }else{
            callBackHandler(500,nil,@"failed");
        }

    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
        //NSString *string = error.localizedDescription;

        callBackHandler(600,nil,[error localizedDescription]);
    }];

    [singleton enqueueOperation:op];

    return op;

}

//不考虑缓存,直接获取获取网络数据,转成List回调到页面上[POST]
-(MKNetworkOperation *) apiListCacheNoCachePost:(Class) clazz apiURL:(NSString *) apiURL params:(NSDictionary *) params callBackHandler:(CallBackHandler) callBackHandler{

    MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"POST"];

    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        //NSDictionary *data = [completedOperation responseJSON];

        NSLog(@"获取无缓存列表网络数据-->%@",[completedOperation responseString]);

        NSString *jsonStr = [completedOperation responseString];
        //Result *result = [[Result alloc] initWithString:jsonStr error:nil];
        Result *result = [Result yy_modelWithJSON:jsonStr];
        if (result!=nil) {

            if (result.status==200) {
                NSData *jsondata = [result.content dataUsingEncoding:NSUTF8StringEncoding];

                NSMutableArray *clazzList = [NSMutableArray arrayWithArray:[NSArray yy_modelArrayWithClass:clazz json:jsondata]];
                if (clazzList&&clazzList.count>0) {
                    callBackHandler(200,clazzList,@"success");
                }else{
                    callBackHandler(300,nil,@"clazzList is empty");
                }
            }else{
                callBackHandler(result.status,nil,result.errorMsg);
            }
        }else{
            callBackHandler(500,nil,@"failed");
        }

    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
        callBackHandler(600,nil,[error localizedDescription]);
    }];

    [singleton enqueueOperation:op];

    return op;

}

-(MKNetworkOperation *) apiJustResultNetWithURL:(NSString *) apiURL param:(NSDictionary *) params callBackHandler:(CallBackHandler) callBackHandler {
    MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"GET"];

    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {

        NSString *string = [completedOperation responseString];
        NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];

        [[DataManagerProxy getInstance:FILECACHE] saveData:data key:@"temple"];
        data =  [[DataManagerProxy getInstance:FILECACHE] queryData:@"temple"];

        Result *result = [Result yy_modelWithJSON:data];
        NSLog(@"获取无缓存列表网络数据-->%@",string);

        if (result!=nil) {
            callBackHandler(result.status,result,result.errorMsg);
        }else{
            callBackHandler(500,nil,@"failed");
        }

    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
        callBackHandler(600,nil,[error localizedDescription]);
    }];

    [singleton enqueueOperation:op];

    return op;
}

-(MKNetworkOperation *) apiJustResultNetWithURLPost:(NSString *) apiURL param:(NSDictionary *) params callBackHandler:(CallBackHandler) callBackHandler {
    MKNetworkOperation *op = [singleton operationWithPath:apiURL params:params httpMethod:@"POST"];

    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {

        NSString *string = [completedOperation responseString];

        //Result *result = [[Result alloc] initWithString:string error:nil];
        Result *result = [Result yy_modelWithJSON:string];
        NSLog(@"获取无缓存列表网络数据-->%@",string);

        if (result!=nil) {
            callBackHandler(result.status,result,result.errorMsg);
        }else{
            callBackHandler(500,nil,@"failed");
        }

    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
        callBackHandler(600,nil,[error localizedDescription]);
    }];

    [singleton enqueueOperation:op];

    return op;
}

+ (PlutoAPIEngine *) getInstance{

    @synchronized(self)
    {
        if (!singleton) {
            //NSLog(@"PlutoAPIEngine-->%@",SERVER_DOMAIN);
            singleton = [[self alloc] initWithHostName:[Pluto getInstance].URL_DOMAIN];
        }
    }
    return singleton;
}

//这里重写allocWithZone主要防止[[SysInfoParam alloc] init]这种方式调用多次会返回多个对象
+ (id)allocWithZone:(NSZone *)zone
{
    @synchronized(self){
        if (!singleton) {
            singleton = [super allocWithZone:zone];
            return singleton;
        }
    }
    return nil;
}

@end


text:
'use strict';

import {should as should_} from 'chai';
const should = should_();
import {spy, stub} from 'sinon';
import nodemailer from 'nodemailer';
import uuid from 'node-uuid';
import login from '../../server/login';
import user from '../../server/user';

const SOCKET_ID = 'TESTING_SOCKET';
const [USER, PASS, EMAIL, VALIDATION_KEY] = [':)', ':)', 'a@b.c', 'TESTING_VALIDATION_KEY'];
const [BAD_USER, BAD_PASS, BAD_EMAIL, BAD_VALIDATION_KEY] = [':(', ':(', 'd@e.f', 'null'];
const [NEW_USER, NEW_PASS, NEW_EMAIL] = ['test_a', 'secretpassword', 'test@test.com'];

const socket = { on: stub(), id: SOCKET_ID };
const sendMail = {
    sendMail() { return Promise.resolve(); }
};
const stubmailer = stub(nodemailer, 'createTransport').returns(sendMail);
after(() => {
    stubmailer.restore();
});

const events = {
    'login:login': [{
        args: {username: USER, password: PASS},
        after() {
            user.removeUser(USER);
        },
        tests(response) {
            describe('when the credentials are correct,', () => {
                it('should call response with no errors', () => {
                    response.should.have.been.calledOnce;
                    should.not.exist(response.args[0][0]);
                });
                it('should add the user to the currently connected users', () => {
                    user.socketUser(socket).should.equal(USER);
                });
            });
        }
    }, {
        args: {username: USER, password: BAD_PASS},
        tests(response) {
            describe('when the password is incorrect,', () => {
                it('should call response with an error message', () => {
                    response.should.have.been.calledOnce;
                    response.args[0][0].should.be.a('string');
                });
            });
        }
    }, {
        args: {username: BAD_USER, password: PASS},
        tests(response) {
            describe('when the username is incorrect,', () => {
                it('should call response with an error message', () => {
                    response.should.have.been.calledOnce;
                    response.args[0][0].should.be.a('string');
                });
            });
        }
    }],
    'login:sign-up': [{
        args: {username: USER, password: PASS, email: EMAIL},
        tests(response) {
            describe.skip('when the information is valid,', () => {
                it('should call response with no errors', () => {
                    response.should.have.been.calledOnce;
                    should.not.exist(response.args[0][0]);
                });
            });
        }
    }, {
        args: {username: USER, password: PASS, email: EMAIL},
        tests(response) {
            describe('when the user exists already,', () => {
                it('should call response with an error message', () => {
                    response.should.have.been.calledOnce;
                    response.args[0][0].should.be.a('string');
                });
            });
        }
    }, {
        args: {username: BAD_USER, password: BAD_PASS, email: BAD_EMAIL},
        tests(response) {
            describe('when the new account values are not valid,', () => {
                it('should call response with an error', () => {
                    response.should.have.been.calledOnce;
                    response.args[0][0].should.be.a('string');
                });
            });
        }
    }],
    'login:forgot-password': [{
        args: {username: USER, email: EMAIL},
        before() {
            this.beforeCount = stubmailer.callCount;
            stub(uuid, 'v4').returns(VALIDATION_KEY);
        },
        after() {
            uuid.v4.restore();
        },
        tests(response) {
            describe('when the username and email are correct,', () => {
                it('should call response with no errors', () => {
                    response.should.have.been.calledOnce;
                    should.not.exist(response.args[0][0]);
                });
                it.skip('should try to send an email', () => {
                    this.beforeCount.should.equal(stubmailer.callCount - 1);
                });
            });
        }
    }, {
        args: {username: BAD_USER, email: EMAIL},
        before() {
            this.beforeCount = stubmailer.callCount;
        },
        tests(response) {
            describe('when the user does not exist,', () => {
                it('should call response with an error message', () => {
                    response.should.have.been.calledOnce;
                    response.args[0][0].should.be.a('string');
                });
                it('should not try to send an email', () => {
                    stubmailer.callCount.should.equal(this.beforeCount);
                });
            });
        }
    }, {
        args: {username: USER, email: BAD_EMAIL},
        before() {
            this.beforeCount = stubmailer.callCount;
        },
        tests(response) {
            describe('when the email is incorrect,', () => {
                it('should call response with an error message', () => {
                    response.should.have.been.calledOnce;
                    response.args[0][0].should.be.a('string');
                });
                it('should not try to send an email', () => {
                    stubmailer.callCount.should.equal(this.beforeCount);
                });
            });
        }
    }],
    'login:reset-password': [{
        args: {username: USER, password: PASS, validation_key: VALIDATION_KEY},
        tests(response) {
            describe('when the username and validation_key are correct,', () => {
                it('should call response with no errors', () => {
                    response.should.have.been.calledOnce;
                    should.not.exist(response.args[0][0]);
                });
            });
        }
    }, {
        args: {username: BAD_USER, password: PASS, validation_key: VALIDATION_KEY},
        tests(response) {
            describe('when the username is incorrect,', () => {
                it('should call response with an error', () => {
                    response.should.have.been.calledOnce;
                    response.args[0][0].should.be.a('string');
                });
            });
        }
    }, {
        args: {username: USER, password: PASS, validation_key: BAD_VALIDATION_KEY},
        tests(response) {
            describe('when the validation_key is incorrect,', () => {
                it('should call response with an error', () => {
                    response.should.have.been.calledOnce;
                    response.args[0][0].should.be.a('string');
                });
            });
        }
    }]
};

describe('login', () => {
    before(() => {
        // Initialize the fake socket with the login events
        login(socket);
    });
    describe('should create a handler for each of:', () => {
        Object.keys(events).forEach((eventName) => {
            describe(`'${eventName}', which,`, () => {
                events[eventName].forEach((set) => {
                    const response = spy();

                    // Run the callback before the tests are run
                    before((done) => {
                        set.before && set.before();
                        // Find the corresponding callback
                        for(let i = 0; i < socket.on.callCount; i++) {
                            if(socket.on.args[i][0] === eventName) {
                                // And call it
                                socket.on.args[i][1](set.args, (...res) => {response(...res); done();});
                                break;
                            }
                        }
                    });
                    beforeEach(() => set.beforeEach && set.beforeEach());
                    afterEach(() => set.afterEach && set.afterEach());
                    after(() => set.after && set.after());

                    // Prepare the tests
                    set.tests && set.tests(response);
                });
            });
        });
    });
});


text:
import os
import sys
import falcon_config as fc
import subprocess
cmd = sys.argv[0]
prg, base_dir = fc.resolve_sym_link(os.path.abspath(cmd))
service_status_cmd = os.path.join(base_dir, 'bin', 'service_status.py')
subprocess.call(['python', service_status_cmd, 'prism'])


text:
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;
    return { next: verb(0), "throw": verb(1), "return": verb(2) };
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [0, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
var OrderProcessor_1 = require("./OrderProcessor");
var Repository_1 = require("./Repository");
var processor = new OrderProcessor_1.OrderProcessor(new Repository_1.Repository());
function retrieve(event, context, callback) {
    return __awaiter(this, void 0, void 0, function () {
        var orders, error_1;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    _a.trys.push([0, 2, , 3]);
                    return [4 /*yield*/, processor.retrieve()];
                case 1:
                    orders = _a.sent();
                    console.log("got " + orders.length + " orders");
                    callback(null, createSuccessResponse(orders));
                    return [3 /*break*/, 3];
                case 2:
                    error_1 = _a.sent();
                    console.log(error_1);
                    callback(null, createInternalServerErrorResponse("failed to retrieve orders!"));
                    return [3 /*break*/, 3];
                case 3: return [2 /*return*/];
            }
        });
    });
}
exports.retrieve = retrieve;
function createSuccessResponse(data) {
    return {
        body: data == null ? null : JSON.stringify(data),
        headers: getDefaultHeader(),
        statusCode: 200,
    };
}
function createInternalServerErrorResponse(message) {
    return {
        body: JSON.stringify({
            error: message,
        }),
        headers: getDefaultHeader(),
        statusCode: 500,
    };
}
function getDefaultHeader() {
    return _a = {},
        _a["Content-Type"] = "application/json",
        _a;
    var _a;
}
//# sourceMappingURL=Handler.js.map


text:
const babel = require('babel-core');
const content = `
import React, {PropTypes} from 'react';

type AlbumCardProps = {
  data: {
    stats: {
      images: number,
      videos: number,
      reposts: number,
      shares: number,
      stashes: number,
      likes: number,
      comments: number
    },
    title: string,
    coverImage: {
      id: string,
      src: string
    },
    description: string,
    userIsFollowing: true | false,
  }
}

export default
class AlbumCard extends React.Component {
  props: AlbumCardProps;

  render() {
    return (
      <Box>

      </Box>
    );
  }
}
`;

it('real', () => {
  const res = babel.transform(content, {
    babelrc: false,
    presets: ['@babel/env', '@babel/react', '@babel/flow'],
    plugins: [
      '@babel/syntax-flow',
      require('../'),
      "@babel/plugin-proposal-class-properties"
    ],
  }).code;
  expect(res).toMatchSnapshot();
});


text:
<!DOCTYPE html>

One

[Two

Three]

Four


text:
/* jshint laxcomma: true */
var utils = require('./utils');

exports.C14nCanonicalization = C14nCanonicalization;
exports.C14nCanonicalizationWithComments = C14nCanonicalizationWithComments;

function C14nCanonicalization() {
	this.includeComments = false;
};

C14nCanonicalization.prototype.attrCompare = function(a,b) {
  if (!a.namespaceURI && b.namespaceURI) { return -1; }
  if (!b.namespaceURI && a.namespaceURI) { return 1; }

  var left = a.namespaceURI + a.localName
  var right = b.namespaceURI + b.localName

  if (left===right) return 0
  else if (left<right) return -1
  else return 1

};

C14nCanonicalization.prototype.nsCompare = function(a,b) {
  var attr1 = a.prefix;
  var attr2 = b.prefix;
  if (attr1 == attr2) { return 0; }
  return attr1.localeCompare(attr2);
};

C14nCanonicalization.prototype.renderAttrs = function(node, defaultNS) {
  var a, i, attr
    , res = []
    , attrListToRender = [];

  if (node.nodeType===8) { return this.renderComment(node); }

  if (node.attributes) {
    for (i = 0; i < node.attributes.length; ++i) {
      attr = node.attributes[i];
      //ignore namespace definition attributes
      if (attr.name.indexOf("xmlns") === 0) { continue; }
      attrListToRender.push(attr);
    }
  }

  attrListToRender.sort(this.attrCompare);

  for (a in attrListToRender) {
    if (!attrListToRender.hasOwnProperty(a)) { continue; }

    attr = attrListToRender[a];
    res.push(" ", attr.name, '="', utils.encodeSpecialCharactersInAttribute(attr.value), '"');
  }

  return res.join("");
};

/**
 * Create the string of all namespace declarations that should appear on this element
 *
 * @param {Node} node. The node we now render
 * @param {Array} prefixesInScope. The prefixes defined on this node
 *                parents which are a part of the output set
 * @param {String} defaultNs. The current default namespace
 * @param {String} defaultNsForPrefix.
 * @param {String} ancestorNamespaces - Import ancestor namespaces if it is specified
 * @return {String}
 * @api private
 */
C14nCanonicalization.prototype.renderNs = function(node, prefixesInScope, defaultNs, defaultNsForPrefix, ancestorNamespaces) {
  var a, i, p, attr
    , res = []
    , newDefaultNs = defaultNs
    , nsListToRender = []
    , currNs = node.namespaceURI || "";

  //handle the namespaceof the node itself
  if (node.prefix) {
    if (prefixesInScope.indexOf(node.prefix)==-1) {
      nsListToRender.push({"prefix": node.prefix, "namespaceURI": node.namespaceURI || defaultNsForPrefix[node.prefix]});
      prefixesInScope.push(node.prefix);
    }
  }
  else if (defaultNs!=currNs) {
      //new default ns
      newDefaultNs = node.namespaceURI;
      res.push(' xmlns="', newDefaultNs, '"');
  }

  //handle the attributes namespace
  if (node.attributes) {
    for (i = 0; i < node.attributes.length; ++i) {
      attr = node.attributes[i];

      //handle all prefixed attributes that are included in the prefix list and where
      //the prefix is not defined already. New prefixes can only be defined by `xmlns:`.
      if (attr.prefix === "xmlns" && prefixesInScope.indexOf(attr.localName) === -1) {
        nsListToRender.push({"prefix": attr.localName, "namespaceURI": attr.value});
        prefixesInScope.push(attr.localName);
      }

      //handle all prefixed attributes that are not xmlns definitions and where
      //the prefix is not defined already
      if (attr.prefix && prefixesInScope.indexOf(attr.prefix)==-1 && attr.prefix!="xmlns" && attr.prefix!="xml") {
        nsListToRender.push({"prefix": attr.prefix, "namespaceURI": attr.namespaceURI});
        prefixesInScope.push(attr.prefix);
      }
    }
  }

  if(Array.isArray(ancestorNamespaces) && ancestorNamespaces.length > 0){
    // Remove namespaces which are already present in nsListToRender
    for(var p1 in ancestorNamespaces){
      if(!ancestorNamespaces.hasOwnProperty(p1)) continue;
      var alreadyListed = false;
      for(var p2 in nsListToRender){
        if(nsListToRender[p2].prefix === ancestorNamespaces[p1].prefix
          && nsListToRender[p2].namespaceURI === ancestorNamespaces[p1].namespaceURI)
        {
          alreadyListed = true;
        }
      }

      if(!alreadyListed){
        nsListToRender.push(ancestorNamespaces[p1]);
      }
    }
  }

  nsListToRender.sort(this.nsCompare);

  //render namespaces
  for (a in nsListToRender) {
    if (!nsListToRender.hasOwnProperty(a)) { continue; }

    p = nsListToRender[a];
    res.push(" xmlns:", p.prefix, '="', p.namespaceURI, '"');
  }

  return {"rendered": res.join(""), "newDefaultNs": newDefaultNs};
};

C14nCanonicalization.prototype.processInner = function(node, prefixesInScope, defaultNs, defaultNsForPrefix, ancestorNamespaces) {

  if (node.nodeType === 8) { return this.renderComment(node); }
  if (node.data) { return utils.encodeSpecialCharactersInText(node.data); }

  var i, pfxCopy
    , ns = this.renderNs(node, prefixesInScope, defaultNs, defaultNsForPrefix, ancestorNamespaces)
    , res = ["<", node.tagName, ns.rendered, this.renderAttrs(node, ns.newDefaultNs), ">"];

  for (i = 0; i < node.childNodes.length; ++i) {
    pfxCopy = prefixesInScope.slice(0);
    res.push(this.processInner(node.childNodes[i], pfxCopy, ns.newDefaultNs, defaultNsForPrefix, []));
  }

  res.push("</", node.tagName, ">");
  return res.join("");
};

// Thanks to deoxxa/xml-c14n for comment renderer
C14nCanonicalization.prototype.renderComment = function (node) {

  if (!this.includeComments) { return ""; }

  var isOutsideDocument = (node.ownerDocument === node.parentNode),
      isBeforeDocument = null,
      isAfterDocument = null;

  if (isOutsideDocument) {
    var nextNode = node,
        previousNode = node;

    while (nextNode !== null) {
      if (nextNode === node.ownerDocument.documentElement) {
        isBeforeDocument = true;
        break;
      }

      nextNode = nextNode.nextSibling;
    }

    while (previousNode !== null) {
      if (previousNode === node.ownerDocument.documentElement) {
        isAfterDocument = true;
        break;
      }

      previousNode = previousNode.previousSibling;
    }
  }

  return (isAfterDocument ? "\n" : "") + "<!--" + utils.encodeSpecialCharactersInText(node.data) + "-->" + (isBeforeDocument ? "\n" : "");
};

/**
 * Perform canonicalization of the given node
 *
 * @param {Node} node
 * @return {String}
 * @api public
 */
C14nCanonicalization.prototype.process = function(node, options) {
  options = options || {};
  var defaultNs = options.defaultNs || "";
  var defaultNsForPrefix = options.defaultNsForPrefix || {};
  var ancestorNamespaces = options.ancestorNamespaces || [];

  var prefixesInScope = [];
  for (var i = 0; i < ancestorNamespaces.length; i++) {
    prefixesInScope.push(ancestorNamespaces[i].prefix);
  }

  var res = this.processInner(node, prefixesInScope, defaultNs, defaultNsForPrefix, ancestorNamespaces);
  return res;
};

C14nCanonicalization.prototype.getAlgorithmName = function() {
  return "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
};

// Add c14n#WithComments here (very simple subclass)
exports.C14nCanonicalizationWithComments = C14nCanonicalizationWithComments;

function C14nCanonicalizationWithComments() {
	C14nCanonicalization.call(this);
	this.includeComments = true;
};

C14nCanonicalizationWithComments.prototype = Object.create(C14nCanonicalization.prototype);

C14nCanonicalizationWithComments.prototype.constructor = C14nCanonicalizationWithComments;

C14nCanonicalizationWithComments.prototype.getAlgorithmName = function() {
  return "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";
};


text:
<?php

namespace EventCentric\When;

use EventCentric\DomainEvents\DomainEvent;
use EventCentric\DomainEvents\DomainEvents;
use Verraes\ClassFunctions\ClassFunctions;

trait ConventionalWhen
{
    use When;

    /**
     * @param DomainEvent $event
     * @return void
     */
    protected function when(DomainEvent $event)
    {
        $method = 'when' . ClassFunctions::short($event);
        if(is_callable([$this, $method])) {
            $this->{$method}($event);
        }
    }

    /**
     * @param DomainEvents $events
     * @return void
     */
    protected function whenAll(DomainEvents $events)
    {
        foreach($events as $event) {
            $this->when($event);
        }
    }
}


text:
package com.hazelcast.client.impl;

import com.hazelcast.client.impl.operations.GetConnectedClientsOperation;
import com.hazelcast.client.impl.operations.OperationFactoryWrapper;
import com.hazelcast.internal.serialization.DataSerializerHook;
import com.hazelcast.internal.serialization.impl.FactoryIdHelper;
import com.hazelcast.nio.serialization.DataSerializableFactory;
import com.hazelcast.nio.serialization.IdentifiedDataSerializable;

import static com.hazelcast.internal.serialization.impl.FactoryIdHelper.CLIENT_DS_FACTORY;
import static com.hazelcast.internal.serialization.impl.FactoryIdHelper.CLIENT_DS_FACTORY_ID;

public class ClientDataSerializerHook implements DataSerializerHook {

    public static final int F_ID = FactoryIdHelper.getFactoryId(CLIENT_DS_FACTORY, CLIENT_DS_FACTORY_ID);

    public static final int GET_CONNECTED_CLIENTS = 2;
    public static final int OP_FACTORY_WRAPPER = 4;

    @Override
    public int getFactoryId() {
        return F_ID;
    }

    @Override
    public DataSerializableFactory createFactory() {
        return new DataSerializableFactory() {
            @Override
            public IdentifiedDataSerializable create(int typeId) {
                switch (typeId) {
                    case GET_CONNECTED_CLIENTS:
                        return new GetConnectedClientsOperation();
                    case OP_FACTORY_WRAPPER:
                        return new OperationFactoryWrapper();
                    default:
                        return null;
                }
            }
        };
    }

}


text:
//%LICENSE////////////////////////////////////////////////////////////////
//
// Licensed to The Open Group (TOG) under one or more contributor license
// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
// this work for additional information regarding copyright ownership.
// Each contributor licenses this file to you under the OpenPegasus Open
// Source License; you may not use this file except in compliance with the
// License.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////
//
//%/////////////////////////////////////////////////////////////////////////

UNIX_FilterEntryInSystem::UNIX_FilterEntryInSystem(void)
{
}

UNIX_FilterEntryInSystem::~UNIX_FilterEntryInSystem(void)
{
}

Boolean UNIX_FilterEntryInSystem::getGroupComponent(CIMProperty &p) const
{
	p = CIMProperty(PROPERTY_GROUP_COMPONENT, getGroupComponent());
	return true;
}

CIMInstance UNIX_FilterEntryInSystem::getGroupComponent() const
{
	return CIMInstance(CIMName("CIM_Component"));
}

Boolean UNIX_FilterEntryInSystem::getPartComponent(CIMProperty &p) const
{
	p = CIMProperty(PROPERTY_PART_COMPONENT, getPartComponent());
	return true;
}

CIMInstance UNIX_FilterEntryInSystem::getPartComponent() const
{
	return CIMInstance(CIMName("CIM_Component"));
}

Boolean UNIX_FilterEntryInSystem::initialize()
{
	groupIndex = -1;
	partIndex = 0;
	group_UNIX_VirtualComputerSystem_Index = -1;
	endOf_UNIX_VirtualComputerSystem_Group = false;
	group_UNIX_VirtualComputerSystem_Component.initialize();
	group_UNIX_ComputerSystem_Index = -1;
	endOf_UNIX_ComputerSystem_Group = false;
	group_UNIX_ComputerSystem_Component.initialize();
	group_UNIX_Cluster_Index = -1;
	endOf_UNIX_Cluster_Group = false;
	group_UNIX_Cluster_Component.initialize();
	part_UNIX_X509CredentialFilterEntry_Index = -1;
	endOf_UNIX_X509CredentialFilterEntry_Part = false;
	part_UNIX_FilterEntry_Index = -1;
	endOf_UNIX_FilterEntry_Part = false;
	part_UNIX_PreambleFilter_Index = -1;
	endOf_UNIX_PreambleFilter_Part = false;
	part_UNIX_PeerIDPayloadFilterEntry_Index = -1;
	endOf_UNIX_PeerIDPayloadFilterEntry_Part = false;
	part_UNIX_Hdr8021Filter_Index = -1;
	endOf_UNIX_Hdr8021Filter_Part = false;
	part_UNIX_IPSOFilterEntry_Index = -1;
	endOf_UNIX_IPSOFilterEntry_Part = false;
	part_UNIX_IPHeadersFilter_Index = -1;
	endOf_UNIX_IPHeadersFilter_Part = false;
	return true;
}

Boolean UNIX_FilterEntryInSystem::load(int &pIndex)
{
	if (pIndex == 0 || (endOf_UNIX_X509CredentialFilterEntry_Part &&
			endOf_UNIX_FilterEntry_Part &&
			endOf_UNIX_PreambleFilter_Part &&
			endOf_UNIX_PeerIDPayloadFilterEntry_Part &&
			endOf_UNIX_Hdr8021Filter_Part &&
			endOf_UNIX_IPSOFilterEntry_Part &&
			endOf_UNIX_IPHeadersFilter_Part))
	{
		if (groupIndex == 0)
		{
			group_UNIX_VirtualComputerSystem_Index++;
			endOf_UNIX_VirtualComputerSystem_Group = !group_UNIX_VirtualComputerSystem_Component.load(group_UNIX_VirtualComputerSystem_Index);
			if (endOf_UNIX_VirtualComputerSystem_Group)
			{
				endOf_UNIX_X509CredentialFilterEntry_Part = false;
				part_UNIX_X509CredentialFilterEntry_Component.setScope(CIMName("UNIX_VirtualComputerSystem"));
				part_UNIX_X509CredentialFilterEntry_Component.initialize();
				endOf_UNIX_FilterEntry_Part = false;
				part_UNIX_FilterEntry_Component.setScope(CIMName("UNIX_VirtualComputerSystem"));
				part_UNIX_FilterEntry_Component.initialize();
				endOf_UNIX_PreambleFilter_Part = false;
				part_UNIX_PreambleFilter_Component.setScope(CIMName("UNIX_VirtualComputerSystem"));
				part_UNIX_PreambleFilter_Component.initialize();
				endOf_UNIX_PeerIDPayloadFilterEntry_Part = false;
				part_UNIX_PeerIDPayloadFilterEntry_Component.setScope(CIMName("UNIX_VirtualComputerSystem"));
				part_UNIX_PeerIDPayloadFilterEntry_Component.initialize();
				endOf_UNIX_Hdr8021Filter_Part = false;
				part_UNIX_Hdr8021Filter_Component.setScope(CIMName("UNIX_VirtualComputerSystem"));
				part_UNIX_Hdr8021Filter_Component.initialize();
				endOf_UNIX_IPSOFilterEntry_Part = false;
				part_UNIX_IPSOFilterEntry_Component.setScope(CIMName("UNIX_VirtualComputerSystem"));
				part_UNIX_IPSOFilterEntry_Component.initialize();
				endOf_UNIX_IPHeadersFilter_Part = false;
				part_UNIX_IPHeadersFilter_Component.setScope(CIMName("UNIX_VirtualComputerSystem"));
				part_UNIX_IPHeadersFilter_Component.initialize();
				partIndex = 0;
				groupIndex++;
			}
		}
		else if (groupIndex == 1)
		{
			group_UNIX_ComputerSystem_Index++;
			endOf_UNIX_ComputerSystem_Group = !group_UNIX_ComputerSystem_Component.load(group_UNIX_ComputerSystem_Index);
			if (endOf_UNIX_ComputerSystem_Group)
			{
				endOf_UNIX_X509CredentialFilterEntry_Part = false;
				part_UNIX_X509CredentialFilterEntry_Component.setScope(CIMName("UNIX_ComputerSystem"));
				part_UNIX_X509CredentialFilterEntry_Component.initialize();
				endOf_UNIX_FilterEntry_Part = false;
				part_UNIX_FilterEntry_Component.setScope(CIMName("UNIX_ComputerSystem"));
				part_UNIX_FilterEntry_Component.initialize();
				endOf_UNIX_PreambleFilter_Part = false;
				part_UNIX_PreambleFilter_Component.setScope(CIMName("UNIX_ComputerSystem"));
				part_UNIX_PreambleFilter_Component.initialize();
				endOf_UNIX_PeerIDPayloadFilterEntry_Part = false;
				part_UNIX_PeerIDPayloadFilterEntry_Component.setScope(CIMName("UNIX_ComputerSystem"));
				part_UNIX_PeerIDPayloadFilterEntry_Component.initialize();
				endOf_UNIX_Hdr8021Filter_Part = false;
				part_UNIX_Hdr8021Filter_Component.setScope(CIMName("UNIX_ComputerSystem"));
				part_UNIX_Hdr8021Filter_Component.initialize();
				endOf_UNIX_IPSOFilterEntry_Part = false;
				part_UNIX_IPSOFilterEntry_Component.setScope(CIMName("UNIX_ComputerSystem"));
				part_UNIX_IPSOFilterEntry_Component.initialize();
				endOf_UNIX_IPHeadersFilter_Part = false;
				part_UNIX_IPHeadersFilter_Component.setScope(CIMName("UNIX_ComputerSystem"));
				part_UNIX_IPHeadersFilter_Component.initialize();
				partIndex = 0;
				groupIndex++;
			}
		}
		else if (groupIndex == 2)
		{
			group_UNIX_Cluster_Index++;
			endOf_UNIX_Cluster_Group = !group_UNIX_Cluster_Component.load(group_UNIX_Cluster_Index);
			if (endOf_UNIX_Cluster_Group)
			{
				endOf_UNIX_X509CredentialFilterEntry_Part = false;
				part_UNIX_X509CredentialFilterEntry_Component.setScope(CIMName("UNIX_Cluster"));
				part_UNIX_X509CredentialFilterEntry_Component.initialize();
				endOf_UNIX_FilterEntry_Part = false;
				part_UNIX_FilterEntry_Component.setScope(CIMName("UNIX_Cluster"));
				part_UNIX_FilterEntry_Component.initialize();
				endOf_UNIX_PreambleFilter_Part = false;
				part_UNIX_PreambleFilter_Component.setScope(CIMName("UNIX_Cluster"));
				part_UNIX_PreambleFilter_Component.initialize();
				endOf_UNIX_PeerIDPayloadFilterEntry_Part = false;
				part_UNIX_PeerIDPayloadFilterEntry_Component.setScope(CIMName("UNIX_Cluster"));
				part_UNIX_PeerIDPayloadFilterEntry_Component.initialize();
				endOf_UNIX_Hdr8021Filter_Part = false;
				part_UNIX_Hdr8021Filter_Component.setScope(CIMName("UNIX_Cluster"));
				part_UNIX_Hdr8021Filter_Component.initialize();
				endOf_UNIX_IPSOFilterEntry_Part = false;
				part_UNIX_IPSOFilterEntry_Component.setScope(CIMName("UNIX_Cluster"));
				part_UNIX_IPSOFilterEntry_Component.initialize();
				endOf_UNIX_IPHeadersFilter_Part = false;
				part_UNIX_IPHeadersFilter_Component.setScope(CIMName("UNIX_Cluster"));
				part_UNIX_IPHeadersFilter_Component.initialize();
				partIndex = 0;
				groupIndex++;
			}
		}
	}
	if (partIndex == 0)
	{
		part_UNIX_X509CredentialFilterEntry_Index++;
	endOf_UNIX_X509CredentialFilterEntry_Part = !part_UNIX_X509CredentialFilterEntry_Component.load(part_UNIX_X509CredentialFilterEntry_Index);
	}
	if (partIndex == 1)
	{
		part_UNIX_FilterEntry_Index++;
	endOf_UNIX_FilterEntry_Part = !part_UNIX_FilterEntry_Component.load(part_UNIX_FilterEntry_Index);
	}
	if (partIndex == 2)
	{
		part_UNIX_PreambleFilter_Index++;
	endOf_UNIX_PreambleFilter_Part = !part_UNIX_PreambleFilter_Component.load(part_UNIX_PreambleFilter_Index);
	}
	if (partIndex == 3)
	{
		part_UNIX_PeerIDPayloadFilterEntry_Index++;
	endOf_UNIX_PeerIDPayloadFilterEntry_Part = !part_UNIX_PeerIDPayloadFilterEntry_Component.load(part_UNIX_PeerIDPayloadFilterEntry_Index);
	}
	if (partIndex == 4)
	{
		part_UNIX_Hdr8021Filter_Index++;
	endOf_UNIX_Hdr8021Filter_Part = !part_UNIX_Hdr8021Filter_Component.load(part_UNIX_Hdr8021Filter_Index);
	}
	if (partIndex == 5)
	{
		part_UNIX_IPSOFilterEntry_Index++;
	endOf_UNIX_IPSOFilterEntry_Part = !part_UNIX_IPSOFilterEntry_Component.load(part_UNIX_IPSOFilterEntry_Index);
	}
	if (partIndex == 6)
	{
		part_UNIX_IPHeadersFilter_Index++;
	endOf_UNIX_IPHeadersFilter_Part = !part_UNIX_IPHeadersFilter_Component.load(part_UNIX_IPHeadersFilter_Index);
	}
	if (partIndex == 0 && endOf_UNIX_X509CredentialFilterEntry_Part)
	{
		part_UNIX_X509CredentialFilterEntry_Component.finalize();
		partIndex++;
	}
	if (partIndex == 1 && endOf_UNIX_FilterEntry_Part)
	{
		part_UNIX_FilterEntry_Component.finalize();
		partIndex++;
	}
	if (partIndex == 2 && endOf_UNIX_PreambleFilter_Part)
	{
		part_UNIX_PreambleFilter_Component.finalize();
		partIndex++;
	}
	if (partIndex == 3 && endOf_UNIX_PeerIDPayloadFilterEntry_Part)
	{
		part_UNIX_PeerIDPayloadFilterEntry_Component.finalize();
		partIndex++;
	}
	if (partIndex == 4 && endOf_UNIX_Hdr8021Filter_Part)
	{
		part_UNIX_Hdr8021Filter_Component.finalize();
		partIndex++;
	}
	if (partIndex == 5 && endOf_UNIX_IPSOFilterEntry_Part)
	{
		part_UNIX_IPSOFilterEntry_Component.finalize();
		partIndex++;
	}
	if (partIndex == 6 && endOf_UNIX_IPHeadersFilter_Part)
	{
		part_UNIX_IPHeadersFilter_Component.finalize();
		partIndex++;
	}

	if (endOf_UNIX_VirtualComputerSystem_Group &&
		endOf_UNIX_ComputerSystem_Group &&
		endOf_UNIX_Cluster_Group &&
		endOf_UNIX_X509CredentialFilterEntry_Part &&
		endOf_UNIX_FilterEntry_Part &&
		endOf_UNIX_PreambleFilter_Part &&
		endOf_UNIX_PeerIDPayloadFilterEntry_Part &&
		endOf_UNIX_Hdr8021Filter_Part &&
		endOf_UNIX_IPSOFilterEntry_Part &&
		endOf_UNIX_IPHeadersFilter_Part)		return false;
	return true;
}

Boolean UNIX_FilterEntryInSystem::finalize()
{
	group_UNIX_VirtualComputerSystem_Component.finalize();
	group_UNIX_ComputerSystem_Component.finalize();
	group_UNIX_Cluster_Component.finalize();
	part_UNIX_X509CredentialFilterEntry_Component.finalize();
	part_UNIX_FilterEntry_Component.finalize();
	part_UNIX_PreambleFilter_Component.finalize();
	part_UNIX_PeerIDPayloadFilterEntry_Component.finalize();
	part_UNIX_Hdr8021Filter_Component.finalize();
	part_UNIX_IPSOFilterEntry_Component.finalize();
	part_UNIX_IPHeadersFilter_Component.finalize();
	return true;
}

Boolean UNIX_FilterEntryInSystem::find(Array<CIMKeyBinding> &kbArray)
{
	CIMKeyBinding kb;
	String groupComponentKey;
	String partComponentKey;

	for(Uint32 i = 0; i < kbArray.size(); i++)
	{
		kb = kbArray[i];
		CIMName keyName = kb.getName();
		if (keyName.equal(PROPERTY_GROUP_COMPONENT)) groupComponentKey = kb.getValue();
		else if (keyName.equal(PROPERTY_PART_COMPONENT)) partComponentKey = kb.getValue();
	}

/* EXecute find with extracted keys */

	return false;
}


text:
from setuptools import setup, find_packages

setup(
    name = 'fritzconnection',
    version = '0.4.5',
    packages = find_packages(),
    license = 'MIT',
    description = 'Communicate with the AVM FritzBox',
    author = 'Klaus Bremer',
    author_email = 'bremer@bremer-media.de',
    url = 'https://bitbucket.org/kbr/fritzconnection',
    classifiers = [
        'Development Status :: 4 - Beta',
        'Environment :: Console',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Natural Language :: English',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Topic :: Software Development :: Libraries :: Python Modules',
    ],
    keywords = 'AVM FritzBox',
    install_requires = [
        'lxml>=3.2.5',
        'requests>=2.2.0',
    ],
)