<commit_before>﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.Remoting.Messaging;

namespace DavidLievrouw.OwinRequestScopeContext {
  public class OwinRequestScopeContext : IOwinRequestScopeContext {
    const string CallContextKey = "dl.owin.rscopectx";
    readonly List<IDisposable> _disposables;

    internal OwinRequestScopeContext(IDictionary<string, object> owinEnvironment) {
      OwinEnvironment = new ReadOnlyDictionary<string, object>(owinEnvironment);
      Items = new ConcurrentDictionary<string, object>();
      _disposables = new List<IDisposable>();
    }

    public static IOwinRequestScopeContext Current {
      get => (IOwinRequestScopeContext) CallContext.LogicalGetData(CallContextKey);
      set => CallContext.LogicalSetData(CallContextKey, value);
    }

    internal IEnumerable<IDisposable> Disposables => _disposables;

    public IReadOnlyDictionary<string, object> OwinEnvironment { get; }

    public IDictionary<string, object> Items { get; }

    public void RegisterForDisposal(IDisposable disposable) {
      if (disposable == null) throw new ArgumentNullException(paramName: nameof(disposable));
      _disposables.Add(disposable);
    }

    public void Dispose() {
      var disposalExceptions = new List<Exception>();

      Disposables.ForEach(disposable => {
        try {<commit_msg>Make OwinRequestScopeContext.Current setter internal.<commit_after>﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.Remoting.Messaging;

namespace DavidLievrouw.OwinRequestScopeContext {
  public class OwinRequestScopeContext : IOwinRequestScopeContext {
    const string CallContextKey = "dl.owin.rscopectx";
    readonly List<IDisposable> _disposables;

    internal OwinRequestScopeContext(IDictionary<string, object> owinEnvironment) {
      OwinEnvironment = new ReadOnlyDictionary<string, object>(owinEnvironment);
      Items = new ConcurrentDictionary<string, object>();
      _disposables = new List<IDisposable>();
    }

    public static IOwinRequestScopeContext Current {
      get => (IOwinRequestScopeContext) CallContext.LogicalGetData(CallContextKey);
      internal set => CallContext.LogicalSetData(CallContextKey, value);
    }

    internal IEnumerable<IDisposable> Disposables => _disposables;

    public IReadOnlyDictionary<string, object> OwinEnvironment { get; }

    public IDictionary<string, object> Items { get; }

    public void RegisterForDisposal(IDisposable disposable) {
      if (disposable == null) throw new ArgumentNullException(paramName: nameof(disposable));
      _disposables.Add(disposable);
    }

    public void Dispose() {
      var disposalExceptions = new List<Exception>();

      Disposables.ForEach(disposable => {
        try {
{'fraction_non_alphanumeric': 0.0869269949066214, 'fraction_numerical': 0.0, 'mean_word_length': 4.856858846918489, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4736140', 'n_tokens_mistral': 832, 'n_tokens_neox': 793, 'n_words': 174}