<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using Drone.Lib.Helpers;

namespace Drone.Lib
{
	public class DroneModule
	{
		public static readonly string DefaultTaskName = "def";

		public static readonly string MainModuleName = "dronemain";

		private readonly IDictionary<string, DroneTask> tasks;

		public IEnumerable<DroneTask> Tasks
		{
			get
			{
				return this.tasks.Values;
			}
		}

		public int TaskCount
		{
			get
			{
				return this.tasks.Count;
			}
		}

		public DroneModule()
		{
			this.tasks = new Dictionary<string, DroneTask>();
		}

		public DroneTask TryGetTask(string name)
		{
			return this.tasks.GetOrDef(name);
		}

		public void Add(DroneTask task)
		{
			if(task == null)
				throw new ArgumentNullException("task");

			this.tasks[task.Name] = task;
		}

		public void Add(string ns, DroneModule module)
		{
			if (ns == null)
				throw new ArgumentNullException("ns");

			if (module == null)
				throw new ArgumentNullException("module");

			foreach (var task in module.Tasks)
			{
				var taskName = task.Name;

				if(!string.IsNullOrWhiteSpace(ns))
					taskName = string.Format("{0}/{1}", ns, task.Name);

				var newTask = task.Clone(taskName);
				this.Add(newTask);
			}
		}
	}
}<commit_msg>fix task dep names when adding from a module to another.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using Drone.Lib.Helpers;

namespace Drone.Lib
{
	public class DroneModule
	{
		public static readonly string DefaultTaskName = "def";

		public static readonly string MainModuleName = "dronemain";

		private readonly IDictionary<string, DroneTask> tasks;

		public IEnumerable<DroneTask> Tasks
		{
			get
			{
				return this.tasks.Values;
			}
		}

		public int TaskCount
		{
			get
			{
				return this.tasks.Count;
			}
		}

		public DroneModule()
		{
			this.tasks = new Dictionary<string, DroneTask>();
		}

		public DroneTask TryGetTask(string name)
		{
			return this.tasks.GetOrDef(name);
		}

		public void Add(DroneTask task)
		{
			if(task == null)
				throw new ArgumentNullException("task");

			this.tasks[task.Name] = task;
		}

		public void Add(string ns, DroneModule module)
		{
			if (ns == null)
				throw new ArgumentNullException("ns");

			if (module == null)
				throw new ArgumentNullException("module");

			foreach (var task in module.Tasks)
			{
				var taskName = task.Name;

				if(!string.IsNullOrWhiteSpace(ns))
					taskName = string.Format("{0}/{1}", ns, task.Name);

				var newTask = task.Clone(taskName);

				var deps = new List<string>(newTask.Dependencies);
				newTask.Dependencies.Clear();

				foreach (var dep in deps)
				{
					var depName = string.Format("{0}/{1}", ns, dep);
					newTask.Dependencies.Add(depName);
				}

				this.Add(newTask);
			}
		}
	}
}
{'fraction_non_alphanumeric': 0.11714589989350373, 'fraction_numerical': 0.002129925452609159, 'mean_word_length': 3.2059701492537314, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '4132808', 'n_tokens_mistral': 1135, 'n_tokens_neox': 922, 'n_words': 226}