<commit_before># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt

from __future__ import unicode_literals
import frappe

from frappe.utils import cstr
from frappe import msgprint, throw, _

from frappe.model.document import Document

class NamingSeriesNotSetError(frappe.ValidationError): pass

class NamingSeries(Document):

	def get_transactions(self, arg=None):
		doctypes = list(set(frappe.db.sql_list("""select parent
				from `tabDocField` where fieldname='naming_series'""")
			+ frappe.db.sql_list("""select dt from `tabCustom Field`
				where fieldname='naming_series'""")))

		prefixes = ""
		for d in doctypes:
			try:
				options = self.get_options(d)
			except frappe.DoesNotExistError:
				continue

			prefixes = prefixes + "\n" + options

		prefixes.replace("\n\n", "\n")
		prefixes = "\n".join(sorted(prefixes.split()))

		return {
			"transactions": "\n".join([''] + sorted(doctypes)),
			"prefixes": prefixes
		}

	def scrub_options_list(self, ol):
		options = filter(lambda x: x, [cstr(n).strip() for n in ol])
		return options

	def update_series(self, arg=None):
		"""update series list"""
		self.check_duplicate()
		series_list = self.set_options.split("\n")<commit_msg>naming series fix<commit_after># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt

from __future__ import unicode_literals
import frappe

from frappe.utils import cstr
from frappe import msgprint, throw, _

from frappe.model.document import Document

class NamingSeriesNotSetError(frappe.ValidationError): pass

class NamingSeries(Document):

	def get_transactions(self, arg=None):
		doctypes = list(set(frappe.db.sql_list("""select parent
				from `tabDocField` where fieldname='naming_series'""")
			+ frappe.db.sql_list("""select dt from `tabCustom Field`
				where fieldname='naming_series'""")))

		prefixes = ""
		for d in doctypes:
			options = ""
			try:
				options = self.get_options(d)
			except frappe.DoesNotExistError:
				continue

			prefixes = prefixes + "\n" + options

		prefixes.replace("\n\n", "\n")
		prefixes = "\n".join(sorted(prefixes.split()))

		return {
			"transactions": "\n".join([''] + sorted(doctypes)),
			"prefixes": prefixes
		}

	def scrub_options_list(self, ol):
		options = filter(lambda x: x, [cstr(n).strip() for n in ol])
		return options

	def update_series(self, arg=None):
		"""update series list"""
		self.check_duplicate()
		series_list = self.set_options.split("\n")
{'fraction_non_alphanumeric': 0.130859375, 'fraction_numerical': 0.00390625, 'mean_word_length': 4.6039387308533914, 'pattern_counts': {'":': 4, '<': 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': '3396393', 'n_tokens_mistral': 941, 'n_tokens_neox': 858, 'n_words': 216}