<commit_before>﻿#region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010-2015 FUJIWARA, Yusuke
//
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//
//        http://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.
//
#endregion -- License Terms --

#if UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
#define UNITY
#endif

using System;
using System.Collections.Generic;
using System.IO;
using System.Globalization;
using System.Linq;
using System.Runtime.Serialization;

using MsgPack.Serialization.ReflectionSerializers;
#if !SILVERLIGHT && !NETFX_35 && !UNITY
using System.Collections.Concurrent;
#endif // !SILVERLIGHT && !NETFX_35 && !UNITY
#if !UNITY
using System.Diagnostics.Contracts;
#endif // !UNITY
#if NETFX_CORE || WINDOWS_PHONE
using System.Linq.Expressions;
#endif
#if !XAMIOS && !XAMDROID && !UNITY
using MsgPack.Serialization.AbstractSerializers;
#if !NETFX_CORE && !WINDOWS_PHONE
#if !SILVERLIGHT
using MsgPack.Serialization.CodeDomSerializers;
#endif // !SILVERLIGHT
using MsgPack.Serialization.EmittingSerializers;
#endif // NETFX_CORE && !WINDOWS_PHONE
#endif // !!XAMIOS && !XAMDROID && !UNITY
#if !NETFX_35 && !XAMIOS && !XAMDROID && !UNITY
using MsgPack.Serialization.ExpressionSerializers;
#endif // !NETFX_35 && !XAMIOS && !XAMDROID && !UNITY

namespace MsgPack.Serialization
{
	/// <summary>
	///		Defines entry points for <see cref="MessagePackSerializer{T}"/> usage.
	/// </summary>
	public static class MessagePackSerializer
	{
		/// <summary>
		///		Creates new <see cref="MessagePackSerializer{T}"/> instance with <see cref="SerializationContext.Default"/>.
		/// </summary>
		/// <typeparam name="T">Target type.</typeparam>
		/// <returns>
		///		New <see cref="MessagePackSerializer{T}"/> instance to serialize/deserialize the object tree which the top is <typeparamref name="T"/>.
		/// </returns>
		[Obsolete( "Use Get<T>() instead." )]
		public static MessagePackSerializer<T> Create<T>()
		{
#if !UNITY
			Contract.Ensures( Contract.Result<MessagePackSerializer<T>>() != null );
#endif // !UNITY

			return Create<T>( SerializationContext.Default );
		}

		/// <summary>
		///		Creates new <see cref="MessagePackSerializer{T}"/> instance with specified <see cref="SerializationContext"/>.
		/// </summary>
		/// <typeparam name="T">Target type.</typeparam>
		/// <param name="context">
		///		<see cref="SerializationContext"/> to store known/created serializers.
		/// </param>
		/// <returns>
		///		New <see cref="MessagePackSerializer{T}"/> instance to serialize/deserialize the object tree which the top is <typeparamref name="T"/>.
		/// </returns>
		/// <exception cref="ArgumentNullException">
		///		<paramref name="context"/> is <c>null</c>.
		/// </exception>
		[Obsolete( "Use Get<T>(SerializationContext) instead." )]
		public static MessagePackSerializer<T> Create<T>( SerializationContext context )
		{
			if ( context == null )
			{
				throw new ArgumentNullException( "context" );
			}

			return CreateInternal<T>( context, PolymorphismSchema.Default );
		}

