<commit_before># -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt

from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.modules.export_file import export_to_files


class ModuleOnboarding(Document):
	def on_update(self):
		if frappe.conf.developer_mode:
			export_to_files(record_list=[['Module ModuleOnboarding', self.name]], record_module=self.module)

			for step in self.steps:
				export_to_files(record_list=[['Module ModuleOnboarding Step', step.step]], record_module=self.module)

	def get_steps(self):
		return [frappe.get_doc("Module ModuleOnboarding Step", step.step) for step in self.steps]

	def get_allowed_roles(self):
		all_roles = [role.role for role in self.allow_roles]
		if "System Manager" not in all_roles:
			all_roles.append("System Manager")

		return all_roles

	def check_completion(self):
		if self.is_complete:
			return True

		steps = self.get_steps()
		is_complete = [bool(step.is_complete or step.is_skipped) for step in steps]
		if all(is_complete):
			self.is_complete = True
			self.save()
			return True

		return False

	def before_export(self, doc):
		doc.is_complete = 0
<commit_msg>fix: controller methods<commit_after># -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt

from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.modules.export_file import export_to_files


class ModuleOnboarding(Document):
	def on_update(self):
		if frappe.conf.developer_mode:
			export_to_files(record_list=[['ModuleOnboarding', self.name]], record_module=self.module)

			for step in self.steps:
				export_to_files(record_list=[['ModuleOnboarding Step', step.step]], record_module=self.module)

	def get_steps(self):
		return [frappe.get_doc("ModuleOnboarding Step", step.step) for step in self.steps]

	def get_allowed_roles(self):
		all_roles = [role.role for role in self.allow_roles]
		if "System Manager" not in all_roles:
			all_roles.append("System Manager")

		return all_roles

	def check_completion(self):
		if self.is_complete:
			return True

		steps = self.get_steps()
		is_complete = [bool(step.is_complete or step.is_skipped) for step in steps]
		if all(is_complete):
			self.is_complete = True
			self.save()
			return True

		return False

	def before_export(self, doc):
		doc.is_complete = 0

{'fraction_non_alphanumeric': 0.0967741935483871, 'fraction_numerical': 0.0047789725209080045, 'mean_word_length': 4.980952380952381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '414423', 'n_tokens_mistral': 895, 'n_tokens_neox': 804, 'n_words': 215}