<commit_before>using Avalonia;
using Avalonia.Platform;
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using System.Text;
using System.Threading.Tasks;

namespace WalletWasabi.Gui.ViewModels
{
	public abstract class TextResourceViewModelBase : WasabiDocumentTabViewModel
	{
		protected CompositeDisposable Disposables { get; private set; } = new CompositeDisposable();

		public string _text;

		public TextResourceViewModelBase(Global global, string title, Uri target) : base(global, title)
		{
			Text = "";

			LoadDocumentAsync(target)
				.ToObservable()
				.ObserveOn(RxApp.MainThreadScheduler)
				.Subscribe(x => Text = x)
				.DisposeWith(Disposables);
		}

		public string Text
		{
			get => _text;
			set => this.RaiseAndSetIfChanged(ref _text, value);
		}

		private async Task<string> LoadDocumentAsync(Uri target)
		{
			var assetLocator = AvaloniaLocator.Current.GetService<IAssetLoader>();

			using (var stream = assetLocator.Open(target))
			using (var reader = new StreamReader(stream))
			{
				return await reader.ReadToEndAsync();
			}
		}

		public override bool OnClose()
		{
			Disposables?.Dispose();
			Disposables = null;
			return base.OnClose();
		}
	}
}<commit_msg>Fix pattern: Create Disposable in OnOpen<commit_after>using Avalonia;
using Avalonia.Platform;
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using System.Text;
using System.Threading.Tasks;

namespace WalletWasabi.Gui.ViewModels
{
	public abstract class TextResourceViewModelBase : WasabiDocumentTabViewModel
	{
		protected CompositeDisposable Disposables { get; private set; }

		public string _text;

		public TextResourceViewModelBase(Global global, string title, Uri target) : base(global, title)
		{
			Text = "";
			Target = target;
		}

		public string Text
		{
			get => _text;
			set => this.RaiseAndSetIfChanged(ref _text, value);
		}

		public Uri Target { get; }

		private async Task<string> LoadDocumentAsync(Uri target)
		{
			var assetLocator = AvaloniaLocator.Current.GetService<IAssetLoader>();

			using (var stream = assetLocator.Open(target))
			using (var reader = new StreamReader(stream))
			{
				return await reader.ReadToEndAsync();
			}
		}

		public override void OnOpen()
		{
			base.OnOpen();

			Disposables = new CompositeDisposable();
			LoadDocumentAsync(Target)
				.ToObservable()
				.ObserveOn(RxApp.MainThreadScheduler)
				.Subscribe(x => Text = x)
				.DisposeWith(Disposables);
		}

		public override bool OnClose()
		{
			Disposables?.Dispose();
			Disposables = null;

			return base.OnClose();
		}
	}
}
{'fraction_non_alphanumeric': 0.10063784549964565, 'fraction_numerical': 0.0, 'mean_word_length': 4.266791044776119, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '3135914', 'n_tokens_mistral': 1017, 'n_tokens_neox': 874, 'n_words': 207}