		/// <summary>
		///		Gets existing or new <see cref="MessagePackSerializer{T}"/> instance with default context (<see cref="SerializationContext.Default"/>).
		/// </summary>
		/// <typeparam name="T">Target type.</typeparam><commit_msg>Fix MessagePackSerializer.Create just waste resources.<commit_after>﻿#region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010-2015 FUJIWARA, Yusuke
//
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//
//        http://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.
//
#endregion -- License Terms --

#if UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
#define UNITY
#endif

using System;
using System.Collections.Generic;
using System.IO;
using System.Globalization;
using System.Linq;
using System.Runtime.Serialization;

using MsgPack.Serialization.ReflectionSerializers;
#if !SILVERLIGHT && !NETFX_35 && !UNITY
using System.Collections.Concurrent;
#endif // !SILVERLIGHT && !NETFX_35 && !UNITY
#if !UNITY
using System.Diagnostics.Contracts;
#endif // !UNITY
#if NETFX_CORE || WINDOWS_PHONE
using System.Linq.Expressions;
#endif
#if !XAMIOS && !XAMDROID && !UNITY
using MsgPack.Serialization.AbstractSerializers;
#if !NETFX_CORE && !WINDOWS_PHONE
#if !SILVERLIGHT
using MsgPack.Serialization.CodeDomSerializers;
#endif // !SILVERLIGHT
using MsgPack.Serialization.EmittingSerializers;
#endif // NETFX_CORE && !WINDOWS_PHONE
#endif // !!XAMIOS && !XAMDROID && !UNITY
#if !NETFX_35 && !XAMIOS && !XAMDROID && !UNITY
using MsgPack.Serialization.ExpressionSerializers;
#endif // !NETFX_35 && !XAMIOS && !XAMDROID && !UNITY

namespace MsgPack.Serialization
{
	/// <summary>
	///		Defines entry points for <see cref="MessagePackSerializer{T}"/> usage.
	/// </summary>
	public static class MessagePackSerializer
	{
		/// <summary>
		///		Creates new <see cref="MessagePackSerializer{T}"/> instance with <see cref="SerializationContext.Default"/>.
		/// </summary>
		/// <typeparam name="T">Target type.</typeparam>
		/// <returns>
		///		New <see cref="MessagePackSerializer{T}"/> instance to serialize/deserialize the object tree which the top is <typeparamref name="T"/>.
		/// </returns>
		[Obsolete( "Use Get<T>() instead." )]
		public static MessagePackSerializer<T> Create<T>()
		{
#if !UNITY
			Contract.Ensures( Contract.Result<MessagePackSerializer<T>>() != null );
#endif // !UNITY

			return Create<T>( SerializationContext.Default );
		}

		/// <summary>
		///		Creates new <see cref="MessagePackSerializer{T}"/> instance with specified <see cref="SerializationContext"/>.
		/// </summary>
		/// <typeparam name="T">Target type.</typeparam>
		/// <param name="context">
		///		<see cref="SerializationContext"/> to store known/created serializers.
		/// </param>
		/// <returns>
		///		New <see cref="MessagePackSerializer{T}"/> instance to serialize/deserialize the object tree which the top is <typeparamref name="T"/>.
		/// </returns>
		/// <exception cref="ArgumentNullException">
		///		<paramref name="context"/> is <c>null</c>.
		/// </exception>
		[Obsolete( "Use Get<T>(SerializationContext) instead." )]
		public static MessagePackSerializer<T> Create<T>( SerializationContext context )
		{
			if ( context == null )
			{
				throw new ArgumentNullException( "context" );
			}

			// Old Create behavior was effectively Get() because the Builder internally register genreated serializer and returned existent one if it had been already registered. 
			// It was just aweful resource consumption.
			return Get<T>( context, PolymorphismSchema.Default );
		}

		/// <summary>
		///		Gets existing or new <see cref="MessagePackSerializer{T}"/> instance with default context (<see cref="SerializationContext.Default"/>).
		/// </summary>
		/// <typeparam name="T">Target type.</typeparam>
{'fraction_non_alphanumeric': 0.14443607133885958, 'fraction_numerical': 0.006028636021100226, 'mean_word_length': 3.9184681902408895, 'pattern_counts': {'":': 0, '<': 97, '<?xml version=': 0, '>': 97, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7481301', 'n_tokens_mistral': 2580, 'n_tokens_neox': 2465, 'n_words': 684}