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

from __future__ import unicode_literals
import frappe
from frappe import _
import cups

from frappe.model.document import Document

class PrintSettings(Document):
	def on_update(self):
		frappe.clear_cache()

	@frappe.whitelist()
	def get_printers(self,ip="localhost",port=631):
		printer_list = []

		try:
			cups.setServer(self.server_ip)
			cups.setPort(self.port)
			conn = cups.Connection()
			printers = conn.getPrinters()
			for printer in printers:
				printer_list.append(printers[printer]["printer-info"])
		except RuntimeError:
			frappe.throw(_("Failed to connect to server"))
		return printer_list
<commit_msg>Update print_settings.py<commit_after># -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt

from __future__ import unicode_literals
import frappe
from frappe import _
import cups

from frappe.model.document import Document

class PrintSettings(Document):
	def on_update(self):
		frappe.clear_cache()

	@frappe.whitelist()
	def get_printers(self,ip="localhost",port=631):
		printer_list = []
		try:
			cups.setServer(self.server_ip)
			cups.setPort(self.port)
			conn = cups.Connection()
			printers = conn.getPrinters()
			printer_list = printers.keys()
		except RuntimeError:
			frappe.throw(_("Failed to connect to server"))
		return printer_list

{'fraction_non_alphanumeric': 0.10526315789473684, 'fraction_numerical': 0.010659560293137908, 'mean_word_length': 4.936758893280633, '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': '6033781', 'n_tokens_mistral': 531, 'n_tokens_neox': 486, 'n_words': 120}