diff --git a/frappe/api.py b/frappe/api.py
index 6427cbfbd8..36d51e894c 100644
--- a/frappe/api.py
+++ b/frappe/api.py
@@ -1,6 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
import base64
import binascii
import json
diff --git a/frappe/app.py b/frappe/app.py
index 64befdf531..6f5023be93 100644
--- a/frappe/app.py
+++ b/frappe/app.py
@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import os
-from six import iteritems
import logging
from werkzeug.local import LocalManager
@@ -191,8 +189,9 @@ def make_form_dict(request):
frappe.throw(_("Invalid request arguments"))
try:
- frappe.local.form_dict = frappe._dict({ k:v[0] if isinstance(v, (list, tuple)) else v \
- for k, v in iteritems(args) })
+ frappe.local.form_dict = frappe._dict({
+ k: v[0] if isinstance(v, (list, tuple)) else v for k, v in args.items()
+ })
except IndexError:
frappe.local.form_dict = frappe._dict(args)
diff --git a/frappe/auth.py b/frappe/auth.py
index 73cb8e8c15..ef79d96ddb 100644
--- a/frappe/auth.py
+++ b/frappe/auth.py
@@ -1,9 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals
import datetime
-
from frappe import _
import frappe
import frappe.database
@@ -19,8 +16,7 @@ from frappe.core.doctype.activity_log.activity_log import add_authentication_log
from frappe.twofactor import (should_run_2fa, authenticate_for_2factor,
confirm_otp_token, get_cached_user_pass)
from frappe.website.utils import get_home_page
-
-from six.moves.urllib.parse import quote
+from urllib.parse import quote
class HTTPRequest:
diff --git a/frappe/automation/doctype/assignment_rule/assignment_rule.py b/frappe/automation/doctype/assignment_rule/assignment_rule.py
index c673d5ceeb..ef579aca01 100644
--- a/frappe/automation/doctype/assignment_rule/assignment_rule.py
+++ b/frappe/automation/doctype/assignment_rule/assignment_rule.py
@@ -2,8 +2,6 @@
# Copyright (c) 2019, 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.desk.form import assign_to
diff --git a/frappe/automation/doctype/assignment_rule/test_assignment_rule.py b/frappe/automation/doctype/assignment_rule/test_assignment_rule.py
index cb1e0ff8f4..e287b83965 100644
--- a/frappe/automation/doctype/assignment_rule/test_assignment_rule.py
+++ b/frappe/automation/doctype/assignment_rule/test_assignment_rule.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
from frappe.utils import random_string
diff --git a/frappe/automation/doctype/assignment_rule_day/assignment_rule_day.py b/frappe/automation/doctype/assignment_rule_day/assignment_rule_day.py
index 27f9aa40e1..c734495c39 100644
--- a/frappe/automation/doctype/assignment_rule_day/assignment_rule_day.py
+++ b/frappe/automation/doctype/assignment_rule_day/assignment_rule_day.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/automation/doctype/assignment_rule_user/assignment_rule_user.py b/frappe/automation/doctype/assignment_rule_user/assignment_rule_user.py
index ee8081c6d8..4d65efd5c1 100644
--- a/frappe/automation/doctype/assignment_rule_user/assignment_rule_user.py
+++ b/frappe/automation/doctype/assignment_rule_user/assignment_rule_user.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/automation/doctype/auto_repeat/auto_repeat.py b/frappe/automation/doctype/auto_repeat/auto_repeat.py
index bf05baf5b6..998e73a42c 100644
--- a/frappe/automation/doctype/auto_repeat/auto_repeat.py
+++ b/frappe/automation/doctype/auto_repeat/auto_repeat.py
@@ -2,7 +2,6 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from datetime import timedelta
diff --git a/frappe/automation/doctype/auto_repeat/test_auto_repeat.py b/frappe/automation/doctype/auto_repeat/test_auto_repeat.py
index 6ceb4dba72..567c1161af 100644
--- a/frappe/automation/doctype/auto_repeat/test_auto_repeat.py
+++ b/frappe/automation/doctype/auto_repeat/test_auto_repeat.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
import frappe
diff --git a/frappe/automation/doctype/auto_repeat_day/auto_repeat_day.py b/frappe/automation/doctype/auto_repeat_day/auto_repeat_day.py
index 3a7ced1370..8af3284cde 100644
--- a/frappe/automation/doctype/auto_repeat_day/auto_repeat_day.py
+++ b/frappe/automation/doctype/auto_repeat_day/auto_repeat_day.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/automation/doctype/milestone/milestone.py b/frappe/automation/doctype/milestone/milestone.py
index 64c073a378..6ea6d7544a 100644
--- a/frappe/automation/doctype/milestone/milestone.py
+++ b/frappe/automation/doctype/milestone/milestone.py
@@ -2,8 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
-
import frappe
from frappe.model.document import Document
diff --git a/frappe/automation/doctype/milestone/test_milestone.py b/frappe/automation/doctype/milestone/test_milestone.py
index 75602d48db..175c56e552 100644
--- a/frappe/automation/doctype/milestone/test_milestone.py
+++ b/frappe/automation/doctype/milestone/test_milestone.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
#import frappe
import unittest
diff --git a/frappe/automation/doctype/milestone_tracker/milestone_tracker.py b/frappe/automation/doctype/milestone_tracker/milestone_tracker.py
index 388620bfb4..125cad7fa8 100644
--- a/frappe/automation/doctype/milestone_tracker/milestone_tracker.py
+++ b/frappe/automation/doctype/milestone_tracker/milestone_tracker.py
@@ -2,8 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
-
import frappe
from frappe.model.document import Document
import frappe.cache_manager
diff --git a/frappe/automation/doctype/milestone_tracker/test_milestone_tracker.py b/frappe/automation/doctype/milestone_tracker/test_milestone_tracker.py
index 05db3b025e..21b2779018 100644
--- a/frappe/automation/doctype/milestone_tracker/test_milestone_tracker.py
+++ b/frappe/automation/doctype/milestone_tracker/test_milestone_tracker.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import frappe.cache_manager
import unittest
diff --git a/frappe/boot.py b/frappe/boot.py
index 0dfcb8d1b4..0589e32ac8 100644
--- a/frappe/boot.py
+++ b/frappe/boot.py
@@ -1,10 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals
-
-from six import iteritems, text_type
-
"""
bootstrap client session
"""
@@ -75,7 +70,7 @@ def get_bootinfo():
frappe.get_attr(method)(bootinfo)
if bootinfo.lang:
- bootinfo.lang = text_type(bootinfo.lang)
+ bootinfo.lang = str(bootinfo.lang)
bootinfo.versions = {k: v['version'] for k, v in get_versions().items()}
bootinfo.error_report_email = frappe.conf.error_report_email
@@ -220,7 +215,7 @@ def load_translations(bootinfo):
messages[name] = frappe._(name)
# only untranslated
- messages = {k:v for k, v in iteritems(messages) if k!=v}
+ messages = {k: v for k, v in messages.items() if k!=v}
bootinfo["__messages"] = messages
diff --git a/frappe/build.py b/frappe/build.py
index c970ae3a28..6e4bf2b533 100644
--- a/frappe/build.py
+++ b/frappe/build.py
@@ -1,11 +1,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
import os
import re
import json
import shutil
import subprocess
+from io import StringIO
from tempfile import mkdtemp, mktemp
from distutils.spawn import find_executable
@@ -402,8 +402,6 @@ def get_build_maps():
def pack(target, sources, no_compress, verbose):
- from six import StringIO
-
outtype, outtxt = target.split(".")[-1], ""
jsm = JavascriptMinify()
diff --git a/frappe/cache_manager.py b/frappe/cache_manager.py
index 7330c83102..52fba4568d 100644
--- a/frappe/cache_manager.py
+++ b/frappe/cache_manager.py
@@ -1,8 +1,6 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, json
from frappe.model.document import Document
from frappe.desk.notifications import (delete_notification_count_for,
diff --git a/frappe/chat/__init__.py b/frappe/chat/__init__.py
index dea0030839..4c9b1c5db7 100644
--- a/frappe/chat/__init__.py
+++ b/frappe/chat/__init__.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe import _
diff --git a/frappe/chat/doctype/chat_message/chat_message.py b/frappe/chat/doctype/chat_message/chat_message.py
index 5549aaa657..bc470a5e9c 100644
--- a/frappe/chat/doctype/chat_message/chat_message.py
+++ b/frappe/chat/doctype/chat_message/chat_message.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
# imports - standard imports
import json
diff --git a/frappe/chat/doctype/chat_profile/chat_profile.py b/frappe/chat/doctype/chat_profile/chat_profile.py
index 698d992d35..da10a836c4 100644
--- a/frappe/chat/doctype/chat_profile/chat_profile.py
+++ b/frappe/chat/doctype/chat_profile/chat_profile.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
# imports - module imports
from frappe.model.document import Document
from frappe import _
diff --git a/frappe/chat/doctype/chat_room/chat_room.py b/frappe/chat/doctype/chat_room/chat_room.py
index 609acaef7d..bdbee44d7a 100644
--- a/frappe/chat/doctype/chat_room/chat_room.py
+++ b/frappe/chat/doctype/chat_room/chat_room.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
# imports - module imports
from frappe.model.document import Document
from frappe import _
diff --git a/frappe/chat/doctype/chat_room_user/chat_room_user.py b/frappe/chat/doctype/chat_room_user/chat_room_user.py
index f8e13add82..f6dbdc7659 100644
--- a/frappe/chat/doctype/chat_room_user/chat_room_user.py
+++ b/frappe/chat/doctype/chat_room_user/chat_room_user.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
# imports - module imports
from frappe.model.document import Document
import frappe
diff --git a/frappe/chat/doctype/chat_token/chat_token.py b/frappe/chat/doctype/chat_token/chat_token.py
index 30a76ef5bd..63d69a58be 100644
--- a/frappe/chat/doctype/chat_token/chat_token.py
+++ b/frappe/chat/doctype/chat_token/chat_token.py
@@ -2,7 +2,6 @@
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/chat/util/__init__.py b/frappe/chat/util/__init__.py
index 15977af566..383df581cd 100644
--- a/frappe/chat/util/__init__.py
+++ b/frappe/chat/util/__init__.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
# imports - module imports
from frappe.chat.util.util import (
get_user_doc,
diff --git a/frappe/chat/util/test_util.py b/frappe/chat/util/test_util.py
index 6d44a63d31..e2d05a4024 100644
--- a/frappe/chat/util/test_util.py
+++ b/frappe/chat/util/test_util.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
# imports - standard imports
import unittest
@@ -9,7 +7,6 @@ from frappe.chat.util import (
safe_json_loads
)
import frappe
-import six
class TestChatUtil(unittest.TestCase):
def test_safe_json_loads(self):
@@ -20,7 +17,7 @@ class TestChatUtil(unittest.TestCase):
self.assertEqual(type(number), float)
string = safe_json_loads("foobar")
- self.assertEqual(type(string), six.text_type)
+ self.assertEqual(type(string), str)
array = safe_json_loads('[{ "foo": "bar" }]')
self.assertEqual(type(array), list)
diff --git a/frappe/chat/util/util.py b/frappe/chat/util/util.py
index 82df6dd127..b7e7991c2b 100644
--- a/frappe/chat/util/util.py
+++ b/frappe/chat/util/util.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
# imports - standard imports
import json
from collections.abc import MutableMapping, MutableSequence, Sequence
diff --git a/frappe/chat/website/__init__.py b/frappe/chat/website/__init__.py
index f33f531cbf..12affd2782 100644
--- a/frappe/chat/website/__init__.py
+++ b/frappe/chat/website/__init__.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.chat.util import filter_dict, safe_json_loads
diff --git a/frappe/client.py b/frappe/client.py
index a2e04452ff..66c457e893 100644
--- a/frappe/client.py
+++ b/frappe/client.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals
import frappe
from frappe import _
import frappe.model
@@ -11,7 +9,6 @@ from frappe.utils import get_safe_filters
from frappe.desk.reportview import validate_args
from frappe.model.db_query import check_parent_permission
-from six import iteritems, string_types, integer_types
'''
Handle RESTful requests that are mapped to the `/api/resource` route.
@@ -86,7 +83,7 @@ def get_value(doctype, fieldname, filters=None, as_dict=True, debug=False, paren
frappe.throw(_("No permission for {0}").format(doctype), frappe.PermissionError)
filters = get_safe_filters(filters)
- if isinstance(filters, string_types):
+ if isinstance(filters, str):
filters = {"name": filters}
try:
@@ -135,7 +132,7 @@ def set_value(doctype, name, fieldname, value=None):
if not value:
values = fieldname
- if isinstance(fieldname, string_types):
+ if isinstance(fieldname, str):
try:
values = json.loads(fieldname)
except ValueError:
@@ -161,7 +158,7 @@ def insert(doc=None):
'''Insert a document
:param doc: JSON or dict object to be inserted'''
- if isinstance(doc, string_types):
+ if isinstance(doc, str):
doc = json.loads(doc)
if doc.get("parent") and doc.get("parenttype"):
@@ -179,7 +176,7 @@ def insert_many(docs=None):
'''Insert multiple documents
:param docs: JSON or list of dict objects to be inserted in one request'''
- if isinstance(docs, string_types):
+ if isinstance(docs, str):
docs = json.loads(docs)
out = []
@@ -205,7 +202,7 @@ def save(doc):
'''Update (save) an existing document
:param doc: JSON or dict object with the properties of the document to be updated'''
- if isinstance(doc, string_types):
+ if isinstance(doc, str):
doc = json.loads(doc)
doc = frappe.get_doc(doc)
@@ -228,7 +225,7 @@ def submit(doc):
'''Submit a document
:param doc: JSON or dict object to be submitted remotely'''
- if isinstance(doc, string_types):
+ if isinstance(doc, str):
doc = json.loads(doc)
doc = frappe.get_doc(doc)
@@ -266,7 +263,7 @@ def make_width_property_setter(doc):
'''Set width Property Setter
:param doc: Property Setter document with `width` property'''
- if isinstance(doc, string_types):
+ if isinstance(doc, str):
doc = json.loads(doc)
if doc["doctype"]=="Property Setter" and doc["property"]=="width":
frappe.get_doc(doc).insert(ignore_permissions = True)
@@ -280,7 +277,7 @@ def bulk_update(docs):
failed_docs = []
for doc in docs:
try:
- ddoc = {key: val for key, val in iteritems(doc) if key not in ['doctype', 'docname']}
+ ddoc = {key: val for key, val in doc.items() if key not in ['doctype', 'docname']}
doctype = doc['doctype']
docname = doc['docname']
doc = frappe.get_doc(doctype, docname)
diff --git a/frappe/commands/__init__.py b/frappe/commands/__init__.py
index e521acc9ad..be9d107025 100644
--- a/frappe/commands/__init__.py
+++ b/frappe/commands/__init__.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals, absolute_import, print_function
import sys
import click
import cProfile
@@ -10,7 +9,7 @@ import frappe
import frappe.utils
import subprocess # nosec
from functools import wraps
-from six import StringIO
+from io import StringIO
from os import environ
click.disable_unicode_literals_warning = True
diff --git a/frappe/commands/scheduler.py b/frappe/commands/scheduler.py
index e9638800cd..d69ebb3024 100755
--- a/frappe/commands/scheduler.py
+++ b/frappe/commands/scheduler.py
@@ -1,4 +1,3 @@
-from __future__ import unicode_literals, absolute_import, print_function
import click
import sys
import frappe
diff --git a/frappe/commands/translate.py b/frappe/commands/translate.py
index 48a7fd1db7..68d210eaaa 100644
--- a/frappe/commands/translate.py
+++ b/frappe/commands/translate.py
@@ -1,4 +1,3 @@
-from __future__ import unicode_literals, absolute_import, print_function
import click
from frappe.commands import pass_context, get_site
from frappe.exceptions import SiteNotSpecifiedError
diff --git a/frappe/commands/utils.py b/frappe/commands/utils.py
index 4da0f6bb78..bcb1749644 100644
--- a/frappe/commands/utils.py
+++ b/frappe/commands/utils.py
@@ -222,7 +222,7 @@ def execute(context, method, args=None, kwargs=None, profile=False):
if profile:
import pstats
- from six import StringIO
+ from io import StringIO
pr.disable()
s = StringIO()
diff --git a/frappe/config/__init__.py b/frappe/config/__init__.py
index 30be82d0df..62a877be24 100644
--- a/frappe/config/__init__.py
+++ b/frappe/config/__init__.py
@@ -1,6 +1,3 @@
-from __future__ import unicode_literals
-import json
-from six import iteritems
import frappe
from frappe import _
from frappe.desk.moduleview import (get_data, get_onboard_items, config_exists, get_module_link_items_from_list)
diff --git a/frappe/contacts/address_and_contact.py b/frappe/contacts/address_and_contact.py
index 3ca9547188..f21819ad98 100644
--- a/frappe/contacts/address_and_contact.py
+++ b/frappe/contacts/address_and_contact.py
@@ -1,7 +1,6 @@
# 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 import _
diff --git a/frappe/contacts/doctype/address/test_address.py b/frappe/contacts/doctype/address/test_address.py
index d6d4e50491..ed61b6f0ee 100644
--- a/frappe/contacts/doctype/address/test_address.py
+++ b/frappe/contacts/doctype/address/test_address.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe, unittest
from frappe.contacts.doctype.address.address import get_address_display
diff --git a/frappe/contacts/doctype/address_template/address_template.py b/frappe/contacts/doctype/address_template/address_template.py
index 2ca9aebff5..2d69a792ab 100644
--- a/frappe/contacts/doctype/address_template/address_template.py
+++ b/frappe/contacts/doctype/address_template/address_template.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, 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.utils import cint
diff --git a/frappe/contacts/doctype/address_template/test_address_template.py b/frappe/contacts/doctype/address_template/test_address_template.py
index f40b56e7d9..6b519a3bb7 100644
--- a/frappe/contacts/doctype/address_template/test_address_template.py
+++ b/frappe/contacts/doctype/address_template/test_address_template.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe, unittest
class TestAddressTemplate(unittest.TestCase):
@@ -42,4 +40,4 @@ class TestAddressTemplate(unittest.TestCase):
"doctype": "Address Template",
"country": 'Brazil',
"template": template
- }).insert()
\ No newline at end of file
+ }).insert()
\ No newline at end of file
diff --git a/frappe/contacts/doctype/contact/contact.py b/frappe/contacts/doctype/contact/contact.py
index c8af99bebc..d1dd1f1010 100644
--- a/frappe/contacts/doctype/contact/contact.py
+++ b/frappe/contacts/doctype/contact/contact.py
@@ -1,6 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-
import frappe
from frappe.utils import cstr, has_gravatar
from frappe import _
diff --git a/frappe/contacts/doctype/contact/test_contact.py b/frappe/contacts/doctype/contact/test_contact.py
index b131428696..6c6089edeb 100644
--- a/frappe/contacts/doctype/contact/test_contact.py
+++ b/frappe/contacts/doctype/contact/test_contact.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/contacts/doctype/contact_email/contact_email.py b/frappe/contacts/doctype/contact_email/contact_email.py
index 04e8b22989..5fc2fef316 100644
--- a/frappe/contacts/doctype/contact_email/contact_email.py
+++ b/frappe/contacts/doctype/contact_email/contact_email.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/contacts/doctype/contact_phone/contact_phone.py b/frappe/contacts/doctype/contact_phone/contact_phone.py
index fe2f86a4bd..63f5f73cf1 100644
--- a/frappe/contacts/doctype/contact_phone/contact_phone.py
+++ b/frappe/contacts/doctype/contact_phone/contact_phone.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/contacts/doctype/gender/gender.py b/frappe/contacts/doctype/gender/gender.py
index bfca5830c1..319800de7e 100644
--- a/frappe/contacts/doctype/gender/gender.py
+++ b/frappe/contacts/doctype/gender/gender.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
class Gender(Document):
diff --git a/frappe/contacts/doctype/gender/test_gender.py b/frappe/contacts/doctype/gender/test_gender.py
index fbe3473bc3..071ed47df0 100644
--- a/frappe/contacts/doctype/gender/test_gender.py
+++ b/frappe/contacts/doctype/gender/test_gender.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
class TestGender(unittest.TestCase):
diff --git a/frappe/contacts/doctype/salutation/salutation.py b/frappe/contacts/doctype/salutation/salutation.py
index d9e4528c7d..d79ad66845 100644
--- a/frappe/contacts/doctype/salutation/salutation.py
+++ b/frappe/contacts/doctype/salutation/salutation.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
class Salutation(Document):
diff --git a/frappe/contacts/doctype/salutation/test_salutation.py b/frappe/contacts/doctype/salutation/test_salutation.py
index 63d603e6a4..e2e9075855 100644
--- a/frappe/contacts/doctype/salutation/test_salutation.py
+++ b/frappe/contacts/doctype/salutation/test_salutation.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
class TestSalutation(unittest.TestCase):
diff --git a/frappe/contacts/report/addresses_and_contacts/addresses_and_contacts.py b/frappe/contacts/report/addresses_and_contacts/addresses_and_contacts.py
index 1b3982f251..bf48b6b185 100644
--- a/frappe/contacts/report/addresses_and_contacts/addresses_and_contacts.py
+++ b/frappe/contacts/report/addresses_and_contacts/addresses_and_contacts.py
@@ -1,8 +1,5 @@
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-
-from __future__ import unicode_literals
-from six import iteritems
import frappe
from frappe import _
@@ -58,7 +55,7 @@ def get_reference_addresses_and_contact(reference_doctype, reference_name):
reference_details = get_reference_details(reference_doctype, "Address", reference_list, reference_details)
reference_details = get_reference_details(reference_doctype, "Contact", reference_list, reference_details)
- for reference_name, details in iteritems(reference_details):
+ for reference_name, details in reference_details.items():
addresses = details.get("address", [])
contacts = details.get("contact", [])
if not any([addresses, contacts]):
diff --git a/frappe/contacts/report/addresses_and_contacts/test_addresses_and_contacts.py b/frappe/contacts/report/addresses_and_contacts/test_addresses_and_contacts.py
index 9e98dcf6f6..f539722175 100644
--- a/frappe/contacts/report/addresses_and_contacts/test_addresses_and_contacts.py
+++ b/frappe/contacts/report/addresses_and_contacts/test_addresses_and_contacts.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
import frappe.defaults
import unittest
diff --git a/frappe/core/__init__.py b/frappe/core/__init__.py
index 998a299158..f064a66c17 100644
--- a/frappe/core/__init__.py
+++ b/frappe/core/__init__.py
@@ -1,4 +1,2 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals
\ No newline at end of file
diff --git a/frappe/core/doctype/__init__.py b/frappe/core/doctype/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/core/doctype/__init__.py
+++ b/frappe/core/doctype/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/core/doctype/access_log/access_log.py b/frappe/core/doctype/access_log/access_log.py
index 43381e7f2e..d2fbee108b 100644
--- a/frappe/core/doctype/access_log/access_log.py
+++ b/frappe/core/doctype/access_log/access_log.py
@@ -3,8 +3,6 @@
# For license information, please see license.txt
# imports - standard imports
-from __future__ import unicode_literals
-
# imports - module imports
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/activity_log/activity_log.py b/frappe/core/doctype/activity_log/activity_log.py
index 98dc91806d..efec0dc217 100644
--- a/frappe/core/doctype/activity_log/activity_log.py
+++ b/frappe/core/doctype/activity_log/activity_log.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe import _
from frappe.utils import get_fullname, now
from frappe.model.document import Document
diff --git a/frappe/core/doctype/activity_log/feed.py b/frappe/core/doctype/activity_log/feed.py
index f51692fe9f..caa3cae613 100644
--- a/frappe/core/doctype/activity_log/feed.py
+++ b/frappe/core/doctype/activity_log/feed.py
@@ -1,13 +1,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: See license.txt
-from __future__ import unicode_literals
import frappe
import frappe.permissions
from frappe.utils import get_fullname
from frappe import _
from frappe.core.doctype.activity_log.activity_log import add_authentication_log
-from six import string_types
def update_feed(doc, method=None):
if frappe.flags.in_patch or frappe.flags.in_install or frappe.flags.in_import:
@@ -23,7 +21,7 @@ def update_feed(doc, method=None):
feed = doc.get_feed()
if feed:
- if isinstance(feed, string_types):
+ if isinstance(feed, str):
feed = {"subject": feed}
feed = frappe._dict(feed)
diff --git a/frappe/core/doctype/activity_log/test_activity_log.py b/frappe/core/doctype/activity_log/test_activity_log.py
index f33c7a1c85..ed7b70cca1 100644
--- a/frappe/core/doctype/activity_log/test_activity_log.py
+++ b/frappe/core/doctype/activity_log/test_activity_log.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
import time
diff --git a/frappe/core/doctype/block_module/block_module.py b/frappe/core/doctype/block_module/block_module.py
index e7bb3cf045..d9723f9170 100644
--- a/frappe/core/doctype/block_module/block_module.py
+++ b/frappe/core/doctype/block_module/block_module.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/comment/comment.py b/frappe/core/doctype/comment/comment.py
index ad5d60500b..e29bae25a2 100644
--- a/frappe/core/doctype/comment/comment.py
+++ b/frappe/core/doctype/comment/comment.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-
-from __future__ import unicode_literals, absolute_import
import frappe
from frappe import _
import json
diff --git a/frappe/core/doctype/comment/test_comment.py b/frappe/core/doctype/comment/test_comment.py
index 3cf8fbaa3f..13db92e7a8 100644
--- a/frappe/core/doctype/comment/test_comment.py
+++ b/frappe/core/doctype/comment/test_comment.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe, json
import unittest
diff --git a/frappe/core/doctype/communication/communication.py b/frappe/core/doctype/communication/communication.py
index 5ebf714645..ed17ffc0aa 100644
--- a/frappe/core/doctype/communication/communication.py
+++ b/frappe/core/doctype/communication/communication.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals, absolute_import
from collections import Counter
import frappe
from frappe import _
@@ -13,7 +12,7 @@ from frappe.utils.bot import BotReply
from frappe.utils import parse_addr
from frappe.core.doctype.comment.comment import update_comment_in_doc
from email.utils import parseaddr
-from six.moves.urllib.parse import unquote
+from urllib.parse import unquote
from frappe.utils.user import is_system_user
from frappe.contacts.doctype.contact.contact import get_contact_name
from frappe.automation.doctype.assignment_rule.assignment_rule import apply as apply_assignment_rule
diff --git a/frappe/core/doctype/communication/email.py b/frappe/core/doctype/communication/email.py
index d3017055cf..c28956b41f 100755
--- a/frappe/core/doctype/communication/email.py
+++ b/frappe/core/doctype/communication/email.py
@@ -1,9 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals, absolute_import
-from six.moves import range
-from six import string_types
import frappe
import json
from email.utils import formataddr
@@ -77,7 +74,7 @@ def make(doctype=None, name=None, content=None, subject=None, sent_or_received =
comm.save(ignore_permissions=True)
- if isinstance(attachments, string_types):
+ if isinstance(attachments, str):
attachments = json.loads(attachments)
# if not committed, delayed task doesn't find the communication
@@ -249,11 +246,11 @@ def prepare_to_notify(doc, print_html=None, print_format=None, attachments=None)
"name":doc.reference_name, "print_format":print_format, "html":print_html})
if attachments:
- if isinstance(attachments, string_types):
+ if isinstance(attachments, str):
attachments = json.loads(attachments)
for a in attachments:
- if isinstance(a, string_types):
+ if isinstance(a, str):
# is it a filename?
try:
# check for both filename and file id
@@ -355,7 +352,7 @@ def add_attachments(name, attachments):
'''Add attachments to the given Communication'''
# loop through attachments
for a in attachments:
- if isinstance(a, string_types):
+ if isinstance(a, str):
attach = frappe.db.get_value("File", {"name":a},
["file_name", "file_url", "is_private"], as_dict=1)
diff --git a/frappe/core/doctype/communication/test_communication.py b/frappe/core/doctype/communication/test_communication.py
index 6df90baaae..5b400398a5 100644
--- a/frappe/core/doctype/communication/test_communication.py
+++ b/frappe/core/doctype/communication/test_communication.py
@@ -1,10 +1,8 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
-from six.moves.urllib.parse import quote
+from urllib.parse import quote
test_records = frappe.get_test_records('Communication')
diff --git a/frappe/core/doctype/communication_link/communication_link.py b/frappe/core/doctype/communication_link/communication_link.py
index d1612ef57e..d3307d1d32 100644
--- a/frappe/core/doctype/communication_link/communication_link.py
+++ b/frappe/core/doctype/communication_link/communication_link.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/custom_docperm/custom_docperm.py b/frappe/core/doctype/custom_docperm/custom_docperm.py
index cce9788b73..225f5db79b 100644
--- a/frappe/core/doctype/custom_docperm/custom_docperm.py
+++ b/frappe/core/doctype/custom_docperm/custom_docperm.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/custom_docperm/test_custom_docperm.py b/frappe/core/doctype/custom_docperm/test_custom_docperm.py
index bd6e17ccc9..6e0c82d1db 100644
--- a/frappe/core/doctype/custom_docperm/test_custom_docperm.py
+++ b/frappe/core/doctype/custom_docperm/test_custom_docperm.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/custom_role/custom_role.py b/frappe/core/doctype/custom_role/custom_role.py
index 25257e1a23..89e478dd38 100644
--- a/frappe/core/doctype/custom_role/custom_role.py
+++ b/frappe/core/doctype/custom_role/custom_role.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/custom_role/test_custom_role.py b/frappe/core/doctype/custom_role/test_custom_role.py
index 670b494b10..0ad77524fa 100644
--- a/frappe/core/doctype/custom_role/test_custom_role.py
+++ b/frappe/core/doctype/custom_role/test_custom_role.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/data_export/data_export.py b/frappe/core/doctype/data_export/data_export.py
index fb4fae26d5..c376b25230 100644
--- a/frappe/core/doctype/data_export/data_export.py
+++ b/frappe/core/doctype/data_export/data_export.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
class DataExport(Document):
diff --git a/frappe/core/doctype/data_export/exporter.py b/frappe/core/doctype/data_export/exporter.py
index 5d600cc0db..389948449e 100644
--- a/frappe/core/doctype/data_export/exporter.py
+++ b/frappe/core/doctype/data_export/exporter.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
from frappe import _
import frappe.permissions
@@ -10,7 +8,6 @@ import re, csv, os
from frappe.utils.csvutils import UnicodeWriter
from frappe.utils import cstr, formatdate, format_datetime, parse_json, cint, format_duration
from frappe.core.doctype.data_import_legacy.importer import get_data_keys
-from six import string_types
from frappe.core.doctype.access_log.access_log import make_access_log
reflags = {
@@ -57,7 +54,7 @@ class DataExporter:
self.docs_to_export = {}
if self.doctype:
- if isinstance(self.doctype, string_types):
+ if isinstance(self.doctype, str):
self.doctype = [self.doctype]
if len(self.doctype) > 1:
diff --git a/frappe/core/doctype/data_import/importer.py b/frappe/core/doctype/data_import/importer.py
index d3f981add4..fed90b75ce 100644
--- a/frappe/core/doctype/data_import/importer.py
+++ b/frappe/core/doctype/data_import/importer.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import os
import io
import frappe
diff --git a/frappe/core/doctype/data_import/test_data_import.py b/frappe/core/doctype/data_import/test_data_import.py
index 15fd57744a..c9366a97ba 100644
--- a/frappe/core/doctype/data_import/test_data_import.py
+++ b/frappe/core/doctype/data_import/test_data_import.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/core/doctype/data_import/test_exporter.py b/frappe/core/doctype/data_import/test_exporter.py
index 8415af2e63..dfe9926906 100644
--- a/frappe/core/doctype/data_import/test_exporter.py
+++ b/frappe/core/doctype/data_import/test_exporter.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
import frappe
from frappe.core.doctype.data_import.exporter import Exporter
diff --git a/frappe/core/doctype/data_import/test_importer.py b/frappe/core/doctype/data_import/test_importer.py
index f76d4504a4..54a7788a2d 100644
--- a/frappe/core/doctype/data_import/test_importer.py
+++ b/frappe/core/doctype/data_import/test_importer.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
import frappe
from frappe.core.doctype.data_import.importer import Importer
diff --git a/frappe/core/doctype/data_import_legacy/importer.py b/frappe/core/doctype/data_import_legacy/importer.py
index 35569c7186..4080e70418 100644
--- a/frappe/core/doctype/data_import_legacy/importer.py
+++ b/frappe/core/doctype/data_import_legacy/importer.py
@@ -3,9 +3,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals, print_function
-
-from six.moves import range
import requests
import frappe, json
import frappe.permissions
@@ -16,7 +13,6 @@ from frappe.utils.csvutils import getlink
from frappe.utils.dateutils import parse_date
from frappe.utils import cint, cstr, flt, getdate, get_datetime, get_url, get_absolute_url, duration_to_seconds
-from six import string_types
@frappe.whitelist()
@@ -42,7 +38,7 @@ def upload(rows = None, submit_after_import=None, ignore_encoding_errors=False,
frappe.cache().hdel("lang", user)
frappe.set_user_lang(user)
- if data_import_doc and isinstance(data_import_doc, string_types):
+ if data_import_doc and isinstance(data_import_doc, str):
data_import_doc = frappe.get_doc("Data Import Legacy", data_import_doc)
if data_import_doc and from_data_import == "Yes":
no_email = data_import_doc.no_email
@@ -152,7 +148,7 @@ def upload(rows = None, submit_after_import=None, ignore_encoding_errors=False,
elif fieldtype in ("Float", "Currency", "Percent"):
d[fieldname] = flt(d[fieldname])
elif fieldtype == "Date":
- if d[fieldname] and isinstance(d[fieldname], string_types):
+ if d[fieldname] and isinstance(d[fieldname], str):
d[fieldname] = getdate(parse_date(d[fieldname]))
elif fieldtype == "Datetime":
if d[fieldname]:
diff --git a/frappe/core/doctype/data_import_legacy/test_data_import_legacy.py b/frappe/core/doctype/data_import_legacy/test_data_import_legacy.py
index e5b244e6a0..6f9964e8f5 100644
--- a/frappe/core/doctype/data_import_legacy/test_data_import_legacy.py
+++ b/frappe/core/doctype/data_import_legacy/test_data_import_legacy.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/core/doctype/defaultvalue/__init__.py b/frappe/core/doctype/defaultvalue/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/core/doctype/defaultvalue/__init__.py
+++ b/frappe/core/doctype/defaultvalue/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/core/doctype/defaultvalue/defaultvalue.py b/frappe/core/doctype/defaultvalue/defaultvalue.py
index d9cc145053..0ae088ee96 100644
--- a/frappe/core/doctype/defaultvalue/defaultvalue.py
+++ b/frappe/core/doctype/defaultvalue/defaultvalue.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/deleted_document/deleted_document.py b/frappe/core/doctype/deleted_document/deleted_document.py
index 116fc5caf5..f4109c8197 100644
--- a/frappe/core/doctype/deleted_document/deleted_document.py
+++ b/frappe/core/doctype/deleted_document/deleted_document.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
import json
from frappe.desk.doctype.bulk_update.bulk_update import show_progress
diff --git a/frappe/core/doctype/deleted_document/test_deleted_document.py b/frappe/core/doctype/deleted_document/test_deleted_document.py
index c45a2bd180..d9dc2bb2d1 100644
--- a/frappe/core/doctype/deleted_document/test_deleted_document.py
+++ b/frappe/core/doctype/deleted_document/test_deleted_document.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/docfield/__init__.py b/frappe/core/doctype/docfield/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/core/doctype/docfield/__init__.py
+++ b/frappe/core/doctype/docfield/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/core/doctype/docfield/docfield.py b/frappe/core/doctype/docfield/docfield.py
index b6e2d9b67d..175cba3c7c 100644
--- a/frappe/core/doctype/docfield/docfield.py
+++ b/frappe/core/doctype/docfield/docfield.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/docperm/__init__.py b/frappe/core/doctype/docperm/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/core/doctype/docperm/__init__.py
+++ b/frappe/core/doctype/docperm/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/core/doctype/docperm/docperm.py b/frappe/core/doctype/docperm/docperm.py
index 36ed9acbe6..9732cde920 100644
--- a/frappe/core/doctype/docperm/docperm.py
+++ b/frappe/core/doctype/docperm/docperm.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/docshare/docshare.py b/frappe/core/doctype/docshare/docshare.py
index 26ed53a87d..2d7b6b9e48 100644
--- a/frappe/core/doctype/docshare/docshare.py
+++ b/frappe/core/doctype/docshare/docshare.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
diff --git a/frappe/core/doctype/docshare/test_docshare.py b/frappe/core/doctype/docshare/test_docshare.py
index 9c424eb4d7..6551dabbea 100644
--- a/frappe/core/doctype/docshare/test_docshare.py
+++ b/frappe/core/doctype/docshare/test_docshare.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
import frappe
import frappe.share
import unittest
diff --git a/frappe/core/doctype/doctype/__init__.py b/frappe/core/doctype/doctype/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/core/doctype/doctype/__init__.py
+++ b/frappe/core/doctype/doctype/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py
index f9dbeb0907..8a96fc89f6 100644
--- a/frappe/core/doctype/doctype/doctype.py
+++ b/frappe/core/doctype/doctype/doctype.py
@@ -2,15 +2,10 @@
# MIT License. See license.txt
# imports - standard imports
-from __future__ import unicode_literals
import re, copy, os, shutil
import json
from frappe.cache_manager import clear_user_cache, clear_controller_cache
-# imports - third party imports
-import six
-from six import iteritems
-
# imports - module imports
import frappe
import frappe.website.render
@@ -486,7 +481,7 @@ class DocType(Document):
# remove null and empty fields
def remove_null_fields(o):
to_remove = []
- for attr, value in iteritems(o):
+ for attr, value in o.items():
if isinstance(value, list):
for v in value:
remove_null_fields(v)
@@ -670,7 +665,7 @@ class DocType(Document):
if not name:
name = self.name
- flags = {"flags": re.ASCII} if six.PY3 else {}
+ flags = {"flags": re.ASCII}
# a DocType name should not start or end with an empty space
if re.search(r"^[ \t\n\r]+|[ \t\n\r]+$", name, **flags):
diff --git a/frappe/core/doctype/doctype/test_doctype.py b/frappe/core/doctype/doctype/test_doctype.py
index 9c492d2c36..1e1a01a685 100644
--- a/frappe/core/doctype/doctype/test_doctype.py
+++ b/frappe/core/doctype/doctype/test_doctype.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
from frappe.core.doctype.doctype.doctype import (UniqueFieldnameError,
diff --git a/frappe/core/doctype/doctype_action/doctype_action.py b/frappe/core/doctype/doctype_action/doctype_action.py
index a745c7da40..203b06ec1b 100644
--- a/frappe/core/doctype/doctype_action/doctype_action.py
+++ b/frappe/core/doctype/doctype_action/doctype_action.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/doctype_link/doctype_link.py b/frappe/core/doctype/doctype_link/doctype_link.py
index efe8b09809..07e0efdace 100644
--- a/frappe/core/doctype/doctype_link/doctype_link.py
+++ b/frappe/core/doctype/doctype_link/doctype_link.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/document_naming_rule/document_naming_rule.py b/frappe/core/doctype/document_naming_rule/document_naming_rule.py
index 4b34293af6..4f500a2abf 100644
--- a/frappe/core/doctype/document_naming_rule/document_naming_rule.py
+++ b/frappe/core/doctype/document_naming_rule/document_naming_rule.py
@@ -2,7 +2,6 @@
# 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.utils.data import evaluate_filters
diff --git a/frappe/core/doctype/document_naming_rule/test_document_naming_rule.py b/frappe/core/doctype/document_naming_rule/test_document_naming_rule.py
index 1b91f6a0cf..2206d173d7 100644
--- a/frappe/core/doctype/document_naming_rule/test_document_naming_rule.py
+++ b/frappe/core/doctype/document_naming_rule/test_document_naming_rule.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/document_naming_rule_condition/document_naming_rule_condition.py b/frappe/core/doctype/document_naming_rule_condition/document_naming_rule_condition.py
index 0895c9f93f..dfca052d95 100644
--- a/frappe/core/doctype/document_naming_rule_condition/document_naming_rule_condition.py
+++ b/frappe/core/doctype/document_naming_rule_condition/document_naming_rule_condition.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/core/doctype/document_naming_rule_condition/test_document_naming_rule_condition.py b/frappe/core/doctype/document_naming_rule_condition/test_document_naming_rule_condition.py
index 6f1376dc62..643e963bd7 100644
--- a/frappe/core/doctype/document_naming_rule_condition/test_document_naming_rule_condition.py
+++ b/frappe/core/doctype/document_naming_rule_condition/test_document_naming_rule_condition.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/core/doctype/domain/domain.py b/frappe/core/doctype/domain/domain.py
index a4e9f503ab..681824bb02 100644
--- a/frappe/core/doctype/domain/domain.py
+++ b/frappe/core/doctype/domain/domain.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/domain/test_domain.py b/frappe/core/doctype/domain/test_domain.py
index 8e0bc65c54..c2686a7566 100644
--- a/frappe/core/doctype/domain/test_domain.py
+++ b/frappe/core/doctype/domain/test_domain.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/domain_settings/domain_settings.py b/frappe/core/doctype/domain_settings/domain_settings.py
index d4d394a5cb..7ad0aeff21 100644
--- a/frappe/core/doctype/domain_settings/domain_settings.py
+++ b/frappe/core/doctype/domain_settings/domain_settings.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/dynamic_link/dynamic_link.py b/frappe/core/doctype/dynamic_link/dynamic_link.py
index 30e0ef1f1f..a7adb9ae72 100644
--- a/frappe/core/doctype/dynamic_link/dynamic_link.py
+++ b/frappe/core/doctype/dynamic_link/dynamic_link.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/error_log/error_log.py b/frappe/core/doctype/error_log/error_log.py
index ec02aaf446..8223238c57 100644
--- a/frappe/core/doctype/error_log/error_log.py
+++ b/frappe/core/doctype/error_log/error_log.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/error_log/test_error_log.py b/frappe/core/doctype/error_log/test_error_log.py
index d93fe07c61..d7444ab2a7 100644
--- a/frappe/core/doctype/error_log/test_error_log.py
+++ b/frappe/core/doctype/error_log/test_error_log.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/error_snapshot/error_snapshot.py b/frappe/core/doctype/error_snapshot/error_snapshot.py
index 5badaad63f..247a796a6b 100644
--- a/frappe/core/doctype/error_snapshot/error_snapshot.py
+++ b/frappe/core/doctype/error_snapshot/error_snapshot.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/error_snapshot/test_error_snapshot.py b/frappe/core/doctype/error_snapshot/test_error_snapshot.py
index b6438eae1d..135136294a 100644
--- a/frappe/core/doctype/error_snapshot/test_error_snapshot.py
+++ b/frappe/core/doctype/error_snapshot/test_error_snapshot.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/file/file.py b/frappe/core/doctype/file/file.py
index c4c37e6d13..b4bfe1d21b 100755
--- a/frappe/core/doctype/file/file.py
+++ b/frappe/core/doctype/file/file.py
@@ -7,8 +7,6 @@ record of files
naming for same name files: file.gif, file-1.gif, file-2.gif etc
"""
-from __future__ import unicode_literals
-
import base64
import hashlib
import imghdr
@@ -23,8 +21,8 @@ import zipfile
import requests
import requests.exceptions
from PIL import Image, ImageFile, ImageOps
-from six import PY2, StringIO, string_types, text_type
-from six.moves.urllib.parse import quote, unquote
+from io import StringIO
+from urllib.parse import quote, unquote
import frappe
from frappe import _, conf
@@ -382,18 +380,14 @@ class File(Document):
file_path = self.get_full_path()
# read the file
- if PY2:
- with open(encode(file_path)) as f:
- content = f.read()
- else:
- with io.open(encode(file_path), mode='rb') as f:
- content = f.read()
- try:
- # for plain text files
- content = content.decode()
- except UnicodeDecodeError:
- # for .png, .jpg, etc
- pass
+ with io.open(encode(file_path), mode='rb') as f:
+ content = f.read()
+ try:
+ # for plain text files
+ content = content.decode()
+ except UnicodeDecodeError:
+ # for .png, .jpg, etc
+ pass
return content
@@ -430,7 +424,7 @@ class File(Document):
frappe.create_folder(file_path)
# write the file
self.content = self.get_content()
- if isinstance(self.content, text_type):
+ if isinstance(self.content, str):
self.content = self.content.encode()
with open(os.path.join(file_path.encode('utf-8'), self.file_name.encode('utf-8')), 'wb+') as f:
f.write(self.content)
@@ -483,7 +477,7 @@ class File(Document):
self.content = content
if decode:
- if isinstance(content, text_type):
+ if isinstance(content, str):
self.content = content.encode("utf-8")
if b"," in self.content:
@@ -632,7 +626,7 @@ def create_new_folder(file_name, folder):
@frappe.whitelist()
def move_file(file_list, new_parent, old_parent):
- if isinstance(file_list, string_types):
+ if isinstance(file_list, str):
file_list = json.loads(file_list)
for file_obj in file_list:
@@ -834,7 +828,7 @@ def remove_file_by_url(file_url, doctype=None, name=None):
def get_content_hash(content):
- if isinstance(content, text_type):
+ if isinstance(content, str):
content = content.encode()
return hashlib.md5(content).hexdigest() #nosec
@@ -887,8 +881,8 @@ def extract_images_from_html(doc, content):
filename = headers.split("filename=")[-1]
# decode filename
- if not isinstance(filename, text_type):
- filename = text_type(filename, 'utf-8')
+ if not isinstance(filename, str):
+ filename = str(filename, 'utf-8')
else:
mtype = headers.split(";")[0]
filename = get_random_filename(content_type=mtype)
@@ -911,7 +905,7 @@ def extract_images_from_html(doc, content):
return '
]*src\s*=\s*["\'](?=data:)(.*?)["\']', _save_file, content)
return content
@@ -941,7 +935,7 @@ def get_attached_images(doctype, names):
'''get list of image urls attached in form
returns {name: ['image.jpg', 'image.png']}'''
- if isinstance(names, string_types):
+ if isinstance(names, str):
names = json.loads(names)
img_urls = frappe.db.get_list('File', filters={
diff --git a/frappe/core/doctype/file/test_file.py b/frappe/core/doctype/file/test_file.py
index 2596fe94d0..649010c468 100644
--- a/frappe/core/doctype/file/test_file.py
+++ b/frappe/core/doctype/file/test_file.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import base64
import frappe
import os
diff --git a/frappe/core/doctype/has_domain/has_domain.py b/frappe/core/doctype/has_domain/has_domain.py
index 6381996035..2220656a2e 100644
--- a/frappe/core/doctype/has_domain/has_domain.py
+++ b/frappe/core/doctype/has_domain/has_domain.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/has_role/has_role.py b/frappe/core/doctype/has_role/has_role.py
index 45e76c85a1..51d86c7b0a 100644
--- a/frappe/core/doctype/has_role/has_role.py
+++ b/frappe/core/doctype/has_role/has_role.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/installed_application/installed_application.py b/frappe/core/doctype/installed_application/installed_application.py
index 6bb12afc49..f53a6424eb 100644
--- a/frappe/core/doctype/installed_application/installed_application.py
+++ b/frappe/core/doctype/installed_application/installed_application.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/core/doctype/installed_applications/installed_applications.py b/frappe/core/doctype/installed_applications/installed_applications.py
index 4e6eadf07e..b61555f57e 100644
--- a/frappe/core/doctype/installed_applications/installed_applications.py
+++ b/frappe/core/doctype/installed_applications/installed_applications.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/core/doctype/installed_applications/test_installed_applications.py b/frappe/core/doctype/installed_applications/test_installed_applications.py
index ab9b849fa1..1d57fd2cd8 100644
--- a/frappe/core/doctype/installed_applications/test_installed_applications.py
+++ b/frappe/core/doctype/installed_applications/test_installed_applications.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/core/doctype/language/language.py b/frappe/core/doctype/language/language.py
index fb18abdf5e..01c8553e10 100644
--- a/frappe/core/doctype/language/language.py
+++ b/frappe/core/doctype/language/language.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe, json, re
from frappe import _
from frappe.model.document import Document
diff --git a/frappe/core/doctype/language/test_language.py b/frappe/core/doctype/language/test_language.py
index a4f35dd77b..837594247f 100644
--- a/frappe/core/doctype/language/test_language.py
+++ b/frappe/core/doctype/language/test_language.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/log_setting_user/log_setting_user.py b/frappe/core/doctype/log_setting_user/log_setting_user.py
index df6d55f0a9..64728b2c2b 100644
--- a/frappe/core/doctype/log_setting_user/log_setting_user.py
+++ b/frappe/core/doctype/log_setting_user/log_setting_user.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/core/doctype/log_setting_user/test_log_setting_user.py b/frappe/core/doctype/log_setting_user/test_log_setting_user.py
index 507c02d87d..c58b8faa66 100644
--- a/frappe/core/doctype/log_setting_user/test_log_setting_user.py
+++ b/frappe/core/doctype/log_setting_user/test_log_setting_user.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/core/doctype/log_settings/log_settings.py b/frappe/core/doctype/log_settings/log_settings.py
index 08e61d3289..e73aa8dac1 100644
--- a/frappe/core/doctype/log_settings/log_settings.py
+++ b/frappe/core/doctype/log_settings/log_settings.py
@@ -2,7 +2,6 @@
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
diff --git a/frappe/core/doctype/log_settings/test_log_settings.py b/frappe/core/doctype/log_settings/test_log_settings.py
index 2824c71c88..8e0c9c3f23 100644
--- a/frappe/core/doctype/log_settings/test_log_settings.py
+++ b/frappe/core/doctype/log_settings/test_log_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/core/doctype/module_def/__init__.py b/frappe/core/doctype/module_def/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/core/doctype/module_def/__init__.py
+++ b/frappe/core/doctype/module_def/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/core/doctype/module_def/module_def.py b/frappe/core/doctype/module_def/module_def.py
index 7e63572162..68025c83bb 100644
--- a/frappe/core/doctype/module_def/module_def.py
+++ b/frappe/core/doctype/module_def/module_def.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe, os, json
from frappe.model.document import Document
diff --git a/frappe/core/doctype/module_def/test_module_def.py b/frappe/core/doctype/module_def/test_module_def.py
index 1f9bea4768..3a3ceb4b57 100644
--- a/frappe/core/doctype/module_def/test_module_def.py
+++ b/frappe/core/doctype/module_def/test_module_def.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/module_profile/module_profile.py b/frappe/core/doctype/module_profile/module_profile.py
index 4f392353ac..373e5078d0 100644
--- a/frappe/core/doctype/module_profile/module_profile.py
+++ b/frappe/core/doctype/module_profile/module_profile.py
@@ -2,7 +2,6 @@
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
class ModuleProfile(Document):
diff --git a/frappe/core/doctype/module_profile/test_module_profile.py b/frappe/core/doctype/module_profile/test_module_profile.py
index 400053d22c..e0d9c13371 100644
--- a/frappe/core/doctype/module_profile/test_module_profile.py
+++ b/frappe/core/doctype/module_profile/test_module_profile.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
import frappe
import unittest
diff --git a/frappe/core/doctype/navbar_item/navbar_item.py b/frappe/core/doctype/navbar_item/navbar_item.py
index 614aee8eaf..a8fa611374 100644
--- a/frappe/core/doctype/navbar_item/navbar_item.py
+++ b/frappe/core/doctype/navbar_item/navbar_item.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/core/doctype/navbar_item/test_navbar_item.py b/frappe/core/doctype/navbar_item/test_navbar_item.py
index 192e8fe42a..85852a45e8 100644
--- a/frappe/core/doctype/navbar_item/test_navbar_item.py
+++ b/frappe/core/doctype/navbar_item/test_navbar_item.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/core/doctype/navbar_settings/navbar_settings.py b/frappe/core/doctype/navbar_settings/navbar_settings.py
index 2244bc9e4e..60aec67a00 100644
--- a/frappe/core/doctype/navbar_settings/navbar_settings.py
+++ b/frappe/core/doctype/navbar_settings/navbar_settings.py
@@ -2,7 +2,6 @@
# 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 import _
diff --git a/frappe/core/doctype/navbar_settings/test_navbar_settings.py b/frappe/core/doctype/navbar_settings/test_navbar_settings.py
index ed423b0f27..4d1ee72815 100644
--- a/frappe/core/doctype/navbar_settings/test_navbar_settings.py
+++ b/frappe/core/doctype/navbar_settings/test_navbar_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/core/doctype/page/__init__.py b/frappe/core/doctype/page/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/core/doctype/page/__init__.py
+++ b/frappe/core/doctype/page/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/core/doctype/page/page.py b/frappe/core/doctype/page/page.py
index bdec350efd..0ba0e309dd 100644
--- a/frappe/core/doctype/page/page.py
+++ b/frappe/core/doctype/page/page.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import os
from frappe.model.document import Document
@@ -11,7 +10,6 @@ from frappe import conf, _, safe_decode
from frappe.desk.form.meta import get_code_files_via_hooks, get_js
from frappe.desk.utils import validate_route_conflict
from frappe.core.doctype.custom_role.custom_role import get_custom_allowed_roles
-from six import text_type
class Page(Document):
def autoname(self):
diff --git a/frappe/core/doctype/page/test_page.py b/frappe/core/doctype/page/test_page.py
index f7b3952a5b..18b4aea2c8 100644
--- a/frappe/core/doctype/page/test_page.py
+++ b/frappe/core/doctype/page/test_page.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/patch_log/patch_log.py b/frappe/core/doctype/patch_log/patch_log.py
index 3103d44af4..cc66955eb8 100644
--- a/frappe/core/doctype/patch_log/patch_log.py
+++ b/frappe/core/doctype/patch_log/patch_log.py
@@ -3,7 +3,6 @@
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/patch_log/test_patch_log.py b/frappe/core/doctype/patch_log/test_patch_log.py
index 0a7f22a78b..d0690ecee0 100644
--- a/frappe/core/doctype/patch_log/test_patch_log.py
+++ b/frappe/core/doctype/patch_log/test_patch_log.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/payment_gateway/payment_gateway.py b/frappe/core/doctype/payment_gateway/payment_gateway.py
index 80799e311b..1459635b01 100644
--- a/frappe/core/doctype/payment_gateway/payment_gateway.py
+++ b/frappe/core/doctype/payment_gateway/payment_gateway.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/payment_gateway/test_payment_gateway.py b/frappe/core/doctype/payment_gateway/test_payment_gateway.py
index 2faf1a7fb4..66f899bd27 100644
--- a/frappe/core/doctype/payment_gateway/test_payment_gateway.py
+++ b/frappe/core/doctype/payment_gateway/test_payment_gateway.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/prepared_report/prepared_report.py b/frappe/core/doctype/prepared_report/prepared_report.py
index c27853f460..c68bb6a4f1 100644
--- a/frappe/core/doctype/prepared_report/prepared_report.py
+++ b/frappe/core/doctype/prepared_report/prepared_report.py
@@ -3,8 +3,6 @@
# For license information, please see license.txt
-from __future__ import unicode_literals
-
import json
import frappe
diff --git a/frappe/core/doctype/prepared_report/test_prepared_report.py b/frappe/core/doctype/prepared_report/test_prepared_report.py
index 17845be521..ef324dd01a 100644
--- a/frappe/core/doctype/prepared_report/test_prepared_report.py
+++ b/frappe/core/doctype/prepared_report/test_prepared_report.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
import json
diff --git a/frappe/core/doctype/report/__init__.py b/frappe/core/doctype/report/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/core/doctype/report/__init__.py
+++ b/frappe/core/doctype/report/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/core/doctype/report/report.py b/frappe/core/doctype/report/report.py
index 8a0f9a99f5..a5c61fa436 100644
--- a/frappe/core/doctype/report/report.py
+++ b/frappe/core/doctype/report/report.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals
import frappe
import json, datetime
from frappe import _, scrub
@@ -13,7 +11,6 @@ from frappe.modules import make_boilerplate
from frappe.core.doctype.page.page import delete_custom_role
from frappe.core.doctype.custom_role.custom_role import get_custom_allowed_roles
from frappe.desk.reportview import append_totals_row
-from six import iteritems
from frappe.utils.safe_exec import safe_exec
@@ -238,7 +235,7 @@ class Report(Document):
_filters = params.get('filters') or []
if filters:
- for key, value in iteritems(filters):
+ for key, value in filters.items():
condition, _value = '=', value
if isinstance(value, (list, tuple)):
condition, _value = value
diff --git a/frappe/core/doctype/report/test_report.py b/frappe/core/doctype/report/test_report.py
index d09799ca69..9d0c0b9af0 100644
--- a/frappe/core/doctype/report/test_report.py
+++ b/frappe/core/doctype/report/test_report.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
import frappe, json, os
import unittest
from frappe.desk.query_report import run, save_report
diff --git a/frappe/core/doctype/report_column/report_column.py b/frappe/core/doctype/report_column/report_column.py
index 69c88b7bda..f9078d820d 100644
--- a/frappe/core/doctype/report_column/report_column.py
+++ b/frappe/core/doctype/report_column/report_column.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/core/doctype/report_filter/report_filter.py b/frappe/core/doctype/report_filter/report_filter.py
index d85a1a5a65..ccdcc0eb6f 100644
--- a/frappe/core/doctype/report_filter/report_filter.py
+++ b/frappe/core/doctype/report_filter/report_filter.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/core/doctype/role/__init__.py b/frappe/core/doctype/role/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/core/doctype/role/__init__.py
+++ b/frappe/core/doctype/role/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/core/doctype/role/role.py b/frappe/core/doctype/role/role.py
index a1523db0dd..02482c75ca 100644
--- a/frappe/core/doctype/role/role.py
+++ b/frappe/core/doctype/role/role.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/role/test_role.py b/frappe/core/doctype/role/test_role.py
index 6459a72c98..471f6cac43 100644
--- a/frappe/core/doctype/role/test_role.py
+++ b/frappe/core/doctype/role/test_role.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/role_permission_for_page_and_report/role_permission_for_page_and_report.py b/frappe/core/doctype/role_permission_for_page_and_report/role_permission_for_page_and_report.py
index 77b523987c..59f34a1483 100644
--- a/frappe/core/doctype/role_permission_for_page_and_report/role_permission_for_page_and_report.py
+++ b/frappe/core/doctype/role_permission_for_page_and_report/role_permission_for_page_and_report.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.core.doctype.report.report import is_prepared_report_disabled
from frappe.model.document import Document
diff --git a/frappe/core/doctype/role_profile/role_profile.py b/frappe/core/doctype/role_profile/role_profile.py
index 4def834adb..0f58da5b5e 100644
--- a/frappe/core/doctype/role_profile/role_profile.py
+++ b/frappe/core/doctype/role_profile/role_profile.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
class RoleProfile(Document):
diff --git a/frappe/core/doctype/role_profile/test_role_profile.py b/frappe/core/doctype/role_profile/test_role_profile.py
index 975453e8d1..53e0a1b043 100644
--- a/frappe/core/doctype/role_profile/test_role_profile.py
+++ b/frappe/core/doctype/role_profile/test_role_profile.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
import frappe
import unittest
diff --git a/frappe/core/doctype/scheduled_job_log/scheduled_job_log.py b/frappe/core/doctype/scheduled_job_log/scheduled_job_log.py
index 26871c9adf..7f54a3b6ae 100644
--- a/frappe/core/doctype/scheduled_job_log/scheduled_job_log.py
+++ b/frappe/core/doctype/scheduled_job_log/scheduled_job_log.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/scheduled_job_log/test_scheduled_job_log.py b/frappe/core/doctype/scheduled_job_log/test_scheduled_job_log.py
index 1e5290425b..85471d0d71 100644
--- a/frappe/core/doctype/scheduled_job_log/test_scheduled_job_log.py
+++ b/frappe/core/doctype/scheduled_job_log/test_scheduled_job_log.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/core/doctype/scheduled_job_type/test_scheduled_job_type.py b/frappe/core/doctype/scheduled_job_type/test_scheduled_job_type.py
index d0a65defa4..a071cfe9a9 100644
--- a/frappe/core/doctype/scheduled_job_type/test_scheduled_job_type.py
+++ b/frappe/core/doctype/scheduled_job_type/test_scheduled_job_type.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
from frappe.utils import get_datetime
diff --git a/frappe/core/doctype/server_script/server_script.py b/frappe/core/doctype/server_script/server_script.py
index f80a067cf1..d26fe5a188 100644
--- a/frappe/core/doctype/server_script/server_script.py
+++ b/frappe/core/doctype/server_script/server_script.py
@@ -2,8 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
-
import ast
from types import FunctionType, MethodType, ModuleType
from typing import Dict, List
diff --git a/frappe/core/doctype/server_script/test_server_script.py b/frappe/core/doctype/server_script/test_server_script.py
index aac8b3deed..c39fcfa0d0 100644
--- a/frappe/core/doctype/server_script/test_server_script.py
+++ b/frappe/core/doctype/server_script/test_server_script.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
import requests
diff --git a/frappe/core/doctype/session_default/session_default.py b/frappe/core/doctype/session_default/session_default.py
index 8a8db46ff1..70ff103111 100644
--- a/frappe/core/doctype/session_default/session_default.py
+++ b/frappe/core/doctype/session_default/session_default.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/session_default_settings/session_default_settings.py b/frappe/core/doctype/session_default_settings/session_default_settings.py
index 7b4bd19e9a..25f7522c86 100644
--- a/frappe/core/doctype/session_default_settings/session_default_settings.py
+++ b/frappe/core/doctype/session_default_settings/session_default_settings.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
import json
diff --git a/frappe/core/doctype/session_default_settings/test_session_default_settings.py b/frappe/core/doctype/session_default_settings/test_session_default_settings.py
index 12aa14d343..7d20015b66 100644
--- a/frappe/core/doctype/session_default_settings/test_session_default_settings.py
+++ b/frappe/core/doctype/session_default_settings/test_session_default_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
from frappe.core.doctype.session_default_settings.session_default_settings import set_session_default_values, clear_session_defaults
diff --git a/frappe/core/doctype/sms_parameter/__init__.py b/frappe/core/doctype/sms_parameter/__init__.py
index baffc48825..8b13789179 100755
--- a/frappe/core/doctype/sms_parameter/__init__.py
+++ b/frappe/core/doctype/sms_parameter/__init__.py
@@ -1 +1 @@
-from __future__ import unicode_literals
+
diff --git a/frappe/core/doctype/sms_parameter/sms_parameter.py b/frappe/core/doctype/sms_parameter/sms_parameter.py
index 08b220b61a..d1fb1c53db 100644
--- a/frappe/core/doctype/sms_parameter/sms_parameter.py
+++ b/frappe/core/doctype/sms_parameter/sms_parameter.py
@@ -1,7 +1,6 @@
# 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.model.document import Document
diff --git a/frappe/core/doctype/sms_settings/__init__.py b/frappe/core/doctype/sms_settings/__init__.py
index baffc48825..8b13789179 100755
--- a/frappe/core/doctype/sms_settings/__init__.py
+++ b/frappe/core/doctype/sms_settings/__init__.py
@@ -1 +1 @@
-from __future__ import unicode_literals
+
diff --git a/frappe/core/doctype/sms_settings/sms_settings.py b/frappe/core/doctype/sms_settings/sms_settings.py
index ac835108c1..58a0ff08f6 100644
--- a/frappe/core/doctype/sms_settings/sms_settings.py
+++ b/frappe/core/doctype/sms_settings/sms_settings.py
@@ -2,15 +2,12 @@
# 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 import _, throw, msgprint
from frappe.utils import nowdate
from frappe.model.document import Document
-import six
-from six import string_types
class SMSSettings(Document):
pass
@@ -35,20 +32,20 @@ def validate_receiver_nos(receiver_list):
@frappe.whitelist()
def get_contact_number(contact_name, ref_doctype, ref_name):
"returns mobile number of the contact"
- number = frappe.db.sql("""select mobile_no, phone from tabContact
- where name=%s
+ number = frappe.db.sql("""select mobile_no, phone from tabContact
+ where name=%s
and exists(
select name from `tabDynamic Link` where link_doctype=%s and link_name=%s
)
""", (contact_name, ref_doctype, ref_name))
-
+
return number and (number[0][0] or number[0][1]) or ''
@frappe.whitelist()
def send_sms(receiver_list, msg, sender_name = '', success_msg = True):
import json
- if isinstance(receiver_list, string_types):
+ if isinstance(receiver_list, str):
receiver_list = json.loads(receiver_list)
if not isinstance(receiver_list, list):
receiver_list = [receiver_list]
diff --git a/frappe/core/doctype/sms_settings/test_sms_settings.py b/frappe/core/doctype/sms_settings/test_sms_settings.py
index b14fd3e4a0..862f5e3965 100644
--- a/frappe/core/doctype/sms_settings/test_sms_settings.py
+++ b/frappe/core/doctype/sms_settings/test_sms_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/success_action/success_action.py b/frappe/core/doctype/success_action/success_action.py
index f8b99f1fea..4ebd3d250b 100644
--- a/frappe/core/doctype/success_action/success_action.py
+++ b/frappe/core/doctype/success_action/success_action.py
@@ -2,7 +2,6 @@
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
class SuccessAction(Document):
diff --git a/frappe/core/doctype/system_settings/system_settings.py b/frappe/core/doctype/system_settings/system_settings.py
index 05aaca81de..466914569f 100644
--- a/frappe/core/doctype/system_settings/system_settings.py
+++ b/frappe/core/doctype/system_settings/system_settings.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
diff --git a/frappe/core/doctype/system_settings/test_system_settings.py b/frappe/core/doctype/system_settings/test_system_settings.py
index 82d0ddbd7c..a65c602abe 100644
--- a/frappe/core/doctype/system_settings/test_system_settings.py
+++ b/frappe/core/doctype/system_settings/test_system_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/test/test.py b/frappe/core/doctype/test/test.py
index 7e91b1cd4a..98e36e6a30 100644
--- a/frappe/core/doctype/test/test.py
+++ b/frappe/core/doctype/test/test.py
@@ -2,7 +2,6 @@
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
import json
diff --git a/frappe/core/doctype/test/test_test.py b/frappe/core/doctype/test/test_test.py
index 2a9b43bf95..d8ca975d63 100644
--- a/frappe/core/doctype/test/test_test.py
+++ b/frappe/core/doctype/test/test_test.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/core/doctype/transaction_log/test_transaction_log.py b/frappe/core/doctype/transaction_log/test_transaction_log.py
index 164a683c38..0d9b9353d0 100644
--- a/frappe/core/doctype/transaction_log/test_transaction_log.py
+++ b/frappe/core/doctype/transaction_log/test_transaction_log.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
import hashlib
@@ -35,7 +33,7 @@ class TestTransactionLog(unittest.TestCase):
sha = hashlib.sha256()
sha.update(
- frappe.safe_encode(str(third_log.transaction_hash)) +
+ frappe.safe_encode(str(third_log.transaction_hash)) +
frappe.safe_encode(str(second_log.chaining_hash))
)
diff --git a/frappe/core/doctype/transaction_log/transaction_log.py b/frappe/core/doctype/transaction_log/transaction_log.py
index b7ea6cac60..58d0b3d176 100644
--- a/frappe/core/doctype/transaction_log/transaction_log.py
+++ b/frappe/core/doctype/transaction_log/transaction_log.py
@@ -2,7 +2,6 @@
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
diff --git a/frappe/core/doctype/translation/test_translation.py b/frappe/core/doctype/translation/test_translation.py
index 12899dddf7..ae1293b38f 100644
--- a/frappe/core/doctype/translation/test_translation.py
+++ b/frappe/core/doctype/translation/test_translation.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/core/doctype/translation/translation.py b/frappe/core/doctype/translation/translation.py
index 177dea401f..b1f4642791 100644
--- a/frappe/core/doctype/translation/translation.py
+++ b/frappe/core/doctype/translation/translation.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, 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.utils import strip_html_tags, is_html
diff --git a/frappe/core/doctype/user/test_user.py b/frappe/core/doctype/user/test_user.py
index 5bea767934..392128834d 100644
--- a/frappe/core/doctype/user/test_user.py
+++ b/frappe/core/doctype/user/test_user.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, unittest, uuid
from frappe.model.delete_doc import delete_doc
diff --git a/frappe/core/doctype/user/user.py b/frappe/core/doctype/user/user.py
index a4d13a57e0..3fa31cbf80 100644
--- a/frappe/core/doctype/user/user.py
+++ b/frappe/core/doctype/user/user.py
@@ -1,10 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
-
from bs4 import BeautifulSoup
-
import frappe
import frappe.share
import frappe.defaults
diff --git a/frappe/core/doctype/user_document_type/user_document_type.py b/frappe/core/doctype/user_document_type/user_document_type.py
index 979bfcb250..48dbf87b3d 100644
--- a/frappe/core/doctype/user_document_type/user_document_type.py
+++ b/frappe/core/doctype/user_document_type/user_document_type.py
@@ -2,7 +2,6 @@
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/user_email/user_email.py b/frappe/core/doctype/user_email/user_email.py
index a0ce2e169d..729aa03444 100644
--- a/frappe/core/doctype/user_email/user_email.py
+++ b/frappe/core/doctype/user_email/user_email.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/user_group/test_user_group.py b/frappe/core/doctype/user_group/test_user_group.py
index c7e28f3d31..2f89d032e1 100644
--- a/frappe/core/doctype/user_group/test_user_group.py
+++ b/frappe/core/doctype/user_group/test_user_group.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/core/doctype/user_group/user_group.py b/frappe/core/doctype/user_group/user_group.py
index b1d0fede4c..178775d407 100644
--- a/frappe/core/doctype/user_group/user_group.py
+++ b/frappe/core/doctype/user_group/user_group.py
@@ -2,7 +2,6 @@
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
import frappe
diff --git a/frappe/core/doctype/user_group_member/test_user_group_member.py b/frappe/core/doctype/user_group_member/test_user_group_member.py
index 38aade4608..8dbaed9e65 100644
--- a/frappe/core/doctype/user_group_member/test_user_group_member.py
+++ b/frappe/core/doctype/user_group_member/test_user_group_member.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/core/doctype/user_group_member/user_group_member.py b/frappe/core/doctype/user_group_member/user_group_member.py
index 4d0656913d..f85ddc3209 100644
--- a/frappe/core/doctype/user_group_member/user_group_member.py
+++ b/frappe/core/doctype/user_group_member/user_group_member.py
@@ -2,7 +2,6 @@
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/user_permission/test_user_permission.py b/frappe/core/doctype/user_permission/test_user_permission.py
index 47651fee72..1a442b53e7 100644
--- a/frappe/core/doctype/user_permission/test_user_permission.py
+++ b/frappe/core/doctype/user_permission/test_user_permission.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
from frappe.core.doctype.user_permission.user_permission import add_user_permissions, remove_applicable
from frappe.permissions import has_user_permission
from frappe.core.doctype.doctype.test_doctype import new_doctype
diff --git a/frappe/core/doctype/user_permission/user_permission.py b/frappe/core/doctype/user_permission/user_permission.py
index fec5019ca9..42ca4d7a14 100644
--- a/frappe/core/doctype/user_permission/user_permission.py
+++ b/frappe/core/doctype/user_permission/user_permission.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe, json
from frappe.model.document import Document
from frappe.permissions import (get_valid_perms, update_permission_property)
diff --git a/frappe/core/doctype/user_select_document_type/user_select_document_type.py b/frappe/core/doctype/user_select_document_type/user_select_document_type.py
index 373eaf7aa3..13e3f0d351 100644
--- a/frappe/core/doctype/user_select_document_type/user_select_document_type.py
+++ b/frappe/core/doctype/user_select_document_type/user_select_document_type.py
@@ -2,7 +2,6 @@
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/user_social_login/user_social_login.py b/frappe/core/doctype/user_social_login/user_social_login.py
index cc6c3d0e05..4a34006d2b 100644
--- a/frappe/core/doctype/user_social_login/user_social_login.py
+++ b/frappe/core/doctype/user_social_login/user_social_login.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
class UserSocialLogin(Document):
diff --git a/frappe/core/doctype/user_type/test_user_type.py b/frappe/core/doctype/user_type/test_user_type.py
index de61e0f476..1c47f02bbb 100644
--- a/frappe/core/doctype/user_type/test_user_type.py
+++ b/frappe/core/doctype/user_type/test_user_type.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/core/doctype/user_type/user_type.py b/frappe/core/doctype/user_type/user_type.py
index 0e8b692416..e7d06c45f2 100644
--- a/frappe/core/doctype/user_type/user_type.py
+++ b/frappe/core/doctype/user_type/user_type.py
@@ -2,10 +2,8 @@
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
-from six import iteritems
from frappe.utils import get_link_to_form
from frappe.config import get_modules_from_app
from frappe.permissions import add_permission, add_user_permission
@@ -247,7 +245,7 @@ def apply_permissions_for_non_standard_user_type(doc, method=None):
if not user_types:
return
- for user_type, data in iteritems(user_types):
+ for user_type, data in user_types.items():
if (not doc.get(data[1]) or doc.doctype != data[0]):
continue
diff --git a/frappe/core/doctype/user_type/user_type_dashboard.py b/frappe/core/doctype/user_type/user_type_dashboard.py
index 7e14198bca..6cdd2f82a5 100644
--- a/frappe/core/doctype/user_type/user_type_dashboard.py
+++ b/frappe/core/doctype/user_type/user_type_dashboard.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
from frappe import _
def get_data():
diff --git a/frappe/core/doctype/user_type_module/user_type_module.py b/frappe/core/doctype/user_type_module/user_type_module.py
index 6cd2cbacdb..9afbcd294d 100644
--- a/frappe/core/doctype/user_type_module/user_type_module.py
+++ b/frappe/core/doctype/user_type_module/user_type_module.py
@@ -2,7 +2,6 @@
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/core/doctype/version/test_version.py b/frappe/core/doctype/version/test_version.py
index 51b3c21f58..f6c099c4ea 100644
--- a/frappe/core/doctype/version/test_version.py
+++ b/frappe/core/doctype/version/test_version.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest, copy
from frappe.test_runner import make_test_objects
diff --git a/frappe/core/doctype/version/version.py b/frappe/core/doctype/version/version.py
index 7654db4ae5..a1bd851346 100644
--- a/frappe/core/doctype/version/version.py
+++ b/frappe/core/doctype/version/version.py
@@ -3,7 +3,6 @@
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe, json
from frappe.model.document import Document
diff --git a/frappe/core/doctype/view_log/test_view_log.py b/frappe/core/doctype/view_log/test_view_log.py
index 83967a39a4..025f3d8ad9 100644
--- a/frappe/core/doctype/view_log/test_view_log.py
+++ b/frappe/core/doctype/view_log/test_view_log.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
@@ -25,11 +23,11 @@ class TestViewLog(unittest.TestCase):
# load the form
getdoc('Event', ev.name)
a = frappe.get_value(
- doctype="View Log",
+ doctype="View Log",
filters={
"reference_doctype": "Event",
"reference_name": ev.name
- },
+ },
fieldname=['viewed_by']
)
diff --git a/frappe/core/doctype/view_log/view_log.py b/frappe/core/doctype/view_log/view_log.py
index 45e98e37c7..242250be8b 100644
--- a/frappe/core/doctype/view_log/view_log.py
+++ b/frappe/core/doctype/view_log/view_log.py
@@ -2,7 +2,6 @@
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/core/notifications.py b/frappe/core/notifications.py
index 771a15a2e7..707de43f28 100644
--- a/frappe/core/notifications.py
+++ b/frappe/core/notifications.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def get_notification_config():
diff --git a/frappe/core/page/__init__.py b/frappe/core/page/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/core/page/__init__.py
+++ b/frappe/core/page/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/core/page/permission_manager/permission_manager.py b/frappe/core/page/permission_manager/permission_manager.py
index 1c215eb6e1..15c7cb55ae 100644
--- a/frappe/core/page/permission_manager/permission_manager.py
+++ b/frappe/core/page/permission_manager/permission_manager.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
import frappe.defaults
diff --git a/frappe/core/report/permitted_documents_for_user/permitted_documents_for_user.py b/frappe/core/report/permitted_documents_for_user/permitted_documents_for_user.py
index c928939119..13602ca777 100644
--- a/frappe/core/report/permitted_documents_for_user/permitted_documents_for_user.py
+++ b/frappe/core/report/permitted_documents_for_user/permitted_documents_for_user.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _, throw
import frappe.utils.user
diff --git a/frappe/core/report/transaction_log_report/transaction_log_report.py b/frappe/core/report/transaction_log_report/transaction_log_report.py
index 9d84901f22..ff8d8345d6 100644
--- a/frappe/core/report/transaction_log_report/transaction_log_report.py
+++ b/frappe/core/report/transaction_log_report/transaction_log_report.py
@@ -1,7 +1,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
import hashlib
from frappe import _
diff --git a/frappe/core/utils.py b/frappe/core/utils.py
index 55cfbc34d7..9b8ee3a326 100644
--- a/frappe/core/utils.py
+++ b/frappe/core/utils.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
diff --git a/frappe/core/web_form/edit_profile/edit_profile.py b/frappe/core/web_form/edit_profile/edit_profile.py
index 2334f8b26d..e1ada61927 100644
--- a/frappe/core/web_form/edit_profile/edit_profile.py
+++ b/frappe/core/web_form/edit_profile/edit_profile.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import frappe
def get_context(context):
diff --git a/frappe/custom/doctype/client_script/__init__.py b/frappe/custom/doctype/client_script/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/custom/doctype/client_script/__init__.py
+++ b/frappe/custom/doctype/client_script/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/custom/doctype/client_script/client_script.py b/frappe/custom/doctype/client_script/client_script.py
index 049f979263..9c098fe8c9 100644
--- a/frappe/custom/doctype/client_script/client_script.py
+++ b/frappe/custom/doctype/client_script/client_script.py
@@ -1,6 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
diff --git a/frappe/custom/doctype/client_script/test_client_script.py b/frappe/custom/doctype/client_script/test_client_script.py
index de113c1ce7..b8358468b9 100644
--- a/frappe/custom/doctype/client_script/test_client_script.py
+++ b/frappe/custom/doctype/client_script/test_client_script.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/custom/doctype/custom_field/__init__.py b/frappe/custom/doctype/custom_field/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/custom/doctype/custom_field/__init__.py
+++ b/frappe/custom/doctype/custom_field/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/custom/doctype/custom_field/custom_field.py b/frappe/custom/doctype/custom_field/custom_field.py
index 39aff8b4a7..7e6ea1875a 100644
--- a/frappe/custom/doctype/custom_field/custom_field.py
+++ b/frappe/custom/doctype/custom_field/custom_field.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import json
from frappe.utils import cstr
diff --git a/frappe/custom/doctype/custom_field/test_custom_field.py b/frappe/custom/doctype/custom_field/test_custom_field.py
index 819917050a..3196b66ee8 100644
--- a/frappe/custom/doctype/custom_field/test_custom_field.py
+++ b/frappe/custom/doctype/custom_field/test_custom_field.py
@@ -3,8 +3,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/custom/doctype/customize_form/__init__.py b/frappe/custom/doctype/customize_form/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/custom/doctype/customize_form/__init__.py
+++ b/frappe/custom/doctype/customize_form/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/custom/doctype/customize_form/customize_form.py b/frappe/custom/doctype/customize_form/customize_form.py
index be0dded99c..8bcc6cf059 100644
--- a/frappe/custom/doctype/customize_form/customize_form.py
+++ b/frappe/custom/doctype/customize_form/customize_form.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
"""
Customize Form is a Single DocType used to mask the Property Setter
Thus providing a better UI from user perspective
diff --git a/frappe/custom/doctype/customize_form/test_customize_form.py b/frappe/custom/doctype/customize_form/test_customize_form.py
index 75555a8205..58bdcf9a18 100644
--- a/frappe/custom/doctype/customize_form/test_customize_form.py
+++ b/frappe/custom/doctype/customize_form/test_customize_form.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe, unittest, json
from frappe.test_runner import make_test_records_for_doctype
from frappe.core.doctype.doctype.doctype import InvalidFieldNameError
diff --git a/frappe/custom/doctype/customize_form_field/__init__.py b/frappe/custom/doctype/customize_form_field/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/custom/doctype/customize_form_field/__init__.py
+++ b/frappe/custom/doctype/customize_form_field/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/custom/doctype/customize_form_field/customize_form_field.py b/frappe/custom/doctype/customize_form_field/customize_form_field.py
index 20c206328c..f288e70754 100644
--- a/frappe/custom/doctype/customize_form_field/customize_form_field.py
+++ b/frappe/custom/doctype/customize_form_field/customize_form_field.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/custom/doctype/doctype_layout/doctype_layout.py b/frappe/custom/doctype/doctype_layout/doctype_layout.py
index a4fe9a9bce..0dc320353d 100644
--- a/frappe/custom/doctype/doctype_layout/doctype_layout.py
+++ b/frappe/custom/doctype/doctype_layout/doctype_layout.py
@@ -2,8 +2,6 @@
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
-
from frappe.model.document import Document
from frappe.desk.utils import slug
diff --git a/frappe/custom/doctype/doctype_layout/test_doctype_layout.py b/frappe/custom/doctype/doctype_layout/test_doctype_layout.py
index 5765c86262..dcde3c00a4 100644
--- a/frappe/custom/doctype/doctype_layout/test_doctype_layout.py
+++ b/frappe/custom/doctype/doctype_layout/test_doctype_layout.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/custom/doctype/doctype_layout_field/doctype_layout_field.py b/frappe/custom/doctype/doctype_layout_field/doctype_layout_field.py
index 7f8c8edfce..c1e963602f 100644
--- a/frappe/custom/doctype/doctype_layout_field/doctype_layout_field.py
+++ b/frappe/custom/doctype/doctype_layout_field/doctype_layout_field.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/custom/doctype/property_setter/__init__.py b/frappe/custom/doctype/property_setter/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/custom/doctype/property_setter/__init__.py
+++ b/frappe/custom/doctype/property_setter/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/custom/doctype/property_setter/property_setter.py b/frappe/custom/doctype/property_setter/property_setter.py
index 56e5829271..2a6c06b70a 100644
--- a/frappe/custom/doctype/property_setter/property_setter.py
+++ b/frappe/custom/doctype/property_setter/property_setter.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
diff --git a/frappe/custom/doctype/property_setter/test_property_setter.py b/frappe/custom/doctype/property_setter/test_property_setter.py
index 33e7d288a4..4d4de66d51 100644
--- a/frappe/custom/doctype/property_setter/test_property_setter.py
+++ b/frappe/custom/doctype/property_setter/test_property_setter.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/custom/doctype/test_rename_new/test_rename_new.py b/frappe/custom/doctype/test_rename_new/test_rename_new.py
index aa5984e466..32d2396b2b 100644
--- a/frappe/custom/doctype/test_rename_new/test_rename_new.py
+++ b/frappe/custom/doctype/test_rename_new/test_rename_new.py
@@ -2,7 +2,6 @@
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/custom/doctype/test_rename_new/test_test_rename_new.py b/frappe/custom/doctype/test_rename_new/test_test_rename_new.py
index 554efbae45..b3ea4818de 100644
--- a/frappe/custom/doctype/test_rename_new/test_test_rename_new.py
+++ b/frappe/custom/doctype/test_rename_new/test_test_rename_new.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/data_migration/doctype/data_migration_connector/connectors/base.py b/frappe/data_migration/doctype/data_migration_connector/connectors/base.py
index 97f9f5f4a3..5eca7cfac5 100644
--- a/frappe/data_migration/doctype/data_migration_connector/connectors/base.py
+++ b/frappe/data_migration/doctype/data_migration_connector/connectors/base.py
@@ -1,10 +1,7 @@
-from __future__ import unicode_literals
-from six import with_metaclass
from abc import ABCMeta, abstractmethod
from frappe.utils.password import get_decrypted_password
-class BaseConnection(with_metaclass(ABCMeta)):
-
+class BaseConnection(metaclass=ABCMeta):
@abstractmethod
def get(self, remote_objectname, fields=None, filters=None, start=0, page_length=10):
pass
diff --git a/frappe/data_migration/doctype/data_migration_connector/connectors/frappe_connection.py b/frappe/data_migration/doctype/data_migration_connector/connectors/frappe_connection.py
index 6ee41afdf2..473a15c2dc 100644
--- a/frappe/data_migration/doctype/data_migration_connector/connectors/frappe_connection.py
+++ b/frappe/data_migration/doctype/data_migration_connector/connectors/frappe_connection.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.frappeclient import FrappeClient
from .base import BaseConnection
diff --git a/frappe/data_migration/doctype/data_migration_connector/data_migration_connector.py b/frappe/data_migration/doctype/data_migration_connector/data_migration_connector.py
index 793dfe6694..d1137f2e67 100644
--- a/frappe/data_migration/doctype/data_migration_connector/data_migration_connector.py
+++ b/frappe/data_migration/doctype/data_migration_connector/data_migration_connector.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe, os
from frappe.model.document import Document
from frappe import _
@@ -76,8 +75,7 @@ def get_connection_class(python_module):
return _class
-connection_boilerplate = """from __future__ import unicode_literals
-from frappe.data_migration.doctype.data_migration_connector.connectors.base import BaseConnection
+connection_boilerplate = """from frappe.data_migration.doctype.data_migration_connector.connectors.base import BaseConnection
class {connection_class}(BaseConnection):
def __init__(self, connector):
diff --git a/frappe/data_migration/doctype/data_migration_connector/test_data_migration_connector.py b/frappe/data_migration/doctype/data_migration_connector/test_data_migration_connector.py
index a6e30fbe44..fd45f86ec1 100644
--- a/frappe/data_migration/doctype/data_migration_connector/test_data_migration_connector.py
+++ b/frappe/data_migration/doctype/data_migration_connector/test_data_migration_connector.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
import unittest
class TestDataMigrationConnector(unittest.TestCase):
diff --git a/frappe/data_migration/doctype/data_migration_mapping/data_migration_mapping.py b/frappe/data_migration/doctype/data_migration_mapping/data_migration_mapping.py
index 1cc54a0d1a..5cb20ba56c 100644
--- a/frappe/data_migration/doctype/data_migration_mapping/data_migration_mapping.py
+++ b/frappe/data_migration/doctype/data_migration_mapping/data_migration_mapping.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, 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.utils.safe_exec import get_safe_globals
diff --git a/frappe/data_migration/doctype/data_migration_mapping/test_data_migration_mapping.py b/frappe/data_migration/doctype/data_migration_mapping/test_data_migration_mapping.py
index e6f0ce2796..df11fc0522 100644
--- a/frappe/data_migration/doctype/data_migration_mapping/test_data_migration_mapping.py
+++ b/frappe/data_migration/doctype/data_migration_mapping/test_data_migration_mapping.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
import unittest
class TestDataMigrationMapping(unittest.TestCase):
diff --git a/frappe/data_migration/doctype/data_migration_mapping_detail/data_migration_mapping_detail.py b/frappe/data_migration/doctype/data_migration_mapping_detail/data_migration_mapping_detail.py
index 1ccdf76eed..6d3ef50937 100644
--- a/frappe/data_migration/doctype/data_migration_mapping_detail/data_migration_mapping_detail.py
+++ b/frappe/data_migration/doctype/data_migration_mapping_detail/data_migration_mapping_detail.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
class DataMigrationMappingDetail(Document):
diff --git a/frappe/data_migration/doctype/data_migration_plan/data_migration_plan.py b/frappe/data_migration/doctype/data_migration_plan/data_migration_plan.py
index 5cd195f4fe..a8d0e40a4c 100644
--- a/frappe/data_migration/doctype/data_migration_plan/data_migration_plan.py
+++ b/frappe/data_migration/doctype/data_migration_plan/data_migration_plan.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.modules import get_module_path, scrub_dt_dn
from frappe.modules.export_file import export_to_files, create_init_py
diff --git a/frappe/data_migration/doctype/data_migration_plan/test_data_migration_plan.py b/frappe/data_migration/doctype/data_migration_plan/test_data_migration_plan.py
index 3a33039c3d..14c585a82d 100644
--- a/frappe/data_migration/doctype/data_migration_plan/test_data_migration_plan.py
+++ b/frappe/data_migration/doctype/data_migration_plan/test_data_migration_plan.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
import unittest
class TestDataMigrationPlan(unittest.TestCase):
diff --git a/frappe/data_migration/doctype/data_migration_plan_mapping/data_migration_plan_mapping.py b/frappe/data_migration/doctype/data_migration_plan_mapping/data_migration_plan_mapping.py
index 85f879069c..ba4cf28eb8 100644
--- a/frappe/data_migration/doctype/data_migration_plan_mapping/data_migration_plan_mapping.py
+++ b/frappe/data_migration/doctype/data_migration_plan_mapping/data_migration_plan_mapping.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
class DataMigrationPlanMapping(Document):
diff --git a/frappe/data_migration/doctype/data_migration_run/data_migration_run.py b/frappe/data_migration/doctype/data_migration_run/data_migration_run.py
index aed9c6cb1d..c35af5827b 100644
--- a/frappe/data_migration/doctype/data_migration_run/data_migration_run.py
+++ b/frappe/data_migration/doctype/data_migration_run/data_migration_run.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe, json, math
from frappe.model.document import Document
from frappe import _
diff --git a/frappe/data_migration/doctype/data_migration_run/test_data_migration_run.py b/frappe/data_migration/doctype/data_migration_run/test_data_migration_run.py
index c6c3ea138c..ef7b70dca2 100644
--- a/frappe/data_migration/doctype/data_migration_run/test_data_migration_run.py
+++ b/frappe/data_migration/doctype/data_migration_run/test_data_migration_run.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
import frappe, unittest
class TestDataMigrationRun(unittest.TestCase):
diff --git a/frappe/database/__init__.py b/frappe/database/__init__.py
index 1f0d3f9bf5..a899bec3d1 100644
--- a/frappe/database/__init__.py
+++ b/frappe/database/__init__.py
@@ -4,8 +4,6 @@
# Database Module
# --------------------
-from __future__ import unicode_literals
-
def setup_database(force, source_sql=None, verbose=None, no_mariadb_socket=False):
import frappe
if frappe.conf.db_type == 'postgres':
diff --git a/frappe/database/database.py b/frappe/database/database.py
index c9c1ec3909..7e8d2da43b 100644
--- a/frappe/database/database.py
+++ b/frappe/database/database.py
@@ -4,8 +4,6 @@
# Database Module
# --------------------
-from __future__ import unicode_literals
-
import re
import time
import frappe
@@ -19,13 +17,6 @@ from frappe.utils import now, getdate, cast_fieldtype, get_datetime
from frappe.model.utils.link_count import flush_local_link_count
from frappe.utils import cint
-# imports - compatibility imports
-from six import (
- integer_types,
- string_types,
- text_type,
- iteritems
-)
class Database(object):
"""
@@ -277,7 +268,7 @@ class Database(object):
for r in result:
values = []
for value in r:
- if as_utf8 and isinstance(value, text_type):
+ if as_utf8 and isinstance(value, str):
value = value.encode('utf-8')
values.append(value)
@@ -294,7 +285,7 @@ class Database(object):
"""Returns true if the first row in the result has a Date, Datetime, Long Int."""
if result and result[0]:
for v in result[0]:
- if isinstance(v, (datetime.date, datetime.timedelta, datetime.datetime, integer_types)):
+ if isinstance(v, (datetime.date, datetime.timedelta, datetime.datetime, int)):
return True
if formatted and isinstance(v, (int, float)):
return True
@@ -312,7 +303,7 @@ class Database(object):
for r in res:
nr = []
for val in r:
- if as_utf8 and isinstance(val, text_type):
+ if as_utf8 and isinstance(val, str):
val = val.encode('utf-8')
nr.append(val)
nres.append(nr)
@@ -363,7 +354,7 @@ class Database(object):
# docname is a number, convert to string
filters = str(filters)
- if isinstance(filters, string_types):
+ if isinstance(filters, str):
filters = { "name": filters }
for f in filters:
@@ -428,7 +419,7 @@ class Database(object):
user = frappe.db.get_values("User", "test@example.com", "*")[0]
"""
out = None
- if cache and isinstance(filters, string_types) and \
+ if cache and isinstance(filters, str) and \
(doctype, filters, fieldname) in self.value_cache:
return self.value_cache[(doctype, filters, fieldname)]
@@ -440,7 +431,7 @@ class Database(object):
else:
fields = fieldname
if fieldname!="*":
- if isinstance(fieldname, string_types):
+ if isinstance(fieldname, str):
fields = [fieldname]
else:
fields = fieldname
@@ -461,7 +452,7 @@ class Database(object):
else:
out = self.get_values_from_single(fields, filters, doctype, as_dict, debug, update)
- if cache and isinstance(filters, string_types):
+ if cache and isinstance(filters, str):
self.value_cache[(doctype, filters, fieldname)] = out
return out
@@ -673,7 +664,7 @@ class Database(object):
where field in ({0}) and
doctype=%s'''.format(', '.join(['%s']*len(keys))),
list(keys) + [dt], debug=debug)
- for key, value in iteritems(to_update):
+ for key, value in to_update.items():
self.sql('''insert into `tabSingles` (doctype, field, value) values (%s, %s, %s)''',
(dt, key, value), debug=debug)
@@ -811,7 +802,7 @@ class Database(object):
:param dt: DocType name.
:param dn: Document name or filter dict."""
- if isinstance(dt, string_types):
+ if isinstance(dt, str):
if dt!="DocType" and dt==dn:
return True # single always exists (!)
try:
diff --git a/frappe/database/mariadb/schema.py b/frappe/database/mariadb/schema.py
index 4bbecd2a2e..b40af59286 100644
--- a/frappe/database/mariadb/schema.py
+++ b/frappe/database/mariadb/schema.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import frappe
from frappe import _
from frappe.database.schema import DBTable
diff --git a/frappe/database/mariadb/setup_db.py b/frappe/database/mariadb/setup_db.py
index 9b73d77171..6be08c66bb 100644
--- a/frappe/database/mariadb/setup_db.py
+++ b/frappe/database/mariadb/setup_db.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import frappe
import os
from frappe.database.db_manager import DbManager
diff --git a/frappe/database/postgres/database.py b/frappe/database/postgres/database.py
index 6ac2767a71..8235277e30 100644
--- a/frappe/database/postgres/database.py
+++ b/frappe/database/postgres/database.py
@@ -2,7 +2,6 @@ import re
import frappe
import psycopg2
import psycopg2.extensions
-from six import string_types
from frappe.utils import cstr
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
@@ -253,7 +252,7 @@ class PostgresDatabase(Database):
self.sql("""CREATE INDEX IF NOT EXISTS "{}" ON `{}`("{}")""".format(index_name, table_name, '", "'.join(fields)))
def add_unique(self, doctype, fields, constraint_name=None):
- if isinstance(fields, string_types):
+ if isinstance(fields, str):
fields = [fields]
if not constraint_name:
constraint_name = "unique_" + "_".join(fields)
diff --git a/frappe/database/postgres/setup_db.py b/frappe/database/postgres/setup_db.py
index 3ee6b6a286..19ba681237 100644
--- a/frappe/database/postgres/setup_db.py
+++ b/frappe/database/postgres/setup_db.py
@@ -83,7 +83,6 @@ def get_root_connection(root_login=None, root_password=None):
root_login = frappe.conf.get("root_login") or None
if not root_login:
- from six.moves import input
root_login = input("Enter postgres super user: ")
if not root_password:
diff --git a/frappe/database/schema.py b/frappe/database/schema.py
index 5f5ba06d8b..31f11dbd5e 100644
--- a/frappe/database/schema.py
+++ b/frappe/database/schema.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import re
import frappe
diff --git a/frappe/defaults.py b/frappe/defaults.py
index 4bec6677c7..fde48d71ff 100644
--- a/frappe/defaults.py
+++ b/frappe/defaults.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.desk.notifications import clear_notifications
from frappe.cache_manager import clear_defaults_cache, common_default_keys
diff --git a/frappe/desk/__init__.py b/frappe/desk/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/desk/__init__.py
+++ b/frappe/desk/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/desk/calendar.py b/frappe/desk/calendar.py
index 064d870092..f00f729415 100644
--- a/frappe/desk/calendar.py
+++ b/frappe/desk/calendar.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
from frappe import _
import json
diff --git a/frappe/desk/desk_page.py b/frappe/desk/desk_page.py
index 6c5fdc6821..d373dbda0e 100644
--- a/frappe/desk/desk_page.py
+++ b/frappe/desk/desk_page.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.translate import send_translations
diff --git a/frappe/desk/desktop.py b/frappe/desk/desktop.py
index 1a3b1ca99b..0a7d436169 100644
--- a/frappe/desk/desktop.py
+++ b/frappe/desk/desktop.py
@@ -2,12 +2,10 @@
# MIT License. See license.txt
# Author - Shivam Mishra
-from __future__ import unicode_literals
import frappe
from json import loads, dumps
from frappe import _, DoesNotExistError, ValidationError, _dict
from frappe.boot import get_allowed_pages, get_allowed_reports
-from six import string_types
from functools import wraps
from frappe.cache_manager import (
build_domain_restriced_doctype_cache,
@@ -61,7 +59,7 @@ class Workspace:
shortcuts = self.doc.shortcuts + self.extended_shortcuts
for section in cards:
- links = loads(section.get('links')) if isinstance(section.get('links'), string_types) else section.get('links')
+ links = loads(section.get('links')) if isinstance(section.get('links'), str) else section.get('links')
for item in links:
if self.is_item_allowed(item.get('link_to'), item.get('link_type')):
return True
diff --git a/frappe/desk/doctype/bulk_update/bulk_update.py b/frappe/desk/doctype/bulk_update/bulk_update.py
index 9b9f7d7a73..469ee839f1 100644
--- a/frappe/desk/doctype/bulk_update/bulk_update.py
+++ b/frappe/desk/doctype/bulk_update/bulk_update.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, 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 import _
diff --git a/frappe/desk/doctype/calendar_view/calendar_view.py b/frappe/desk/doctype/calendar_view/calendar_view.py
index ae8ab1eb46..3a986f3273 100644
--- a/frappe/desk/doctype/calendar_view/calendar_view.py
+++ b/frappe/desk/doctype/calendar_view/calendar_view.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
class CalendarView(Document):
diff --git a/frappe/desk/doctype/console_log/console_log.py b/frappe/desk/doctype/console_log/console_log.py
index 635c4c1ba7..5d0f1cfa93 100644
--- a/frappe/desk/doctype/console_log/console_log.py
+++ b/frappe/desk/doctype/console_log/console_log.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/desk/doctype/console_log/test_console_log.py b/frappe/desk/doctype/console_log/test_console_log.py
index 04dc4f241f..3bb1605204 100644
--- a/frappe/desk/doctype/console_log/test_console_log.py
+++ b/frappe/desk/doctype/console_log/test_console_log.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/desk/doctype/dashboard/dashboard.py b/frappe/desk/doctype/dashboard/dashboard.py
index 4e66318769..d2e79279d9 100644
--- a/frappe/desk/doctype/dashboard/dashboard.py
+++ b/frappe/desk/doctype/dashboard/dashboard.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
from frappe.modules.export_file import export_to_files
from frappe.config import get_modules_from_all_apps_for_user
diff --git a/frappe/desk/doctype/dashboard/test_dashboard.py b/frappe/desk/doctype/dashboard/test_dashboard.py
index d5485d8f70..dd1bc31d86 100644
--- a/frappe/desk/doctype/dashboard/test_dashboard.py
+++ b/frappe/desk/doctype/dashboard/test_dashboard.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
class TestDashboard(unittest.TestCase):
diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.py b/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
index 48b34e6cd9..3bea6eded9 100644
--- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
+++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
import datetime
diff --git a/frappe/desk/doctype/dashboard_chart/test_dashboard_chart.py b/frappe/desk/doctype/dashboard_chart/test_dashboard_chart.py
index 72ab18385d..78d133b2d5 100644
--- a/frappe/desk/doctype/dashboard_chart/test_dashboard_chart.py
+++ b/frappe/desk/doctype/dashboard_chart/test_dashboard_chart.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest, frappe
from frappe.utils import getdate, formatdate, get_last_day
from frappe.utils.dateutils import get_period_ending, get_period
diff --git a/frappe/desk/doctype/dashboard_chart_field/dashboard_chart_field.py b/frappe/desk/doctype/dashboard_chart_field/dashboard_chart_field.py
index 734f27cc28..7d6f66daa2 100644
--- a/frappe/desk/doctype/dashboard_chart_field/dashboard_chart_field.py
+++ b/frappe/desk/doctype/dashboard_chart_field/dashboard_chart_field.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/desk/doctype/dashboard_chart_link/dashboard_chart_link.py b/frappe/desk/doctype/dashboard_chart_link/dashboard_chart_link.py
index 7cd4f9daa3..359801a303 100644
--- a/frappe/desk/doctype/dashboard_chart_link/dashboard_chart_link.py
+++ b/frappe/desk/doctype/dashboard_chart_link/dashboard_chart_link.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/desk/doctype/dashboard_chart_source/dashboard_chart_source.py b/frappe/desk/doctype/dashboard_chart_source/dashboard_chart_source.py
index 6685009078..791dbc563b 100644
--- a/frappe/desk/doctype/dashboard_chart_source/dashboard_chart_source.py
+++ b/frappe/desk/doctype/dashboard_chart_source/dashboard_chart_source.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe, os
from frappe import _
from frappe.model.document import Document
diff --git a/frappe/desk/doctype/dashboard_chart_source/test_dashboard_chart_source.py b/frappe/desk/doctype/dashboard_chart_source/test_dashboard_chart_source.py
index 822526b591..53fe127dfb 100644
--- a/frappe/desk/doctype/dashboard_chart_source/test_dashboard_chart_source.py
+++ b/frappe/desk/doctype/dashboard_chart_source/test_dashboard_chart_source.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
class TestDashboardChartSource(unittest.TestCase):
diff --git a/frappe/desk/doctype/dashboard_settings/dashboard_settings.py b/frappe/desk/doctype/dashboard_settings/dashboard_settings.py
index 4697d897fc..df61c52114 100644
--- a/frappe/desk/doctype/dashboard_settings/dashboard_settings.py
+++ b/frappe/desk/doctype/dashboard_settings/dashboard_settings.py
@@ -2,7 +2,6 @@
# 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
import frappe
diff --git a/frappe/desk/doctype/desktop_icon/desktop_icon.py b/frappe/desk/doctype/desktop_icon/desktop_icon.py
index fcf10ef61d..81a79cdb09 100644
--- a/frappe/desk/doctype/desktop_icon/desktop_icon.py
+++ b/frappe/desk/doctype/desktop_icon/desktop_icon.py
@@ -2,14 +2,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
-
import frappe
from frappe import _
import json
import random
from frappe.model.document import Document
-from six import iteritems, string_types
from frappe.utils.user import UserPermissions
class DesktopIcon(Document):
@@ -173,7 +170,7 @@ def add_user_icon(_doctype, _report=None, label=None, link=None, type='link', st
@frappe.whitelist()
def set_order(new_order, user=None):
'''set new order by duplicating user icons (if user is set) or set global order'''
- if isinstance(new_order, string_types):
+ if isinstance(new_order, str):
new_order = json.loads(new_order)
for i, module_name in enumerate(new_order):
if module_name not in ('Explore',):
@@ -232,7 +229,7 @@ def set_hidden_list(hidden_list, user=None):
'''Sets property `hidden`=1 in **Desktop Icon** for given user.
If user is None then it will set global values.
It will also set the rest of the icons as shown (`hidden` = 0)'''
- if isinstance(hidden_list, string_types):
+ if isinstance(hidden_list, str):
hidden_list = json.loads(hidden_list)
# set as hidden
@@ -329,7 +326,7 @@ def sync_from_app(app):
if isinstance(modules, dict):
modules_list = []
- for m, desktop_icon in iteritems(modules):
+ for m, desktop_icon in modules.items():
desktop_icon['module_name'] = m
modules_list.append(desktop_icon)
else:
diff --git a/frappe/desk/doctype/event/__init__.py b/frappe/desk/doctype/event/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/desk/doctype/event/__init__.py
+++ b/frappe/desk/doctype/event/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/desk/doctype/event/event.py b/frappe/desk/doctype/event/event.py
index 54905bed6a..57c89eaf2e 100644
--- a/frappe/desk/doctype/event/event.py
+++ b/frappe/desk/doctype/event/event.py
@@ -1,9 +1,7 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-from six.moves import range
-from six import string_types
+
import frappe
import json
@@ -106,7 +104,7 @@ class Event(Document):
@frappe.whitelist()
def delete_communication(event, reference_doctype, reference_docname):
deleted_participant = frappe.get_doc(reference_doctype, reference_docname)
- if isinstance(event, string_types):
+ if isinstance(event, str):
event = json.loads(event)
filters = [
@@ -168,7 +166,7 @@ def get_events(start, end, user=None, for_reminder=False, filters=None):
if not user:
user = frappe.session.user
- if isinstance(filters, string_types):
+ if isinstance(filters, str):
filters = json.loads(filters)
filter_condition = get_filters_cond('Event', filters, [])
diff --git a/frappe/desk/doctype/event/test_event.py b/frappe/desk/doctype/event/test_event.py
index 2926a74a55..77211946a9 100644
--- a/frappe/desk/doctype/event/test_event.py
+++ b/frappe/desk/doctype/event/test_event.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
"""Use blog post test to test user permissions logic"""
import frappe
diff --git a/frappe/desk/doctype/event_participants/event_participants.py b/frappe/desk/doctype/event_participants/event_participants.py
index 18e4672140..ca4fae9930 100644
--- a/frappe/desk/doctype/event_participants/event_participants.py
+++ b/frappe/desk/doctype/event_participants/event_participants.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
class EventParticipants(Document):
diff --git a/frappe/desk/doctype/global_search_doctype/global_search_doctype.py b/frappe/desk/doctype/global_search_doctype/global_search_doctype.py
index 4c9a948278..de8a48af01 100644
--- a/frappe/desk/doctype/global_search_doctype/global_search_doctype.py
+++ b/frappe/desk/doctype/global_search_doctype/global_search_doctype.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/desk/doctype/global_search_settings/global_search_settings.py b/frappe/desk/doctype/global_search_settings/global_search_settings.py
index 85c9687ab3..28a1ed8239 100644
--- a/frappe/desk/doctype/global_search_settings/global_search_settings.py
+++ b/frappe/desk/doctype/global_search_settings/global_search_settings.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, 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 import _
diff --git a/frappe/desk/doctype/kanban_board/kanban_board.py b/frappe/desk/doctype/kanban_board/kanban_board.py
index a655e9e1da..5100727f43 100644
--- a/frappe/desk/doctype/kanban_board/kanban_board.py
+++ b/frappe/desk/doctype/kanban_board/kanban_board.py
@@ -2,12 +2,10 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
import json
from frappe import _
from frappe.model.document import Document
-from six import iteritems
class KanbanBoard(Document):
@@ -107,7 +105,7 @@ def update_order(board_name, order):
order_dict = json.loads(order)
updated_cards = []
- for col_name, cards in iteritems(order_dict):
+ for col_name, cards in order_dict.items():
order_list = []
for card in cards:
column = frappe.get_value(
diff --git a/frappe/desk/doctype/kanban_board/test_kanban_board.py b/frappe/desk/doctype/kanban_board/test_kanban_board.py
index 33947f4a54..f9503d736a 100644
--- a/frappe/desk/doctype/kanban_board/test_kanban_board.py
+++ b/frappe/desk/doctype/kanban_board/test_kanban_board.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/desk/doctype/kanban_board_column/kanban_board_column.py b/frappe/desk/doctype/kanban_board_column/kanban_board_column.py
index 4ea30d21b2..aebba3351c 100644
--- a/frappe/desk/doctype/kanban_board_column/kanban_board_column.py
+++ b/frappe/desk/doctype/kanban_board_column/kanban_board_column.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/desk/doctype/list_filter/list_filter.py b/frappe/desk/doctype/list_filter/list_filter.py
index 035f7e90b9..2467ae40a4 100644
--- a/frappe/desk/doctype/list_filter/list_filter.py
+++ b/frappe/desk/doctype/list_filter/list_filter.py
@@ -2,7 +2,6 @@
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe, json
from frappe.model.document import Document
diff --git a/frappe/desk/doctype/list_view_settings/list_view_settings.py b/frappe/desk/doctype/list_view_settings/list_view_settings.py
index 74e029f499..f4a288b7ba 100644
--- a/frappe/desk/doctype/list_view_settings/list_view_settings.py
+++ b/frappe/desk/doctype/list_view_settings/list_view_settings.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/desk/doctype/list_view_settings/test_list_view_settings.py b/frappe/desk/doctype/list_view_settings/test_list_view_settings.py
index c1b2f4a0da..00010d7604 100644
--- a/frappe/desk/doctype/list_view_settings/test_list_view_settings.py
+++ b/frappe/desk/doctype/list_view_settings/test_list_view_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/desk/doctype/module_onboarding/module_onboarding.py b/frappe/desk/doctype/module_onboarding/module_onboarding.py
index 8315c0b304..6f01e0fd8d 100644
--- a/frappe/desk/doctype/module_onboarding/module_onboarding.py
+++ b/frappe/desk/doctype/module_onboarding/module_onboarding.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/desk/doctype/module_onboarding/test_module_onboarding.py b/frappe/desk/doctype/module_onboarding/test_module_onboarding.py
index ef305667b1..39184401a1 100644
--- a/frappe/desk/doctype/module_onboarding/test_module_onboarding.py
+++ b/frappe/desk/doctype/module_onboarding/test_module_onboarding.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/desk/doctype/note/note.py b/frappe/desk/doctype/note/note.py
index c54689418e..790f9a514c 100644
--- a/frappe/desk/doctype/note/note.py
+++ b/frappe/desk/doctype/note/note.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/desk/doctype/note/test_note.py b/frappe/desk/doctype/note/test_note.py
index 38894a9c3d..1bb1730357 100644
--- a/frappe/desk/doctype/note/test_note.py
+++ b/frappe/desk/doctype/note/test_note.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
-from __future__ import unicode_literals
import frappe
import unittest
diff --git a/frappe/desk/doctype/note_seen_by/note_seen_by.py b/frappe/desk/doctype/note_seen_by/note_seen_by.py
index 6123f20929..cec4628b20 100644
--- a/frappe/desk/doctype/note_seen_by/note_seen_by.py
+++ b/frappe/desk/doctype/note_seen_by/note_seen_by.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/desk/doctype/notification_log/notification_log.py b/frappe/desk/doctype/notification_log/notification_log.py
index 25af92f532..414f272f59 100644
--- a/frappe/desk/doctype/notification_log/notification_log.py
+++ b/frappe/desk/doctype/notification_log/notification_log.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
diff --git a/frappe/desk/doctype/notification_log/test_notification_log.py b/frappe/desk/doctype/notification_log/test_notification_log.py
index e59aee30c9..af4dee8df3 100644
--- a/frappe/desk/doctype/notification_log/test_notification_log.py
+++ b/frappe/desk/doctype/notification_log/test_notification_log.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
from frappe.desk.form.assign_to import add as assign_task
import unittest
diff --git a/frappe/desk/doctype/notification_settings/notification_settings.py b/frappe/desk/doctype/notification_settings/notification_settings.py
index 4ab40bffe9..eb3a16435f 100644
--- a/frappe/desk/doctype/notification_settings/notification_settings.py
+++ b/frappe/desk/doctype/notification_settings/notification_settings.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/desk/doctype/notification_subscribed_document/notification_subscribed_document.py b/frappe/desk/doctype/notification_subscribed_document/notification_subscribed_document.py
index f005efae76..6931e77754 100644
--- a/frappe/desk/doctype/notification_subscribed_document/notification_subscribed_document.py
+++ b/frappe/desk/doctype/notification_subscribed_document/notification_subscribed_document.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/desk/doctype/number_card/number_card.py b/frappe/desk/doctype/number_card/number_card.py
index 7d1a697f6b..d8d5fe0953 100644
--- a/frappe/desk/doctype/number_card/number_card.py
+++ b/frappe/desk/doctype/number_card/number_card.py
@@ -2,7 +2,6 @@
# 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.utils import cint
diff --git a/frappe/desk/doctype/number_card/test_number_card.py b/frappe/desk/doctype/number_card/test_number_card.py
index 4aa1ecf282..c395f5f915 100644
--- a/frappe/desk/doctype/number_card/test_number_card.py
+++ b/frappe/desk/doctype/number_card/test_number_card.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/desk/doctype/number_card_link/number_card_link.py b/frappe/desk/doctype/number_card_link/number_card_link.py
index 67ad7e70cd..6c16f45f4b 100644
--- a/frappe/desk/doctype/number_card_link/number_card_link.py
+++ b/frappe/desk/doctype/number_card_link/number_card_link.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/desk/doctype/onboarding_permission/onboarding_permission.py b/frappe/desk/doctype/onboarding_permission/onboarding_permission.py
index f8772480df..40d3dc33b1 100644
--- a/frappe/desk/doctype/onboarding_permission/onboarding_permission.py
+++ b/frappe/desk/doctype/onboarding_permission/onboarding_permission.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/desk/doctype/onboarding_permission/test_onboarding_permission.py b/frappe/desk/doctype/onboarding_permission/test_onboarding_permission.py
index 9a7e8ae6fd..80b166de0a 100644
--- a/frappe/desk/doctype/onboarding_permission/test_onboarding_permission.py
+++ b/frappe/desk/doctype/onboarding_permission/test_onboarding_permission.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/desk/doctype/onboarding_step/onboarding_step.py b/frappe/desk/doctype/onboarding_step/onboarding_step.py
index e1cc5dfba4..10bd8926ce 100644
--- a/frappe/desk/doctype/onboarding_step/onboarding_step.py
+++ b/frappe/desk/doctype/onboarding_step/onboarding_step.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/desk/doctype/onboarding_step/test_onboarding_step.py b/frappe/desk/doctype/onboarding_step/test_onboarding_step.py
index 66bd0c6660..2425577478 100644
--- a/frappe/desk/doctype/onboarding_step/test_onboarding_step.py
+++ b/frappe/desk/doctype/onboarding_step/test_onboarding_step.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/desk/doctype/onboarding_step_map/onboarding_step_map.py b/frappe/desk/doctype/onboarding_step_map/onboarding_step_map.py
index ea34de6088..c79244c4ad 100644
--- a/frappe/desk/doctype/onboarding_step_map/onboarding_step_map.py
+++ b/frappe/desk/doctype/onboarding_step_map/onboarding_step_map.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/desk/doctype/route_history/route_history.py b/frappe/desk/doctype/route_history/route_history.py
index 12d898afa5..b82077f485 100644
--- a/frappe/desk/doctype/route_history/route_history.py
+++ b/frappe/desk/doctype/route_history/route_history.py
@@ -2,7 +2,6 @@
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/desk/doctype/system_console/system_console.py b/frappe/desk/doctype/system_console/system_console.py
index 6c87ca8c36..e2b5656bc0 100644
--- a/frappe/desk/doctype/system_console/system_console.py
+++ b/frappe/desk/doctype/system_console/system_console.py
@@ -2,8 +2,6 @@
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
-
import json
import frappe
diff --git a/frappe/desk/doctype/system_console/test_system_console.py b/frappe/desk/doctype/system_console/test_system_console.py
index 55ef199122..743c2d6dde 100644
--- a/frappe/desk/doctype/system_console/test_system_console.py
+++ b/frappe/desk/doctype/system_console/test_system_console.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/desk/doctype/tag/tag.py b/frappe/desk/doctype/tag/tag.py
index 7e016ee91b..3c67bb4668 100644
--- a/frappe/desk/doctype/tag/tag.py
+++ b/frappe/desk/doctype/tag/tag.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, 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.utils import unique
diff --git a/frappe/desk/doctype/tag/test_tag.py b/frappe/desk/doctype/tag/test_tag.py
index 8efd692f43..442a891fd8 100644
--- a/frappe/desk/doctype/tag/test_tag.py
+++ b/frappe/desk/doctype/tag/test_tag.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/desk/doctype/tag_link/tag_link.py b/frappe/desk/doctype/tag_link/tag_link.py
index 87c8af7212..4c5149f42c 100644
--- a/frappe/desk/doctype/tag_link/tag_link.py
+++ b/frappe/desk/doctype/tag_link/tag_link.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/desk/doctype/tag_link/test_tag_link.py b/frappe/desk/doctype/tag_link/test_tag_link.py
index 1c22ac18bc..297ee3cc96 100644
--- a/frappe/desk/doctype/tag_link/test_tag_link.py
+++ b/frappe/desk/doctype/tag_link/test_tag_link.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/desk/doctype/todo/__init__.py b/frappe/desk/doctype/todo/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/desk/doctype/todo/__init__.py
+++ b/frappe/desk/doctype/todo/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/desk/doctype/todo/test_todo.py b/frappe/desk/doctype/todo/test_todo.py
index de5b6724a6..b38e4a059a 100644
--- a/frappe/desk/doctype/todo/test_todo.py
+++ b/frappe/desk/doctype/todo/test_todo.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
from frappe.model.db_query import DatabaseQuery
diff --git a/frappe/desk/doctype/todo/todo.py b/frappe/desk/doctype/todo/todo.py
index a766375fde..4696563445 100644
--- a/frappe/desk/doctype/todo/todo.py
+++ b/frappe/desk/doctype/todo/todo.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import json
@@ -93,7 +92,7 @@ def get_permission_query_conditions(user):
if not user: user = frappe.session.user
todo_roles = frappe.permissions.get_doctype_roles('ToDo')
- if 'All' in todo_roles:
+ if 'All' in todo_roles:
todo_roles.remove('All')
if any(check in todo_roles for check in frappe.get_roles(user)):
@@ -105,7 +104,7 @@ def get_permission_query_conditions(user):
def has_permission(doc, ptype="read", user=None):
user = user or frappe.session.user
todo_roles = frappe.permissions.get_doctype_roles('ToDo', ptype)
- if 'All' in todo_roles:
+ if 'All' in todo_roles:
todo_roles.remove('All')
if any(check in todo_roles for check in frappe.get_roles(user)):
diff --git a/frappe/desk/doctype/workspace/test_workspace.py b/frappe/desk/doctype/workspace/test_workspace.py
index 7a3f122ee2..619b3608eb 100644
--- a/frappe/desk/doctype/workspace/test_workspace.py
+++ b/frappe/desk/doctype/workspace/test_workspace.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/desk/doctype/workspace/workspace.py b/frappe/desk/doctype/workspace/workspace.py
index 0934138821..0329e0f7d2 100644
--- a/frappe/desk/doctype/workspace/workspace.py
+++ b/frappe/desk/doctype/workspace/workspace.py
@@ -2,7 +2,6 @@
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.modules.export_file import export_to_files
diff --git a/frappe/desk/doctype/workspace_chart/workspace_chart.py b/frappe/desk/doctype/workspace_chart/workspace_chart.py
index 0bb6194d2e..6ec7abfd3c 100644
--- a/frappe/desk/doctype/workspace_chart/workspace_chart.py
+++ b/frappe/desk/doctype/workspace_chart/workspace_chart.py
@@ -2,7 +2,6 @@
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/desk/doctype/workspace_link/workspace_link.py b/frappe/desk/doctype/workspace_link/workspace_link.py
index 8a139077a6..d6ccc5306a 100644
--- a/frappe/desk/doctype/workspace_link/workspace_link.py
+++ b/frappe/desk/doctype/workspace_link/workspace_link.py
@@ -2,7 +2,6 @@
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/desk/doctype/workspace_shortcut/workspace_shortcut.py b/frappe/desk/doctype/workspace_shortcut/workspace_shortcut.py
index d676f08b73..83b446e454 100644
--- a/frappe/desk/doctype/workspace_shortcut/workspace_shortcut.py
+++ b/frappe/desk/doctype/workspace_shortcut/workspace_shortcut.py
@@ -2,7 +2,6 @@
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/desk/form/__init__.py b/frappe/desk/form/__init__.py
index 4dbcd0d163..0e57cb68c3 100644
--- a/frappe/desk/form/__init__.py
+++ b/frappe/desk/form/__init__.py
@@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
diff --git a/frappe/desk/form/assign_to.py b/frappe/desk/form/assign_to.py
index aee7a8e52a..3eda291d1e 100644
--- a/frappe/desk/form/assign_to.py
+++ b/frappe/desk/form/assign_to.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
"""assign/unassign to ToDo"""
import frappe
diff --git a/frappe/desk/form/document_follow.py b/frappe/desk/form/document_follow.py
index f5e5c0ca9b..7f65f76a58 100644
--- a/frappe/desk/form/document_follow.py
+++ b/frappe/desk/form/document_follow.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import frappe.utils
from frappe.utils import get_url_to_form
diff --git a/frappe/desk/form/linked_with.py b/frappe/desk/form/linked_with.py
index a62e2837d5..12880604a2 100644
--- a/frappe/desk/form/linked_with.py
+++ b/frappe/desk/form/linked_with.py
@@ -1,9 +1,7 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import json
from collections import defaultdict
-from six import string_types
import frappe
import frappe.desk.form.load
import frappe.desk.form.meta
@@ -87,7 +85,7 @@ def cancel_all_linked_docs(docs, ignore_doctypes_on_cancel_all=[]):
"""
docs = json.loads(docs)
- if isinstance(ignore_doctypes_on_cancel_all, string_types):
+ if isinstance(ignore_doctypes_on_cancel_all, str):
ignore_doctypes_on_cancel_all = json.loads(ignore_doctypes_on_cancel_all)
for i, doc in enumerate(docs, 1):
if validate_linked_doc(doc, ignore_doctypes_on_cancel_all):
@@ -139,7 +137,7 @@ def get_exempted_doctypes():
@frappe.whitelist()
def get_linked_docs(doctype, name, linkinfo=None, for_doctype=None):
- if isinstance(linkinfo, string_types):
+ if isinstance(linkinfo, str):
# additional fields are added in linkinfo
linkinfo = json.loads(linkinfo)
@@ -202,7 +200,7 @@ def get_linked_docs(doctype, name, linkinfo=None, for_doctype=None):
else:
link_fieldnames = link.get("fieldname")
if link_fieldnames:
- if isinstance(link_fieldnames, string_types): link_fieldnames = [link_fieldnames]
+ if isinstance(link_fieldnames, str): link_fieldnames = [link_fieldnames]
or_filters = [[dt, fieldname, '=', name] for fieldname in link_fieldnames]
# dynamic link
if link.get("doctype_fieldname"):
diff --git a/frappe/desk/form/load.py b/frappe/desk/form/load.py
index d81bb8c26c..a62bfd01d0 100644
--- a/frappe/desk/form/load.py
+++ b/frappe/desk/form/load.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe, json
import frappe.utils
import frappe.share
@@ -11,7 +10,7 @@ from frappe.model.utils.user_settings import get_user_settings
from frappe.permissions import get_doc_permissions
from frappe.desk.form.document_follow import is_document_followed
from frappe import _
-from six.moves.urllib.parse import quote
+from urllib.parse import quote
@frappe.whitelist(allow_guest=True)
def getdoc(doctype, name, user=None):
diff --git a/frappe/desk/form/meta.py b/frappe/desk/form/meta.py
index 087cc54d9d..947a9e5d4b 100644
--- a/frappe/desk/form/meta.py
+++ b/frappe/desk/form/meta.py
@@ -2,9 +2,7 @@
# MIT License. See license.txt
# metadata
-
-from __future__ import unicode_literals
-import frappe, os
+import frappe, os, io
from frappe.model.meta import Meta
from frappe.modules import scrub, get_module_path, load_doctype_module
from frappe.utils import get_html_format
@@ -12,9 +10,6 @@ from frappe.translate import make_dict_from_messages, extract_messages_from_code
from frappe.model.utils import render_include
from frappe.build import scrub_html_template
-import io
-
-from six import iteritems
def get_meta(doctype, cached=True):
# don't cache for developer mode as js files, templates may be edited
@@ -199,7 +194,7 @@ class FormMeta(Meta):
app = module.__name__.split(".")[0]
templates = {}
if hasattr(module, "form_grid_templates"):
- for key, path in iteritems(module.form_grid_templates):
+ for key, path in module.form_grid_templates.items():
templates[key] = get_html_format(frappe.get_app_path(app, path))
self.set("__form_grid_templates", templates)
diff --git a/frappe/desk/form/save.py b/frappe/desk/form/save.py
index da43b14fce..a7a4b829d8 100644
--- a/frappe/desk/form/save.py
+++ b/frappe/desk/form/save.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe, json
from frappe.desk.form.load import run_onload
diff --git a/frappe/desk/form/test_form.py b/frappe/desk/form/test_form.py
index ff0343b6e0..f3c4132777 100644
--- a/frappe/desk/form/test_form.py
+++ b/frappe/desk/form/test_form.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe, unittest
from frappe.desk.form.linked_with import get_linked_docs, get_linked_doctypes
diff --git a/frappe/desk/form/utils.py b/frappe/desk/form/utils.py
index 395d2b9571..bfceee6ea2 100644
--- a/frappe/desk/form/utils.py
+++ b/frappe/desk/form/utils.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe, json
import frappe.desk.form.meta
import frappe.desk.form.load
@@ -9,7 +8,6 @@ from frappe.desk.form.document_follow import follow_document
from frappe.utils.file_manager import extract_images_from_html
from frappe import _
-from six import string_types
@frappe.whitelist()
def remove_attach():
@@ -90,7 +88,7 @@ def get_next(doctype, value, prev, filters=None, sort_order='desc', sort_field='
prev = int(prev)
if not filters: filters = []
- if isinstance(filters, string_types):
+ if isinstance(filters, str):
filters = json.loads(filters)
# # condition based on sort order
diff --git a/frappe/desk/gantt.py b/frappe/desk/gantt.py
index 521884beaa..7f0889c751 100644
--- a/frappe/desk/gantt.py
+++ b/frappe/desk/gantt.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, json
@frappe.whitelist()
diff --git a/frappe/desk/leaderboard.py b/frappe/desk/leaderboard.py
index d651687256..a98ae1a1c6 100644
--- a/frappe/desk/leaderboard.py
+++ b/frappe/desk/leaderboard.py
@@ -1,5 +1,3 @@
-
-from __future__ import unicode_literals, print_function
import frappe
from frappe.utils import get_fullname
diff --git a/frappe/desk/like.py b/frappe/desk/like.py
index 6d2e9704af..d44d58a761 100644
--- a/frappe/desk/like.py
+++ b/frappe/desk/like.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
"""Allow adding of likes to documents"""
import frappe, json
diff --git a/frappe/desk/listview.py b/frappe/desk/listview.py
index 91dc0f3ba9..d2c84d36bf 100644
--- a/frappe/desk/listview.py
+++ b/frappe/desk/listview.py
@@ -1,7 +1,5 @@
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
@frappe.whitelist(allow_guest=True)
diff --git a/frappe/desk/moduleview.py b/frappe/desk/moduleview.py
index df25b77e2d..021698ac92 100644
--- a/frappe/desk/moduleview.py
+++ b/frappe/desk/moduleview.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import json
from frappe import _
diff --git a/frappe/desk/notifications.py b/frappe/desk/notifications.py
index 4b584a2429..c84027928e 100644
--- a/frappe/desk/notifications.py
+++ b/frappe/desk/notifications.py
@@ -1,11 +1,8 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
from frappe.desk.doctype.notification_settings.notification_settings import get_subscribed_documents
-from six import string_types
import json
@frappe.whitelist()
@@ -149,7 +146,7 @@ def clear_doctype_notifications(doc, method=None, *args, **kwargs):
config = get_notification_config()
if not config:
return
- if isinstance(doc, string_types):
+ if isinstance(doc, str):
doctype = doc # assuming doctype name was passed directly
else:
doctype = doc.doctype
@@ -213,7 +210,7 @@ def get_filters_for(doctype):
'''get open filters for doctype'''
config = get_notification_config()
doctype_config = config.get("for_doctype").get(doctype, {})
- filters = doctype_config if not isinstance(doctype_config, string_types) else None
+ filters = doctype_config if not isinstance(doctype_config, str) else None
return filters
diff --git a/frappe/desk/page/activity/__init__.py b/frappe/desk/page/activity/__init__.py
index baffc48825..8b13789179 100644
--- a/frappe/desk/page/activity/__init__.py
+++ b/frappe/desk/page/activity/__init__.py
@@ -1 +1 @@
-from __future__ import unicode_literals
+
diff --git a/frappe/desk/page/activity/activity.py b/frappe/desk/page/activity/activity.py
index 7de294d2f0..3abc8e0ea5 100644
--- a/frappe/desk/page/activity/activity.py
+++ b/frappe/desk/page/activity/activity.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.utils import cint
from frappe.core.doctype.activity_log.feed import get_feed_match_conditions
diff --git a/frappe/desk/page/backups/backups.py b/frappe/desk/page/backups/backups.py
index eaa0c65143..2229a6d89e 100644
--- a/frappe/desk/page/backups/backups.py
+++ b/frappe/desk/page/backups/backups.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import os
import frappe
from frappe import _
diff --git a/frappe/desk/page/leaderboard/leaderboard.py b/frappe/desk/page/leaderboard/leaderboard.py
index 819e7fe9d1..9469096f50 100644
--- a/frappe/desk/page/leaderboard/leaderboard.py
+++ b/frappe/desk/page/leaderboard/leaderboard.py
@@ -1,7 +1,5 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
import frappe
@frappe.whitelist()
diff --git a/frappe/desk/page/setup_wizard/install_fixtures.py b/frappe/desk/page/setup_wizard/install_fixtures.py
index 6d3aaee22b..06301cdeaf 100644
--- a/frappe/desk/page/setup_wizard/install_fixtures.py
+++ b/frappe/desk/page/setup_wizard/install_fixtures.py
@@ -1,8 +1,6 @@
# 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 import _
from frappe.desk.doctype.global_search_settings.global_search_settings import update_global_search_doctypes
diff --git a/frappe/desk/page/setup_wizard/setup_wizard.py b/frappe/desk/page/setup_wizard/setup_wizard.py
index 1ac5279508..5edb44e182 100755
--- a/frappe/desk/page/setup_wizard/setup_wizard.py
+++ b/frappe/desk/page/setup_wizard/setup_wizard.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: See license.txt
-from __future__ import unicode_literals
-
import frappe, json, os
from frappe.utils import strip, cint
from frappe.translate import (set_default_language, get_dict, send_translations)
@@ -10,7 +8,6 @@ from frappe.geo.country_info import get_country_info
from frappe.utils.password import update_password
from werkzeug.useragents import UserAgent
from . import install_fixtures
-from six import string_types
def get_setup_stages(args):
@@ -208,14 +205,14 @@ def update_user_name(args):
def parse_args(args):
if not args:
args = frappe.local.form_dict
- if isinstance(args, string_types):
+ if isinstance(args, str):
args = json.loads(args)
args = frappe._dict(args)
# strip the whitespace
for key, value in args.items():
- if isinstance(value, string_types):
+ if isinstance(value, str):
args[key] = strip(value)
return args
@@ -294,7 +291,7 @@ def reset_is_first_startup():
def prettify_args(args):
# remove attachments
for key, val in args.items():
- if isinstance(val, string_types) and "data:image" in val:
+ if isinstance(val, str) and "data:image" in val:
filename = val.split("data:image", 1)[0].strip(", ")
size = round((len(val) * 3 / 4) / 1048576.0, 2)
args[key] = "Image Attached: '{0}' of size {1} MB".format(filename, size)
diff --git a/frappe/desk/query_report.py b/frappe/desk/query_report.py
index befaf7b01f..3c0ebf11c1 100644
--- a/frappe/desk/query_report.py
+++ b/frappe/desk/query_report.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
import os
import json
@@ -22,7 +20,6 @@ from frappe.model.utils import render_include
from frappe.translate import send_translations
import frappe.desk.reportview
from frappe.permissions import get_role_permissions
-from six import string_types, iteritems
from datetime import timedelta
from frappe.core.utils import ljust_list
@@ -66,7 +63,7 @@ def generate_report_result(report, filters=None, user=None, custom_columns=None)
user = user or frappe.session.user
filters = filters or []
- if filters and isinstance(filters, string_types):
+ if filters and isinstance(filters, str):
filters = json.loads(filters)
res = []
@@ -222,7 +219,7 @@ def run(report_name, filters=None, user=None, ignore_prepared_report=False, cust
and not custom_columns
):
if filters:
- if isinstance(filters, string_types):
+ if isinstance(filters, str):
filters = json.loads(filters)
dn = filters.get("prepared_report_name")
@@ -317,7 +314,7 @@ def export_query():
data.pop("cmd", None)
data.pop("csrf_token", None)
- if isinstance(data.get("filters"), string_types):
+ if isinstance(data.get("filters"), str):
filters = json.loads(data["filters"])
if data.get("report_name"):
@@ -332,7 +329,7 @@ def export_query():
include_indentation = data.get("include_indentation")
visible_idx = data.get("visible_idx")
- if isinstance(visible_idx, string_types):
+ if isinstance(visible_idx, str):
visible_idx = json.loads(visible_idx)
if file_format_type == "Excel":
@@ -363,7 +360,7 @@ def export_query():
def handle_duration_fieldtype_values(result, columns):
for i, col in enumerate(columns):
fieldtype = None
- if isinstance(col, string_types):
+ if isinstance(col, str):
col = col.split(":")
if len(col) > 1:
if col[1]:
@@ -433,7 +430,7 @@ def add_total_row(result, columns, meta=None):
has_percent = []
for i, col in enumerate(columns):
fieldtype, options, fieldname = None, None, None
- if isinstance(col, string_types):
+ if isinstance(col, str):
if meta:
# get fieldtype from the meta
field = meta.get_field(col)
@@ -483,7 +480,7 @@ def add_total_row(result, columns, meta=None):
total_row[i] = flt(total_row[i]) / len(result)
first_col_fieldtype = None
- if isinstance(columns[0], string_types):
+ if isinstance(columns[0], str):
first_col = columns[0].split(":")
if len(first_col) > 1:
first_col_fieldtype = first_col[1].split("/")[0]
@@ -701,7 +698,7 @@ def get_linked_doctypes(columns, data):
if val and col not in columns_with_value:
columns_with_value.append(col)
- items = list(iteritems(linked_doctypes))
+ items = list(linked_doctypes.items())
for doctype, key in items:
if key not in columns_with_value:
@@ -728,7 +725,7 @@ def get_column_as_dict(col):
col_dict = frappe._dict()
# string
- if isinstance(col, string_types):
+ if isinstance(col, str):
col = col.split(":")
if len(col) > 1:
if "/" in col[1]:
diff --git a/frappe/desk/report/todo/todo.py b/frappe/desk/report/todo/todo.py
index f4fe2dc805..6bd22b843e 100644
--- a/frappe/desk/report/todo/todo.py
+++ b/frappe/desk/report/todo/todo.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import getdate
diff --git a/frappe/desk/report_dump.py b/frappe/desk/report_dump.py
index 86b1765814..b2d3ca3443 100644
--- a/frappe/desk/report_dump.py
+++ b/frappe/desk/report_dump.py
@@ -1,8 +1,7 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-from six.moves import range
+
import frappe
import json
import copy
diff --git a/frappe/desk/reportview.py b/frappe/desk/reportview.py
index 86f8ec0aa7..55515856f1 100644
--- a/frappe/desk/reportview.py
+++ b/frappe/desk/reportview.py
@@ -1,16 +1,14 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
"""build query for doclistview and return results"""
import frappe, json
-from six.moves import range
import frappe.permissions
from frappe.model.db_query import DatabaseQuery
from frappe.model import default_fields, optional_fields
from frappe import _
-from six import string_types, StringIO
+from io import StringIO
from frappe.core.doctype.access_log.access_log import make_access_log
from frappe.utils import cstr, format_duration
from frappe.model.base_document import get_controller
@@ -171,7 +169,7 @@ def get_meta_and_docfield(fieldname, data):
return meta, df
def update_wildcard_field_param(data):
- if ((isinstance(data.fields, string_types) and data.fields == "*")
+ if ((isinstance(data.fields, str) and data.fields == "*")
or (isinstance(data.fields, (list, tuple)) and len(data.fields) == 1 and data.fields[0] == "*")):
data.fields = frappe.db.get_table_columns(data.doctype)
return True
@@ -191,15 +189,15 @@ def clean_params(data):
def parse_json(data):
- if isinstance(data.get("filters"), string_types):
+ if isinstance(data.get("filters"), str):
data["filters"] = json.loads(data["filters"])
- if isinstance(data.get("or_filters"), string_types):
+ if isinstance(data.get("or_filters"), str):
data["or_filters"] = json.loads(data["or_filters"])
- if isinstance(data.get("fields"), string_types):
+ if isinstance(data.get("fields"), str):
data["fields"] = json.loads(data["fields"])
- if isinstance(data.get("docstatus"), string_types):
+ if isinstance(data.get("docstatus"), str):
data["docstatus"] = json.loads(data["docstatus"])
- if isinstance(data.get("save_user_settings"), string_types):
+ if isinstance(data.get("save_user_settings"), str):
data["save_user_settings"] = json.loads(data["save_user_settings"])
else:
data["save_user_settings"] = True
@@ -311,7 +309,7 @@ def export_query():
for r in data:
# encode only unicode type strings and not int, floats etc.
writer.writerow([handle_html(frappe.as_unicode(v)) \
- if isinstance(v, string_types) else v for v in r])
+ if isinstance(v, str) else v for v in r])
f.seek(0)
frappe.response['result'] = cstr(f.read())
@@ -540,7 +538,7 @@ def build_match_conditions(doctype, user=None, as_condition=True):
return match_conditions
def get_filters_cond(doctype, filters, conditions, ignore_permissions=None, with_match_conditions=False):
- if isinstance(filters, string_types):
+ if isinstance(filters, str):
filters = json.loads(filters)
if filters:
@@ -549,7 +547,7 @@ def get_filters_cond(doctype, filters, conditions, ignore_permissions=None, with
filters = filters.items()
flt = []
for f in filters:
- if isinstance(f[1], string_types) and f[1][0] == '!':
+ if isinstance(f[1], str) and f[1][0] == '!':
flt.append([doctype, f[0], '!=', f[1][1:]])
elif isinstance(f[1], (list, tuple)) and \
f[1][0] in (">", "<", ">=", "<=", "!=", "like", "not like", "in", "not in", "between"):
diff --git a/frappe/desk/search.py b/frappe/desk/search.py
index 3c9109eca9..040a8c2118 100644
--- a/frappe/desk/search.py
+++ b/frappe/desk/search.py
@@ -2,12 +2,10 @@
# MIT License. See license.txt
# Search
-from __future__ import unicode_literals
import frappe, json
from frappe.utils import cstr, unique, cint
from frappe.permissions import has_permission
from frappe import _, is_whitelisted
-from six import string_types
import re
import wrapt
@@ -62,7 +60,7 @@ def search_widget(doctype, txt, query=None, searchfield=None, start=0,
start = cint(start)
- if isinstance(filters, string_types):
+ if isinstance(filters, str):
filters = json.loads(filters)
if searchfield:
diff --git a/frappe/desk/treeview.py b/frappe/desk/treeview.py
index 6f0d7d3d5f..66acde4cb2 100644
--- a/frappe/desk/treeview.py
+++ b/frappe/desk/treeview.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
diff --git a/frappe/email/__init__.py b/frappe/email/__init__.py
index b05aef7639..3fb539398a 100644
--- a/frappe/email/__init__.py
+++ b/frappe/email/__init__.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.desk.reportview import build_match_conditions
diff --git a/frappe/email/doctype/auto_email_report/auto_email_report.py b/frappe/email/doctype/auto_email_report/auto_email_report.py
index 6f1cd8eebd..911af2d1c7 100644
--- a/frappe/email/doctype/auto_email_report/auto_email_report.py
+++ b/frappe/email/doctype/auto_email_report/auto_email_report.py
@@ -2,8 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
-
import calendar
from datetime import timedelta
diff --git a/frappe/email/doctype/auto_email_report/test_auto_email_report.py b/frappe/email/doctype/auto_email_report/test_auto_email_report.py
index e656ff18f7..211a141ec0 100644
--- a/frappe/email/doctype/auto_email_report/test_auto_email_report.py
+++ b/frappe/email/doctype/auto_email_report/test_auto_email_report.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import json
import unittest
diff --git a/frappe/email/doctype/document_follow/document_follow.py b/frappe/email/doctype/document_follow/document_follow.py
index aaabffab6b..a04f8ef4c2 100644
--- a/frappe/email/doctype/document_follow/document_follow.py
+++ b/frappe/email/doctype/document_follow/document_follow.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
class DocumentFollow(Document):
diff --git a/frappe/email/doctype/document_follow/test_document_follow.py b/frappe/email/doctype/document_follow/test_document_follow.py
index 38aa870232..456c0931f8 100644
--- a/frappe/email/doctype/document_follow/test_document_follow.py
+++ b/frappe/email/doctype/document_follow/test_document_follow.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
import frappe.desk.form.document_follow as document_follow
diff --git a/frappe/email/doctype/email_account/email_account.py b/frappe/email/doctype/email_account/email_account.py
index 36b662bb39..d797c72859 100755
--- a/frappe/email/doctype/email_account/email_account.py
+++ b/frappe/email/doctype/email_account/email_account.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-
-from __future__ import unicode_literals, print_function
import frappe
import imaplib
import re
diff --git a/frappe/email/doctype/email_account/test_email_account.py b/frappe/email/doctype/email_account/test_email_account.py
index f87ee32bb1..1b92811eb7 100644
--- a/frappe/email/doctype/email_account/test_email_account.py
+++ b/frappe/email/doctype/email_account/test_email_account.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
import frappe, os
import unittest, email
diff --git a/frappe/email/doctype/email_domain/email_domain.py b/frappe/email/doctype/email_domain/email_domain.py
index ce39523564..0856549eb7 100644
--- a/frappe/email/doctype/email_domain/email_domain.py
+++ b/frappe/email/doctype/email_domain/email_domain.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
diff --git a/frappe/email/doctype/email_domain/test_email_domain.py b/frappe/email/doctype/email_domain/test_email_domain.py
index 1c5306e9c2..8607151ca8 100644
--- a/frappe/email/doctype/email_domain/test_email_domain.py
+++ b/frappe/email/doctype/email_domain/test_email_domain.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
from frappe.test_runner import make_test_objects
diff --git a/frappe/email/doctype/email_flag_queue/email_flag_queue.py b/frappe/email/doctype/email_flag_queue/email_flag_queue.py
index 487ef7db50..9bb30f08b2 100644
--- a/frappe/email/doctype/email_flag_queue/email_flag_queue.py
+++ b/frappe/email/doctype/email_flag_queue/email_flag_queue.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/email/doctype/email_flag_queue/test_email_flag_queue.py b/frappe/email/doctype/email_flag_queue/test_email_flag_queue.py
index 644a2a8ff7..d09b823ce6 100644
--- a/frappe/email/doctype/email_flag_queue/test_email_flag_queue.py
+++ b/frappe/email/doctype/email_flag_queue/test_email_flag_queue.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/email/doctype/email_group/email_group.py b/frappe/email/doctype/email_group/email_group.py
index b19a134713..597aa9c18b 100755
--- a/frappe/email/doctype/email_group/email_group.py
+++ b/frappe/email/doctype/email_group/email_group.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import validate_email_address
diff --git a/frappe/email/doctype/email_group/test_email_group.py b/frappe/email/doctype/email_group/test_email_group.py
index 09f4f4c32c..3e894118df 100644
--- a/frappe/email/doctype/email_group/test_email_group.py
+++ b/frappe/email/doctype/email_group/test_email_group.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/email/doctype/email_group_member/email_group_member.py b/frappe/email/doctype/email_group_member/email_group_member.py
index 23b279e755..1f9303b83e 100644
--- a/frappe/email/doctype/email_group_member/email_group_member.py
+++ b/frappe/email/doctype/email_group_member/email_group_member.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/email/doctype/email_group_member/test_email_group_member.py b/frappe/email/doctype/email_group_member/test_email_group_member.py
index 35259617c1..829d686400 100644
--- a/frappe/email/doctype/email_group_member/test_email_group_member.py
+++ b/frappe/email/doctype/email_group_member/test_email_group_member.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/email/doctype/email_queue/test_email_queue.py b/frappe/email/doctype/email_queue/test_email_queue.py
index 7cd79f9259..b76d6347b9 100644
--- a/frappe/email/doctype/email_queue/test_email_queue.py
+++ b/frappe/email/doctype/email_queue/test_email_queue.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/email/doctype/email_queue_recipient/email_queue_recipient.py b/frappe/email/doctype/email_queue_recipient/email_queue_recipient.py
index 3f07ec58f3..055bdb3fc1 100644
--- a/frappe/email/doctype/email_queue_recipient/email_queue_recipient.py
+++ b/frappe/email/doctype/email_queue_recipient/email_queue_recipient.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/email/doctype/email_rule/email_rule.py b/frappe/email/doctype/email_rule/email_rule.py
index 220798bbdc..9807724ef1 100644
--- a/frappe/email/doctype/email_rule/email_rule.py
+++ b/frappe/email/doctype/email_rule/email_rule.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/email/doctype/email_rule/test_email_rule.py b/frappe/email/doctype/email_rule/test_email_rule.py
index 3c7f9c83e6..b2213f7405 100644
--- a/frappe/email/doctype/email_rule/test_email_rule.py
+++ b/frappe/email/doctype/email_rule/test_email_rule.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/email/doctype/email_template/email_template.py b/frappe/email/doctype/email_template/email_template.py
index 6708e9dd3f..4711451fd2 100644
--- a/frappe/email/doctype/email_template/email_template.py
+++ b/frappe/email/doctype/email_template/email_template.py
@@ -1,11 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe, json
from frappe.model.document import Document
from frappe.utils.jinja import validate_template
-from six import string_types
class EmailTemplate(Document):
def validate(self):
@@ -24,7 +22,7 @@ class EmailTemplate(Document):
return frappe.render_template(self.response, doc)
def get_formatted_email(self, doc):
- if isinstance(doc, string_types):
+ if isinstance(doc, str):
doc = json.loads(doc)
return {
@@ -36,7 +34,7 @@ class EmailTemplate(Document):
@frappe.whitelist()
def get_email_template(template_name, doc):
'''Returns the processed HTML of a email template with the given doc'''
- if isinstance(doc, string_types):
+ if isinstance(doc, str):
doc = json.loads(doc)
email_template = frappe.get_doc("Email Template", template_name)
diff --git a/frappe/email/doctype/email_template/test_email_template.py b/frappe/email/doctype/email_template/test_email_template.py
index a48ce94ac5..5a9ee969c6 100644
--- a/frappe/email/doctype/email_template/test_email_template.py
+++ b/frappe/email/doctype/email_template/test_email_template.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
class TestEmailTemplate(unittest.TestCase):
diff --git a/frappe/email/doctype/email_unsubscribe/email_unsubscribe.py b/frappe/email/doctype/email_unsubscribe/email_unsubscribe.py
index e532e2b7eb..6c47d8c538 100644
--- a/frappe/email/doctype/email_unsubscribe/email_unsubscribe.py
+++ b/frappe/email/doctype/email_unsubscribe/email_unsubscribe.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
diff --git a/frappe/email/doctype/email_unsubscribe/test_email_unsubscribe.py b/frappe/email/doctype/email_unsubscribe/test_email_unsubscribe.py
index ea84253ab6..602840fe3b 100644
--- a/frappe/email/doctype/email_unsubscribe/test_email_unsubscribe.py
+++ b/frappe/email/doctype/email_unsubscribe/test_email_unsubscribe.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/email/doctype/newsletter/newsletter.py b/frappe/email/doctype/newsletter/newsletter.py
index 6412338e96..3cba8f927c 100755
--- a/frappe/email/doctype/newsletter/newsletter.py
+++ b/frappe/email/doctype/newsletter/newsletter.py
@@ -1,8 +1,6 @@
# 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
import frappe.utils
from frappe import throw, _
diff --git a/frappe/email/doctype/newsletter/test_newsletter.py b/frappe/email/doctype/newsletter/test_newsletter.py
index bd8fadc29c..cfd0df53a9 100644
--- a/frappe/email/doctype/newsletter/test_newsletter.py
+++ b/frappe/email/doctype/newsletter/test_newsletter.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
-
import unittest
from random import choice
diff --git a/frappe/email/doctype/newsletter_email_group/newsletter_email_group.py b/frappe/email/doctype/newsletter_email_group/newsletter_email_group.py
index a59ac372fd..a453dda9e4 100644
--- a/frappe/email/doctype/newsletter_email_group/newsletter_email_group.py
+++ b/frappe/email/doctype/newsletter_email_group/newsletter_email_group.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/email/doctype/notification/notification.py b/frappe/email/doctype/notification/notification.py
index 2940a34f63..57418515f5 100644
--- a/frappe/email/doctype/notification/notification.py
+++ b/frappe/email/doctype/notification/notification.py
@@ -2,7 +2,6 @@
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
import json, os
from frappe import _
@@ -12,7 +11,6 @@ from frappe.utils import validate_email_address, nowdate, parse_val, is_html, ad
from frappe.utils.jinja import validate_template
from frappe.utils.safe_exec import get_safe_globals
from frappe.modules.utils import export_module_json, get_doc_module
-from six import string_types
from frappe.integrations.doctype.slack_webhook_url.slack_webhook_url import send_slack_message
from frappe.core.doctype.sms_settings.sms_settings import send_sms
from frappe.desk.doctype.notification_log.notification_log import enqueue_create_notification
@@ -55,9 +53,7 @@ class Notification(Document):
# py
if not os.path.exists(path + '.py'):
with open(path + '.py', 'w') as f:
- f.write("""from __future__ import unicode_literals
-
-import frappe
+ f.write("""import frappe
def get_context(context):
# do your magic here
@@ -397,7 +393,7 @@ def trigger_notifications(doc, method=None):
def evaluate_alert(doc, alert, event):
from jinja2 import TemplateError
try:
- if isinstance(alert, string_types):
+ if isinstance(alert, str):
alert = frappe.get_doc("Notification", alert)
context = get_context(doc)
diff --git a/frappe/email/doctype/notification/test_notification.py b/frappe/email/doctype/notification/test_notification.py
index 31d5d9d1cc..d6358ccbbe 100644
--- a/frappe/email/doctype/notification/test_notification.py
+++ b/frappe/email/doctype/notification/test_notification.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe, frappe.utils, frappe.utils.scheduler
from frappe.desk.form import assign_to
import unittest
diff --git a/frappe/email/doctype/notification_recipient/notification_recipient.py b/frappe/email/doctype/notification_recipient/notification_recipient.py
index a85ed62c04..d8480c5455 100644
--- a/frappe/email/doctype/notification_recipient/notification_recipient.py
+++ b/frappe/email/doctype/notification_recipient/notification_recipient.py
@@ -2,7 +2,6 @@
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/email/doctype/unhandled_email/test_unhandled_email.py b/frappe/email/doctype/unhandled_email/test_unhandled_email.py
index 6cabcf6ec2..5606b8ff30 100644
--- a/frappe/email/doctype/unhandled_email/test_unhandled_email.py
+++ b/frappe/email/doctype/unhandled_email/test_unhandled_email.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/email/doctype/unhandled_email/unhandled_email.py b/frappe/email/doctype/unhandled_email/unhandled_email.py
index 1276da71a1..6414dbece3 100644
--- a/frappe/email/doctype/unhandled_email/unhandled_email.py
+++ b/frappe/email/doctype/unhandled_email/unhandled_email.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/email/email_body.py b/frappe/email/email_body.py
index 3b03c42b95..7f4398ef2f 100755
--- a/frappe/email/email_body.py
+++ b/frappe/email/email_body.py
@@ -1,14 +1,12 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe, re, os
from frappe.utils.pdf import get_pdf
from frappe.email.doctype.email_account.email_account import EmailAccount
from frappe.utils import (get_url, scrub_urls, strip, expand_relative_urls, cint,
split_emails, to_markdown, markdown, random_string, parse_addr)
import email.utils
-from six import iteritems, text_type, string_types
from email.mime.multipart import MIMEMultipart
from email.header import Header
from email import policy
@@ -55,7 +53,7 @@ class EMail:
from email import charset as Charset
Charset.add_charset('utf-8', Charset.QP, Charset.QP, 'utf-8')
- if isinstance(recipients, string_types):
+ if isinstance(recipients, str):
recipients = recipients.replace(';', ',').replace('\n', '')
recipients = split_emails(recipients)
@@ -225,7 +223,7 @@ class EMail:
}
# reset headers as values may be changed.
- for key, val in iteritems(headers):
+ for key, val in headers.items():
if val:
self.set_header(key, val)
@@ -328,7 +326,7 @@ def add_attachment(fname, fcontent, content_type=None,
maintype, subtype = content_type.split('/', 1)
if maintype == 'text':
# Note: we should handle calculating the charset
- if isinstance(fcontent, text_type):
+ if isinstance(fcontent, str):
fcontent = fcontent.encode("utf-8")
part = MIMEText(fcontent, _subtype=subtype, _charset="utf-8")
elif maintype == 'image':
@@ -345,7 +343,7 @@ def add_attachment(fname, fcontent, content_type=None,
# Set the filename parameter
if fname:
attachment_type = 'inline' if inline else 'attachment'
- part.add_header('Content-Disposition', attachment_type, filename=text_type(fname))
+ part.add_header('Content-Disposition', attachment_type, filename=str(fname))
if content_id:
part.add_header('Content-ID', '<{0}>'.format(content_id))
@@ -452,7 +450,7 @@ def get_header(header=None):
if not header: return None
- if isinstance(header, string_types):
+ if isinstance(header, str):
# header = 'My Title'
header = [header, None]
if len(header) == 1:
diff --git a/frappe/email/inbox.py b/frappe/email/inbox.py
index 395a2d3e2d..5f8f516772 100644
--- a/frappe/email/inbox.py
+++ b/frappe/email/inbox.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
import json
diff --git a/frappe/email/queue.py b/frappe/email/queue.py
index 52c91baf1c..7aef75b669 100755
--- a/frappe/email/queue.py
+++ b/frappe/email/queue.py
@@ -1,10 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import sys
-from six.moves import html_parser as HTMLParser
+from html.parser import HTMLParser
import smtplib, quopri, json
from frappe import msgprint, _, safe_decode, safe_encode, enqueue
from frappe.email.smtp import SMTPServer
@@ -14,7 +13,6 @@ from frappe.utils.verified_command import get_signed_params, verify_request
from html2text import html2text
from frappe.utils import get_url, nowdate, now_datetime, add_days, split_emails, cstr, cint
from rq.timeouts import JobTimeoutException
-from six import text_type, string_types, PY3
from email.parser import Parser
@@ -62,13 +60,13 @@ def send(recipients=None, sender=None, subject=None, message=None, text_content=
if not bcc:
bcc = []
- if isinstance(recipients, string_types):
+ if isinstance(recipients, str):
recipients = split_emails(recipients)
- if isinstance(cc, string_types):
+ if isinstance(cc, str):
cc = split_emails(cc)
- if isinstance(bcc, string_types):
+ if isinstance(bcc, str):
bcc = split_emails(bcc)
if isinstance(send_after, int):
diff --git a/frappe/email/receive.py b/frappe/email/receive.py
index 6d60007cdb..803712e7b0 100644
--- a/frappe/email/receive.py
+++ b/frappe/email/receive.py
@@ -12,7 +12,6 @@ from email.header import decode_header
import _socket
import chardet
-import six
from email_reply_parser import EmailReplyParser
import frappe
@@ -361,13 +360,10 @@ class Email:
"""Parses headers, content, attachments from given raw message.
:param content: Raw message."""
- if six.PY2:
- self.mail = email.message_from_string(safe_encode(content))
+ if isinstance(content, bytes):
+ self.mail = email.message_from_bytes(content)
else:
- if isinstance(content, bytes):
- self.mail = email.message_from_bytes(content)
- else:
- self.mail = email.message_from_string(content)
+ self.mail = email.message_from_string(content)
self.text_content = ''
self.html_content = ''
diff --git a/frappe/email/smtp.py b/frappe/email/smtp.py
index 3acb76af23..9425f4dbd4 100644
--- a/frappe/email/smtp.py
+++ b/frappe/email/smtp.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import smtplib
import email.utils
diff --git a/frappe/email/test_email_body.py b/frappe/email/test_email_body.py
index 33668cddba..1961d7801e 100644
--- a/frappe/email/test_email_body.py
+++ b/frappe/email/test_email_body.py
@@ -1,7 +1,5 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
-
import unittest, os, base64
from frappe import safe_decode
from frappe.email.receive import Email
@@ -9,7 +7,7 @@ from frappe.email.email_body import (replace_filename_with_cid,
get_email, inline_style_in_html, get_header)
from frappe.email.queue import get_email_queue
from frappe.email.doctype.email_queue.email_queue import SendMailContext
-from six import PY3
+
class TestEmailBody(unittest.TestCase):
def setUp(self):
@@ -42,13 +40,8 @@ This is the text version of this email
).as_string().replace("\r\n", "\n")
def test_prepare_message_returns_already_encoded_string(self):
-
- if PY3:
- uni_chr1 = chr(40960)
- uni_chr2 = chr(1972)
- else:
- uni_chr1 = unichr(40960)
- uni_chr2 = unichr(1972)
+ uni_chr1 = chr(40960)
+ uni_chr2 = chr(1972)
email = get_email_queue(
recipients=['test@example.com'],
@@ -73,10 +66,7 @@ This is the text version of this email
mail_ctx = SendMailContext(queue_doc = email)
result = safe_decode(mail_ctx.build_message(recipient_email='test@test.com'))
- if PY3:
- self.assertTrue(result.count('\n') == result.count("\r"))
- else:
- self.assertTrue(True)
+ self.assertTrue(result.count('\n') == result.count("\r"))
def test_image(self):
img_signature = '''
diff --git a/frappe/email/utils.py b/frappe/email/utils.py
index 8b4bd95ba0..24ce77b922 100644
--- a/frappe/email/utils.py
+++ b/frappe/email/utils.py
@@ -1,7 +1,5 @@
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-
-from __future__ import unicode_literals, print_function
import imaplib, poplib
from frappe.utils import cint
diff --git a/frappe/event_streaming/doctype/document_type_field_mapping/document_type_field_mapping.py b/frappe/event_streaming/doctype/document_type_field_mapping/document_type_field_mapping.py
index 1ab9534bdc..fc8164d8a4 100644
--- a/frappe/event_streaming/doctype/document_type_field_mapping/document_type_field_mapping.py
+++ b/frappe/event_streaming/doctype/document_type_field_mapping/document_type_field_mapping.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/event_streaming/doctype/document_type_mapping/document_type_mapping.py b/frappe/event_streaming/doctype/document_type_mapping/document_type_mapping.py
index bf96e4e27b..2cf7282a5a 100644
--- a/frappe/event_streaming/doctype/document_type_mapping/document_type_mapping.py
+++ b/frappe/event_streaming/doctype/document_type_mapping/document_type_mapping.py
@@ -1,12 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-
-from __future__ import unicode_literals
import frappe
import json
from frappe import _
-from six import iteritems
from frappe.model.document import Document
from frappe.model import default_fields
@@ -100,7 +97,7 @@ class DocumentTypeMapping(Document):
def get_mapped_dependency(self, mapping, producer_site, doc):
inner_mapping = frappe.get_doc('Document Type Mapping', mapping.mapping)
filters = json.loads(mapping.remote_value_filters)
- for key, value in iteritems(filters):
+ for key, value in filters.items():
if value.startswith('eval:'):
val = frappe.safe_eval(value[5:], None, dict(doc=doc))
filters[key] = val
@@ -117,7 +114,7 @@ class DocumentTypeMapping(Document):
def map_rows_removed(self, update_diff, mapping):
removed = []
mapping['removed'] = update_diff.removed
- for key, value in iteritems(update_diff.removed.copy()):
+ for key, value in update_diff.removed.copy().items():
local_table_name = frappe.db.get_value('Document Type Field Mapping', {
'remote_fieldname': key,
'parent': self.name
@@ -133,7 +130,7 @@ class DocumentTypeMapping(Document):
def map_rows(self, update_diff, mapping, producer_site, operation):
remote_fields = []
- for tablename, entries in iteritems(update_diff.get(operation).copy()):
+ for tablename, entries in update_diff.get(operation).copy().items():
local_table_name = frappe.db.get_value('Document Type Field Mapping', {'remote_fieldname': tablename}, 'local_fieldname')
table_map = frappe.db.get_value('Document Type Field Mapping', {'local_fieldname': local_table_name, 'parent': self.name}, 'mapping')
table_map = frappe.get_doc('Document Type Mapping', table_map)
diff --git a/frappe/event_streaming/doctype/document_type_mapping/test_document_type_mapping.py b/frappe/event_streaming/doctype/document_type_mapping/test_document_type_mapping.py
index 178d7b6b6a..b1bb322855 100644
--- a/frappe/event_streaming/doctype/document_type_mapping/test_document_type_mapping.py
+++ b/frappe/event_streaming/doctype/document_type_mapping/test_document_type_mapping.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/event_streaming/doctype/event_consumer/event_consumer.py b/frappe/event_streaming/doctype/event_consumer/event_consumer.py
index 5789e09e74..00d304f7f4 100644
--- a/frappe/event_streaming/doctype/event_consumer/event_consumer.py
+++ b/frappe/event_streaming/doctype/event_consumer/event_consumer.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
import json
import requests
@@ -31,7 +30,7 @@ class EventConsumer(Document):
self.update_consumer_status()
else:
frappe.db.set_value(self.doctype, self.name, 'incoming_change', 0)
-
+
frappe.cache().delete_value('event_consumer_document_type_map')
def on_trash(self):
diff --git a/frappe/event_streaming/doctype/event_consumer/test_event_consumer.py b/frappe/event_streaming/doctype/event_consumer/test_event_consumer.py
index 9e344842bd..b8072ecabd 100644
--- a/frappe/event_streaming/doctype/event_consumer/test_event_consumer.py
+++ b/frappe/event_streaming/doctype/event_consumer/test_event_consumer.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/event_streaming/doctype/event_consumer_document_type/event_consumer_document_type.py b/frappe/event_streaming/doctype/event_consumer_document_type/event_consumer_document_type.py
index 197338027f..cf5d18edfd 100644
--- a/frappe/event_streaming/doctype/event_consumer_document_type/event_consumer_document_type.py
+++ b/frappe/event_streaming/doctype/event_consumer_document_type/event_consumer_document_type.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/event_streaming/doctype/event_producer/test_event_producer.py b/frappe/event_streaming/doctype/event_producer/test_event_producer.py
index 4c259c3729..883f4f2df2 100644
--- a/frappe/event_streaming/doctype/event_producer/test_event_producer.py
+++ b/frappe/event_streaming/doctype/event_producer/test_event_producer.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
import json
@@ -154,7 +152,7 @@ class TestEventProducer(unittest.TestCase):
def test_conditional_events(self):
producer = get_remote_site()
-
+
# Add Condition
event_producer = frappe.get_doc('Event Producer', producer_url)
note_producer_entry = [
@@ -192,7 +190,7 @@ class TestEventProducer(unittest.TestCase):
def test_conditional_events_with_cmd(self):
producer = get_remote_site()
-
+
# Add Condition
event_producer = frappe.get_doc('Event Producer', producer_url)
note_producer_entry = [
diff --git a/frappe/event_streaming/doctype/event_producer_document_type/event_producer_document_type.py b/frappe/event_streaming/doctype/event_producer_document_type/event_producer_document_type.py
index 2870d5330f..9ae70e0f97 100644
--- a/frappe/event_streaming/doctype/event_producer_document_type/event_producer_document_type.py
+++ b/frappe/event_streaming/doctype/event_producer_document_type/event_producer_document_type.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/event_streaming/doctype/event_producer_last_update/event_producer_last_update.py b/frappe/event_streaming/doctype/event_producer_last_update/event_producer_last_update.py
index 02e297bdd5..391cf79c27 100644
--- a/frappe/event_streaming/doctype/event_producer_last_update/event_producer_last_update.py
+++ b/frappe/event_streaming/doctype/event_producer_last_update/event_producer_last_update.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/event_streaming/doctype/event_producer_last_update/test_event_producer_last_update.py b/frappe/event_streaming/doctype/event_producer_last_update/test_event_producer_last_update.py
index 0311cb2df9..62ea71edab 100644
--- a/frappe/event_streaming/doctype/event_producer_last_update/test_event_producer_last_update.py
+++ b/frappe/event_streaming/doctype/event_producer_last_update/test_event_producer_last_update.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/event_streaming/doctype/event_sync_log/event_sync_log.py b/frappe/event_streaming/doctype/event_sync_log/event_sync_log.py
index 31b1f863aa..1d255a5c30 100644
--- a/frappe/event_streaming/doctype/event_sync_log/event_sync_log.py
+++ b/frappe/event_streaming/doctype/event_sync_log/event_sync_log.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/event_streaming/doctype/event_sync_log/test_event_sync_log.py b/frappe/event_streaming/doctype/event_sync_log/test_event_sync_log.py
index 6c621b8b0e..ef55dc0f16 100644
--- a/frappe/event_streaming/doctype/event_sync_log/test_event_sync_log.py
+++ b/frappe/event_streaming/doctype/event_sync_log/test_event_sync_log.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/event_streaming/doctype/event_update_log/event_update_log.py b/frappe/event_streaming/doctype/event_update_log/event_update_log.py
index 1c31718c2b..ae851c70d1 100644
--- a/frappe/event_streaming/doctype/event_update_log/event_update_log.py
+++ b/frappe/event_streaming/doctype/event_update_log/event_update_log.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils.background_jobs import get_jobs
@@ -235,7 +234,7 @@ def get_update_logs_for_consumer(event_consumer, doctypes, last_update):
if isinstance(doctypes, str):
doctypes = frappe.parse_json(doctypes)
-
+
from frappe.event_streaming.doctype.event_consumer.event_consumer import has_consumer_access
consumer = frappe.get_doc('Event Consumer', event_consumer)
diff --git a/frappe/event_streaming/doctype/event_update_log/test_event_update_log.py b/frappe/event_streaming/doctype/event_update_log/test_event_update_log.py
index e00fc767d9..99ced3c209 100644
--- a/frappe/event_streaming/doctype/event_update_log/test_event_update_log.py
+++ b/frappe/event_streaming/doctype/event_update_log/test_event_update_log.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/event_streaming/doctype/event_update_log_consumer/event_update_log_consumer.py b/frappe/event_streaming/doctype/event_update_log_consumer/event_update_log_consumer.py
index ee6d5d8ca9..80a59e4c31 100644
--- a/frappe/event_streaming/doctype/event_update_log_consumer/event_update_log_consumer.py
+++ b/frappe/event_streaming/doctype/event_update_log_consumer/event_update_log_consumer.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/exceptions.py b/frappe/exceptions.py
index ab65e6e006..0f111fdcf9 100644
--- a/frappe/exceptions.py
+++ b/frappe/exceptions.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import sys
# BEWARE don't put anything in this file except exceptions
diff --git a/frappe/frappeclient.py b/frappe/frappeclient.py
index 054a8c9369..e57f82b60a 100644
--- a/frappe/frappeclient.py
+++ b/frappe/frappeclient.py
@@ -1,8 +1,6 @@
-from __future__ import print_function, unicode_literals
import requests
import json
import frappe
-from six import iteritems, string_types
import base64
'''
@@ -88,7 +86,7 @@ class FrappeClient(object):
def get_list(self, doctype, fields='["name"]', filters=None, limit_start=0, limit_page_length=0):
"""Returns list of records of a particular type"""
- if not isinstance(fields, string_types):
+ if not isinstance(fields, str):
fields = json.dumps(fields)
params = {
"fields": fields,
@@ -310,7 +308,7 @@ class FrappeClient(object):
def preprocess(self, params):
"""convert dicts, lists to json"""
- for key, value in iteritems(params):
+ for key, value in params.items():
if isinstance(value, (dict, list)):
params[key] = json.dumps(value)
diff --git a/frappe/geo/country_info.py b/frappe/geo/country_info.py
index 4f878325ad..ddebd1fb0e 100644
--- a/frappe/geo/country_info.py
+++ b/frappe/geo/country_info.py
@@ -2,8 +2,6 @@
# MIT License. See license.txt
# all country info
-from __future__ import unicode_literals
-
import os, json, frappe
from frappe.utils.momentjs import get_all_timezones
diff --git a/frappe/geo/doctype/country/__init__.py b/frappe/geo/doctype/country/__init__.py
index baffc48825..8b13789179 100644
--- a/frappe/geo/doctype/country/__init__.py
+++ b/frappe/geo/doctype/country/__init__.py
@@ -1 +1 @@
-from __future__ import unicode_literals
+
diff --git a/frappe/geo/doctype/country/country.py b/frappe/geo/doctype/country/country.py
index 5f8b6f7bd5..54935e6eaf 100644
--- a/frappe/geo/doctype/country/country.py
+++ b/frappe/geo/doctype/country/country.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/geo/doctype/country/test_country.py b/frappe/geo/doctype/country/test_country.py
index 81849d6886..e00d6ecf37 100644
--- a/frappe/geo/doctype/country/test_country.py
+++ b/frappe/geo/doctype/country/test_country.py
@@ -1,6 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: See license.txt
-from __future__ import unicode_literals
import frappe
test_records = frappe.get_test_records('Country')
\ No newline at end of file
diff --git a/frappe/geo/doctype/currency/__init__.py b/frappe/geo/doctype/currency/__init__.py
index baffc48825..8b13789179 100644
--- a/frappe/geo/doctype/currency/__init__.py
+++ b/frappe/geo/doctype/currency/__init__.py
@@ -1 +1 @@
-from __future__ import unicode_literals
+
diff --git a/frappe/geo/doctype/currency/currency.py b/frappe/geo/doctype/currency/currency.py
index 688303fd50..b3ce67cc67 100644
--- a/frappe/geo/doctype/currency/currency.py
+++ b/frappe/geo/doctype/currency/currency.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import throw, _
diff --git a/frappe/geo/doctype/currency/test_currency.py b/frappe/geo/doctype/currency/test_currency.py
index 7945e193da..5552e675ec 100644
--- a/frappe/geo/doctype/currency/test_currency.py
+++ b/frappe/geo/doctype/currency/test_currency.py
@@ -3,6 +3,5 @@
# pre loaded
-from __future__ import unicode_literals
import frappe
test_records = frappe.get_test_records('Currency')
\ No newline at end of file
diff --git a/frappe/geo/utils.py b/frappe/geo/utils.py
index d94a13ea41..89de176f0b 100644
--- a/frappe/geo/utils.py
+++ b/frappe/geo/utils.py
@@ -2,8 +2,6 @@
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
-
import frappe
from pymysql import InternalError
diff --git a/frappe/handler.py b/frappe/handler.py
index b622667e18..de86c15c8f 100755
--- a/frappe/handler.py
+++ b/frappe/handler.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
from werkzeug.wrappers import Response
import frappe
diff --git a/frappe/hooks.py b/frappe/hooks.py
index d0968ce051..ac42a03461 100644
--- a/frappe/hooks.py
+++ b/frappe/hooks.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
from . import __version__ as app_version
diff --git a/frappe/integrations/doctype/braintree_settings/braintree_settings.py b/frappe/integrations/doctype/braintree_settings/braintree_settings.py
index 768f58c0a0..9dc9778bee 100644
--- a/frappe/integrations/doctype/braintree_settings/braintree_settings.py
+++ b/frappe/integrations/doctype/braintree_settings/braintree_settings.py
@@ -2,12 +2,11 @@
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
import braintree
from frappe import _
-from six.moves.urllib.parse import urlencode
+from urllib.parse import urlencode
from frappe.utils import get_url, call_hook_method
from frappe.integrations.utils import create_request_log, create_payment_gateway
diff --git a/frappe/integrations/doctype/braintree_settings/test_braintree_settings.py b/frappe/integrations/doctype/braintree_settings/test_braintree_settings.py
index 80fa3c54b8..72a678a92c 100644
--- a/frappe/integrations/doctype/braintree_settings/test_braintree_settings.py
+++ b/frappe/integrations/doctype/braintree_settings/test_braintree_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
class TestBraintreeSettings(unittest.TestCase):
diff --git a/frappe/integrations/doctype/connected_app/test_connected_app.py b/frappe/integrations/doctype/connected_app/test_connected_app.py
index b4304f6ee8..d1ff19ecb2 100644
--- a/frappe/integrations/doctype/connected_app/test_connected_app.py
+++ b/frappe/integrations/doctype/connected_app/test_connected_app.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
import requests
from urllib.parse import urljoin
diff --git a/frappe/integrations/doctype/dropbox_settings/test_dropbox_settings.py b/frappe/integrations/doctype/dropbox_settings/test_dropbox_settings.py
index 539fc417f2..d34e65de50 100644
--- a/frappe/integrations/doctype/dropbox_settings/test_dropbox_settings.py
+++ b/frappe/integrations/doctype/dropbox_settings/test_dropbox_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/integrations/doctype/google_drive/test_google_drive.py b/frappe/integrations/doctype/google_drive/test_google_drive.py
index f06e13572c..96e8577c7c 100644
--- a/frappe/integrations/doctype/google_drive/test_google_drive.py
+++ b/frappe/integrations/doctype/google_drive/test_google_drive.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/integrations/doctype/google_settings/google_settings.py b/frappe/integrations/doctype/google_settings/google_settings.py
index ecc975235a..9a3f3c8ae2 100644
--- a/frappe/integrations/doctype/google_settings/google_settings.py
+++ b/frappe/integrations/doctype/google_settings/google_settings.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/integrations/doctype/integration_request/integration_request.py b/frappe/integrations/doctype/integration_request/integration_request.py
index f1d59beb5a..4c4961d96d 100644
--- a/frappe/integrations/doctype/integration_request/integration_request.py
+++ b/frappe/integrations/doctype/integration_request/integration_request.py
@@ -2,11 +2,9 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
import json
-from six import string_types
from frappe.integrations.utils import json_handler
class IntegrationRequest(Document):
@@ -25,14 +23,14 @@ class IntegrationRequest(Document):
def handle_success(self, response):
"""update the output field with the response along with the relevant status"""
- if isinstance(response, string_types):
+ if isinstance(response, str):
response = json.loads(response)
self.db_set("status", "Completed")
self.db_set("output", json.dumps(response, default=json_handler))
def handle_failure(self, response):
"""update the error field with the response along with the relevant status"""
- if isinstance(response, string_types):
+ if isinstance(response, str):
response = json.loads(response)
self.db_set("status", "Failed")
self.db_set("error", json.dumps(response, default=json_handler))
\ No newline at end of file
diff --git a/frappe/integrations/doctype/integration_request/test_integration_request.py b/frappe/integrations/doctype/integration_request/test_integration_request.py
index 6b77b57de4..a26eb4ba93 100644
--- a/frappe/integrations/doctype/integration_request/test_integration_request.py
+++ b/frappe/integrations/doctype/integration_request/test_integration_request.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/integrations/doctype/ldap_group_mapping/ldap_group_mapping.py b/frappe/integrations/doctype/ldap_group_mapping/ldap_group_mapping.py
index f9f2adeed0..b6bb77d964 100644
--- a/frappe/integrations/doctype/ldap_group_mapping/ldap_group_mapping.py
+++ b/frappe/integrations/doctype/ldap_group_mapping/ldap_group_mapping.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/integrations/doctype/ldap_settings/ldap_settings.py b/frappe/integrations/doctype/ldap_settings/ldap_settings.py
index 80dfef2693..122096cf6f 100644
--- a/frappe/integrations/doctype/ldap_settings/ldap_settings.py
+++ b/frappe/integrations/doctype/ldap_settings/ldap_settings.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _, safe_encode
from frappe.model.document import Document
diff --git a/frappe/integrations/doctype/ldap_settings/test_ldap_settings.py b/frappe/integrations/doctype/ldap_settings/test_ldap_settings.py
index e6cf4eef3a..113692b6c4 100644
--- a/frappe/integrations/doctype/ldap_settings/test_ldap_settings.py
+++ b/frappe/integrations/doctype/ldap_settings/test_ldap_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/integrations/doctype/oauth_authorization_code/oauth_authorization_code.py b/frappe/integrations/doctype/oauth_authorization_code/oauth_authorization_code.py
index f08e7eb5bb..0c7f02844c 100644
--- a/frappe/integrations/doctype/oauth_authorization_code/oauth_authorization_code.py
+++ b/frappe/integrations/doctype/oauth_authorization_code/oauth_authorization_code.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/integrations/doctype/oauth_authorization_code/test_oauth_authorization_code.py b/frappe/integrations/doctype/oauth_authorization_code/test_oauth_authorization_code.py
index cecf187e61..6084dd64b4 100644
--- a/frappe/integrations/doctype/oauth_authorization_code/test_oauth_authorization_code.py
+++ b/frappe/integrations/doctype/oauth_authorization_code/test_oauth_authorization_code.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/integrations/doctype/oauth_bearer_token/oauth_bearer_token.py b/frappe/integrations/doctype/oauth_bearer_token/oauth_bearer_token.py
index 09fd29075b..916d0205d2 100644
--- a/frappe/integrations/doctype/oauth_bearer_token/oauth_bearer_token.py
+++ b/frappe/integrations/doctype/oauth_bearer_token/oauth_bearer_token.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/integrations/doctype/oauth_bearer_token/test_oauth_bearer_token.py b/frappe/integrations/doctype/oauth_bearer_token/test_oauth_bearer_token.py
index af7de360ab..6028cebcf9 100644
--- a/frappe/integrations/doctype/oauth_bearer_token/test_oauth_bearer_token.py
+++ b/frappe/integrations/doctype/oauth_bearer_token/test_oauth_bearer_token.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/integrations/doctype/oauth_client/oauth_client.py b/frappe/integrations/doctype/oauth_client/oauth_client.py
index 02f5041dfb..0b449ff968 100644
--- a/frappe/integrations/doctype/oauth_client/oauth_client.py
+++ b/frappe/integrations/doctype/oauth_client/oauth_client.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
diff --git a/frappe/integrations/doctype/oauth_client/test_oauth_client.py b/frappe/integrations/doctype/oauth_client/test_oauth_client.py
index ee119455e5..a4e50e15d8 100644
--- a/frappe/integrations/doctype/oauth_client/test_oauth_client.py
+++ b/frappe/integrations/doctype/oauth_client/test_oauth_client.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/integrations/doctype/oauth_provider_settings/oauth_provider_settings.py b/frappe/integrations/doctype/oauth_provider_settings/oauth_provider_settings.py
index 2bf086e0fe..3ab5df92ac 100644
--- a/frappe/integrations/doctype/oauth_provider_settings/oauth_provider_settings.py
+++ b/frappe/integrations/doctype/oauth_provider_settings/oauth_provider_settings.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, 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 import _
diff --git a/frappe/integrations/doctype/oauth_scope/oauth_scope.py b/frappe/integrations/doctype/oauth_scope/oauth_scope.py
index a5dfe7e1ce..ae579e6b51 100644
--- a/frappe/integrations/doctype/oauth_scope/oauth_scope.py
+++ b/frappe/integrations/doctype/oauth_scope/oauth_scope.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/integrations/doctype/paypal_settings/paypal_settings.py b/frappe/integrations/doctype/paypal_settings/paypal_settings.py
index efd1b03355..da045d2c6a 100644
--- a/frappe/integrations/doctype/paypal_settings/paypal_settings.py
+++ b/frappe/integrations/doctype/paypal_settings/paypal_settings.py
@@ -63,12 +63,11 @@ More Details:
"""
-from __future__ import unicode_literals
import frappe
import json
import pytz
from frappe import _
-from six.moves.urllib.parse import urlencode
+from urllib.parse import urlencode
from frappe.model.document import Document
from frappe.integrations.utils import create_request_log, make_post_request, create_payment_gateway
from frappe.utils import get_url, call_hook_method, cint, get_datetime
diff --git a/frappe/integrations/doctype/paytm_settings/paytm_settings.py b/frappe/integrations/doctype/paytm_settings/paytm_settings.py
index 616c3837d4..9f15d73f09 100644
--- a/frappe/integrations/doctype/paytm_settings/paytm_settings.py
+++ b/frappe/integrations/doctype/paytm_settings/paytm_settings.py
@@ -2,10 +2,9 @@
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import json
import requests
-from six.moves.urllib.parse import urlencode
+from urllib.parse import urlencode
import frappe
from frappe.model.document import Document
@@ -59,7 +58,7 @@ def get_paytm_params(payment_details, order_id, paytm_config):
# initialize a dictionary
paytm_params = dict()
-
+
redirect_uri = get_request_site_address(True) + "/api/method/frappe.integrations.doctype.paytm_settings.paytm_settings.verify_transaction"
diff --git a/frappe/integrations/doctype/paytm_settings/test_paytm_settings.py b/frappe/integrations/doctype/paytm_settings/test_paytm_settings.py
index 77a16c82ae..a00ce86327 100644
--- a/frappe/integrations/doctype/paytm_settings/test_paytm_settings.py
+++ b/frappe/integrations/doctype/paytm_settings/test_paytm_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/integrations/doctype/query_parameters/query_parameters.py b/frappe/integrations/doctype/query_parameters/query_parameters.py
index bfb8eae0b6..13fb94dbe3 100644
--- a/frappe/integrations/doctype/query_parameters/query_parameters.py
+++ b/frappe/integrations/doctype/query_parameters/query_parameters.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/integrations/doctype/razorpay_settings/razorpay_settings.py b/frappe/integrations/doctype/razorpay_settings/razorpay_settings.py
index af7686c9b0..d24e15f480 100644
--- a/frappe/integrations/doctype/razorpay_settings/razorpay_settings.py
+++ b/frappe/integrations/doctype/razorpay_settings/razorpay_settings.py
@@ -60,14 +60,13 @@ For razorpay payment status is Authorized
"""
-from __future__ import unicode_literals
import frappe
from frappe import _
import json
import hmac
import razorpay
import hashlib
-from six.moves.urllib.parse import urlencode
+from urllib.parse import urlencode
from frappe.model.document import Document
from frappe.utils import get_url, call_hook_method, cint, get_timestamp
from frappe.integrations.utils import (make_get_request, make_post_request, create_request_log,
diff --git a/frappe/integrations/doctype/s3_backup_settings/s3_backup_settings.py b/frappe/integrations/doctype/s3_backup_settings/s3_backup_settings.py
index 308d34c5c2..1346811652 100755
--- a/frappe/integrations/doctype/s3_backup_settings/s3_backup_settings.py
+++ b/frappe/integrations/doctype/s3_backup_settings/s3_backup_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-
-from __future__ import print_function, unicode_literals
import os
import os.path
import frappe
diff --git a/frappe/integrations/doctype/s3_backup_settings/test_s3_backup_settings.py b/frappe/integrations/doctype/s3_backup_settings/test_s3_backup_settings.py
index 04d90f9b44..3aecdf3489 100755
--- a/frappe/integrations/doctype/s3_backup_settings/test_s3_backup_settings.py
+++ b/frappe/integrations/doctype/s3_backup_settings/test_s3_backup_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
class TestS3BackupSettings(unittest.TestCase):
diff --git a/frappe/integrations/doctype/slack_webhook_url/slack_webhook_url.py b/frappe/integrations/doctype/slack_webhook_url/slack_webhook_url.py
index 8756d19c88..a970fc1f11 100644
--- a/frappe/integrations/doctype/slack_webhook_url/slack_webhook_url.py
+++ b/frappe/integrations/doctype/slack_webhook_url/slack_webhook_url.py
@@ -2,7 +2,6 @@
# Copyright (c) 2018, 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.utils import get_url_to_form
diff --git a/frappe/integrations/doctype/slack_webhook_url/test_slack_webhook_url.py b/frappe/integrations/doctype/slack_webhook_url/test_slack_webhook_url.py
index a7f9316ddd..4285c2c4bc 100644
--- a/frappe/integrations/doctype/slack_webhook_url/test_slack_webhook_url.py
+++ b/frappe/integrations/doctype/slack_webhook_url/test_slack_webhook_url.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
class TestSlackWebhookURL(unittest.TestCase):
diff --git a/frappe/integrations/doctype/social_login_key/social_login_key.py b/frappe/integrations/doctype/social_login_key/social_login_key.py
index dffb730513..4a4fcd44f4 100644
--- a/frappe/integrations/doctype/social_login_key/social_login_key.py
+++ b/frappe/integrations/doctype/social_login_key/social_login_key.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe, json
from frappe import _
from frappe.model.document import Document
diff --git a/frappe/integrations/doctype/social_login_key/test_social_login_key.py b/frappe/integrations/doctype/social_login_key/test_social_login_key.py
index e0b99ad391..23effd6a44 100644
--- a/frappe/integrations/doctype/social_login_key/test_social_login_key.py
+++ b/frappe/integrations/doctype/social_login_key/test_social_login_key.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
from frappe.integrations.doctype.social_login_key.social_login_key import BaseUrlNotSetError
import unittest
diff --git a/frappe/integrations/doctype/social_login_keys/social_login_keys.py b/frappe/integrations/doctype/social_login_keys/social_login_keys.py
index bd4cea01af..da9e21cd8e 100644
--- a/frappe/integrations/doctype/social_login_keys/social_login_keys.py
+++ b/frappe/integrations/doctype/social_login_keys/social_login_keys.py
@@ -1,5 +1,4 @@
# see license
-from __future__ import unicode_literals
from frappe.model.document import Document
class SocialLoginKeys(Document):
diff --git a/frappe/integrations/doctype/stripe_settings/stripe_settings.py b/frappe/integrations/doctype/stripe_settings/stripe_settings.py
index 70ca6002e4..9bb9c60775 100644
--- a/frappe/integrations/doctype/stripe_settings/stripe_settings.py
+++ b/frappe/integrations/doctype/stripe_settings/stripe_settings.py
@@ -2,11 +2,10 @@
# Copyright (c) 2017, 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 import _
-from six.moves.urllib.parse import urlencode
+from urllib.parse import urlencode
from frappe.utils import get_url, call_hook_method, cint, flt
from frappe.integrations.utils import make_get_request, make_post_request, create_request_log, create_payment_gateway
diff --git a/frappe/integrations/doctype/stripe_settings/test_stripe_settings.py b/frappe/integrations/doctype/stripe_settings/test_stripe_settings.py
index 39e128192f..ba11c3c38b 100644
--- a/frappe/integrations/doctype/stripe_settings/test_stripe_settings.py
+++ b/frappe/integrations/doctype/stripe_settings/test_stripe_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
class TestStripeSettings(unittest.TestCase):
diff --git a/frappe/integrations/doctype/token_cache/test_token_cache.py b/frappe/integrations/doctype/token_cache/test_token_cache.py
index 7aa069647d..2ffd57403b 100644
--- a/frappe/integrations/doctype/token_cache/test_token_cache.py
+++ b/frappe/integrations/doctype/token_cache/test_token_cache.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
import frappe
diff --git a/frappe/integrations/doctype/token_cache/token_cache.py b/frappe/integrations/doctype/token_cache/token_cache.py
index 7cac58fae0..3001d12b2b 100644
--- a/frappe/integrations/doctype/token_cache/token_cache.py
+++ b/frappe/integrations/doctype/token_cache/token_cache.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from datetime import datetime, timedelta
import frappe
diff --git a/frappe/integrations/doctype/webhook/__init__.py b/frappe/integrations/doctype/webhook/__init__.py
index 19233bd175..b92497f16c 100644
--- a/frappe/integrations/doctype/webhook/__init__.py
+++ b/frappe/integrations/doctype/webhook/__init__.py
@@ -2,8 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
-
import frappe
@@ -21,7 +19,7 @@ def run_webhooks(doc, method):
if webhooks is None:
# query webhooks
webhooks_list = frappe.get_all('Webhook',
- fields=["name", "`condition`", "webhook_docevent", "webhook_doctype"],
+ fields=["name", "`condition`", "webhook_docevent", "webhook_doctype"],
filters={"enabled": True}
)
diff --git a/frappe/integrations/doctype/webhook/test_webhook.py b/frappe/integrations/doctype/webhook/test_webhook.py
index acf2f609e7..09ad56a190 100644
--- a/frappe/integrations/doctype/webhook/test_webhook.py
+++ b/frappe/integrations/doctype/webhook/test_webhook.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
import frappe
@@ -86,7 +84,7 @@ class TestWebhook(unittest.TestCase):
# Insert the user to db
self.test_user.insert()
-
+
self.assertTrue("User" in frappe.flags.webhooks)
# only 1 hook (enabled) must be queued
self.assertEqual(
@@ -95,7 +93,7 @@ class TestWebhook(unittest.TestCase):
)
self.assertTrue(self.test_user.email in frappe.flags.webhooks_executed)
self.assertEqual(
- frappe.flags.webhooks_executed.get(self.test_user.email)[0],
+ frappe.flags.webhooks_executed.get(self.test_user.email)[0],
self.sample_webhooks[0].name
)
diff --git a/frappe/integrations/doctype/webhook/webhook.py b/frappe/integrations/doctype/webhook/webhook.py
index ad64d9f714..1fb2bc6743 100644
--- a/frappe/integrations/doctype/webhook/webhook.py
+++ b/frappe/integrations/doctype/webhook/webhook.py
@@ -2,8 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
-
import base64
import datetime
import hashlib
@@ -12,7 +10,7 @@ import json
from time import sleep
import requests
-from six.moves.urllib.parse import urlparse
+from urllib.parse import urlparse
import frappe
from frappe import _
diff --git a/frappe/integrations/doctype/webhook_data/webhook_data.py b/frappe/integrations/doctype/webhook_data/webhook_data.py
index b7d989410f..dbd9328482 100644
--- a/frappe/integrations/doctype/webhook_data/webhook_data.py
+++ b/frappe/integrations/doctype/webhook_data/webhook_data.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/integrations/doctype/webhook_header/webhook_header.py b/frappe/integrations/doctype/webhook_header/webhook_header.py
index 11d3ee4085..428b287db2 100644
--- a/frappe/integrations/doctype/webhook_header/webhook_header.py
+++ b/frappe/integrations/doctype/webhook_header/webhook_header.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/integrations/oauth2_logins.py b/frappe/integrations/oauth2_logins.py
index 14a6bcc417..c38b43beb7 100644
--- a/frappe/integrations/oauth2_logins.py
+++ b/frappe/integrations/oauth2_logins.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import frappe.utils
from frappe.utils.oauth import login_via_oauth2, login_via_oauth2_id_token
@@ -33,7 +32,7 @@ def login_via_salesforce(code, state):
@frappe.whitelist(allow_guest=True)
def login_via_fairlogin(code, state):
- login_via_oauth2("fairlogin", code, state, decoder=decoder_compat)
+ login_via_oauth2("fairlogin", code, state, decoder=decoder_compat)
@frappe.whitelist(allow_guest=True)
def custom(code, state):
diff --git a/frappe/integrations/offsite_backup_utils.py b/frappe/integrations/offsite_backup_utils.py
index 48a2c89107..7a263e9d04 100644
--- a/frappe/integrations/offsite_backup_utils.py
+++ b/frappe/integrations/offsite_backup_utils.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
import glob
import os
diff --git a/frappe/integrations/utils.py b/frappe/integrations/utils.py
index 1af9682073..09c20568b5 100644
--- a/frappe/integrations/utils.py
+++ b/frappe/integrations/utils.py
@@ -2,11 +2,9 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
import json,datetime
-from six.moves.urllib.parse import parse_qs
-from six import string_types, text_type
+from urllib.parse import parse_qs
from frappe.utils import get_request_session
from frappe import _
@@ -50,10 +48,10 @@ def make_post_request(url, auth=None, headers=None, data=None):
raise exc
def create_request_log(data, integration_type, service_name, name=None, error=None):
- if isinstance(data, string_types):
+ if isinstance(data, str):
data = json.loads(data)
- if isinstance(error, string_types):
+ if isinstance(error, str):
error = json.loads(error)
integration_request = frappe.get_doc({
@@ -116,4 +114,4 @@ def create_payment_gateway(gateway, settings=None, controller=None):
def json_handler(obj):
if isinstance(obj, (datetime.date, datetime.timedelta, datetime.datetime)):
- return text_type(obj)
+ return str(obj)
diff --git a/frappe/middlewares.py b/frappe/middlewares.py
index 252be56c47..05944ec37a 100644
--- a/frappe/middlewares.py
+++ b/frappe/middlewares.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
import os
from werkzeug.exceptions import NotFound
diff --git a/frappe/migrate.py b/frappe/migrate.py
index 619510fe5e..d19e255639 100644
--- a/frappe/migrate.py
+++ b/frappe/migrate.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import json
import os
import sys
diff --git a/frappe/model/__init__.py b/frappe/model/__init__.py
index 205b451336..dd93fbcc18 100644
--- a/frappe/model/__init__.py
+++ b/frappe/model/__init__.py
@@ -2,7 +2,6 @@
# MIT License. See license.txt
# model __init__.py
-from __future__ import unicode_literals
import frappe
data_fieldtypes = (
diff --git a/frappe/model/base_document.py b/frappe/model/base_document.py
index 54d77ba988..2f5154cfd9 100644
--- a/frappe/model/base_document.py
+++ b/frappe/model/base_document.py
@@ -1,9 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals
-from six import iteritems, string_types
-
import frappe
import datetime
from frappe import _
@@ -109,7 +105,7 @@ class BaseDocument(object):
if key in d:
self.set(key, d.get(key))
- for key, value in iteritems(d):
+ for key, value in d.items():
self.set(key, value)
return self
@@ -120,7 +116,7 @@ class BaseDocument(object):
if "doctype" in d:
self.set("doctype", d.get("doctype"))
- for key, value in iteritems(d):
+ for key, value in d.items():
# dont_update_if_missing is a list of fieldnames, for which, you don't want to set default value
if (self.get(key) is None) and (value is not None) and (key not in self.dont_update_if_missing):
self.set(key, value)
@@ -670,7 +666,7 @@ class BaseDocument(object):
if data_field_options == "URL":
if not data:
continue
-
+
frappe.utils.validate_url(data, throw=True)
def _validate_constants(self):
@@ -705,7 +701,7 @@ class BaseDocument(object):
type_map = frappe.db.type_map
- for fieldname, value in iteritems(self.get_valid_dict()):
+ for fieldname, value in self.get_valid_dict().items():
df = self.meta.get_field(fieldname)
if not df or df.fieldtype == 'Check':
@@ -770,7 +766,7 @@ class BaseDocument(object):
return
for fieldname, value in self.get_valid_dict().items():
- if not value or not isinstance(value, string_types):
+ if not value or not isinstance(value, str):
continue
value = frappe.as_unicode(value)
@@ -839,7 +835,7 @@ class BaseDocument(object):
:param parentfield: If fieldname is in child table."""
from frappe.model.meta import get_field_precision
- if parentfield and not isinstance(parentfield, string_types):
+ if parentfield and not isinstance(parentfield, str):
parentfield = parentfield.parentfield
cache_key = parentfield or "main"
@@ -986,7 +982,7 @@ def _filter(data, filters, limit=None):
fval = ("not None", fval)
elif fval is False:
fval = ("None", fval)
- elif isinstance(fval, string_types) and fval.startswith("^"):
+ elif isinstance(fval, str) and fval.startswith("^"):
fval = ("^", fval[1:])
else:
fval = ("=", fval)
@@ -995,7 +991,7 @@ def _filter(data, filters, limit=None):
for d in data:
add = True
- for f, fval in iteritems(_filters):
+ for f, fval in _filters.items():
if not frappe.compare(getattr(d, f, None), fval[0], fval[1]):
add = False
break
diff --git a/frappe/model/create_new.py b/frappe/model/create_new.py
index dc4fd97e4c..fba6765479 100644
--- a/frappe/model/create_new.py
+++ b/frappe/model/create_new.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
"""
Create a new document with defaults set
"""
diff --git a/frappe/model/db_query.py b/frappe/model/db_query.py
index e0c3406c46..7f22282acf 100644
--- a/frappe/model/db_query.py
+++ b/frappe/model/db_query.py
@@ -1,10 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals
-
-from six import iteritems, string_types
-
"""build query for doclistview and return results"""
import frappe.defaults
@@ -54,7 +49,7 @@ class DatabaseQuery(object):
filters, fields = fields, filters
elif fields and isinstance(filters, list) \
- and len(filters) > 1 and isinstance(filters[0], string_types):
+ and len(filters) > 1 and isinstance(filters[0], str):
# if `filters` is a list of strings, its probably fields
filters, fields = fields, filters
@@ -209,7 +204,7 @@ class DatabaseQuery(object):
def parse_args(self):
"""Convert fields and filters from strings to list, dicts"""
- if isinstance(self.fields, string_types):
+ if isinstance(self.fields, str):
if self.fields == "*":
self.fields = ["*"]
else:
@@ -223,13 +218,13 @@ class DatabaseQuery(object):
for filter_name in ["filters", "or_filters"]:
filters = getattr(self, filter_name)
- if isinstance(filters, string_types):
+ if isinstance(filters, str):
filters = json.loads(filters)
if isinstance(filters, dict):
fdict = filters
filters = []
- for key, value in iteritems(fdict):
+ for key, value in fdict.items():
filters.append(make_filter_tuple(self.doctype, key, value))
setattr(self, filter_name, filters)
@@ -357,7 +352,7 @@ class DatabaseQuery(object):
# remove from filters
to_remove = []
for each in self.filters:
- if isinstance(each, string_types):
+ if isinstance(each, str):
each = [each]
for element in each:
@@ -391,7 +386,7 @@ class DatabaseQuery(object):
filters = [filters]
for f in filters:
- if isinstance(f, string_types):
+ if isinstance(f, str):
conditions.append(f)
else:
conditions.append(self.prepare_filter_condition(f))
@@ -522,12 +517,12 @@ class DatabaseQuery(object):
value = get_time(f.value).strftime("%H:%M:%S.%f")
fallback = "'00:00:00'"
- elif f.operator.lower() in ("like", "not like") or (isinstance(f.value, string_types) and
+ elif f.operator.lower() in ("like", "not like") or (isinstance(f.value, str) and
(not df or df.fieldtype not in ["Float", "Int", "Currency", "Percent", "Check"])):
value = "" if f.value==None else f.value
fallback = "''"
- if f.operator.lower() in ("like", "not like") and isinstance(value, string_types):
+ if f.operator.lower() in ("like", "not like") and isinstance(value, str):
# because "like" uses backslash (\) for escaping
value = value.replace("\\", "\\\\").replace("%", "%%")
@@ -544,7 +539,7 @@ class DatabaseQuery(object):
fallback = 0
# escape value
- if isinstance(value, string_types) and not f.operator.lower() == 'between':
+ if isinstance(value, str) and not f.operator.lower() == 'between':
value = "{0}".format(frappe.db.escape(value, percent=False))
if (self.ignore_ifnull
diff --git a/frappe/model/delete_doc.py b/frappe/model/delete_doc.py
index 5fcc74a734..c01439d330 100644
--- a/frappe/model/delete_doc.py
+++ b/frappe/model/delete_doc.py
@@ -1,9 +1,7 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import os
-from six import string_types, integer_types
import shutil
import frappe
@@ -35,7 +33,7 @@ def delete_doc(doctype=None, name=None, force=0, ignore_doctypes=None, for_reloa
name = frappe.form_dict.get('dn')
names = name
- if isinstance(name, string_types) or isinstance(name, integer_types):
+ if isinstance(name, str) or isinstance(name, int):
names = [name]
for name in names or []:
diff --git a/frappe/model/docfield.py b/frappe/model/docfield.py
index 19b78e329d..6360c3866d 100644
--- a/frappe/model/docfield.py
+++ b/frappe/model/docfield.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
"""docfield utililtes"""
import frappe
diff --git a/frappe/model/document.py b/frappe/model/document.py
index a3f8ad0cfa..8f57aae475 100644
--- a/frappe/model/document.py
+++ b/frappe/model/document.py
@@ -1,14 +1,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
import frappe
import time
from frappe import _, msgprint, is_whitelisted
from frappe.utils import flt, cstr, now, get_datetime_str, file_lock, date_diff
from frappe.model.base_document import BaseDocument, get_controller
from frappe.model.naming import set_new_name
-from six import iteritems, string_types
from werkzeug.exceptions import NotFound, Forbidden
import hashlib, json
from frappe.model import optional_fields, table_fields
@@ -54,7 +51,7 @@ def get_doc(*args, **kwargs):
if isinstance(args[0], BaseDocument):
# already a document
return args[0]
- elif isinstance(args[0], string_types):
+ elif isinstance(args[0], str):
doctype = args[0]
elif isinstance(args[0], dict):
@@ -91,7 +88,7 @@ class Document(BaseDocument):
self._default_new_docs = {}
self.flags = frappe._dict()
- if args and args[0] and isinstance(args[0], string_types):
+ if args and args[0] and isinstance(args[0], str):
# first arugment is doctype
if len(args)==1:
# single
@@ -438,7 +435,7 @@ class Document(BaseDocument):
def get_values():
values = self.as_dict()
# format values
- for key, value in iteritems(values):
+ for key, value in values.items():
if value==None:
values[key] = ""
return values
@@ -455,7 +452,7 @@ class Document(BaseDocument):
def update_single(self, d):
"""Updates values for Single type Document in `tabSingles`."""
frappe.db.sql("""delete from `tabSingles` where doctype=%s""", self.doctype)
- for field, value in iteritems(d):
+ for field, value in d.items():
if field != "doctype":
frappe.db.sql("""insert into `tabSingles` (doctype, field, value)
values (%s, %s, %s)""", (self.doctype, field, value))
diff --git a/frappe/model/dynamic_links.py b/frappe/model/dynamic_links.py
index 7404ba407e..676c86d7da 100644
--- a/frappe/model/dynamic_links.py
+++ b/frappe/model/dynamic_links.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
# select doctypes that are accessed by the user (not read_only) first, so that the
diff --git a/frappe/model/mapper.py b/frappe/model/mapper.py
index d3014435e0..eb685fb840 100644
--- a/frappe/model/mapper.py
+++ b/frappe/model/mapper.py
@@ -1,12 +1,10 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe, json
from frappe import _
from frappe.utils import cstr
from frappe.model import default_fields, table_fields
-from six import string_types
@frappe.whitelist()
def make_mapped_doc(method, source_name, selected_children=None, args=None):
@@ -60,7 +58,7 @@ def get_mapped_doc(from_doctype, from_docname, table_maps, target_doc=None,
# main
if not target_doc:
target_doc = frappe.new_doc(table_maps[from_doctype]["doctype"])
- elif isinstance(target_doc, string_types):
+ elif isinstance(target_doc, str):
target_doc = frappe.get_doc(json.loads(target_doc))
if (not apply_strict_user_permissions
diff --git a/frappe/model/meta.py b/frappe/model/meta.py
index 66e8b08d92..b67c41c990 100644
--- a/frappe/model/meta.py
+++ b/frappe/model/meta.py
@@ -14,10 +14,7 @@ Example:
'''
-
-from __future__ import unicode_literals, print_function
from datetime import datetime
-from six.moves import range
import frappe, json, os
from frappe.utils import cstr, cint, cast_fieldtype
from frappe.model import default_fields, no_value_fields, optional_fields, data_fieldtypes, table_fields
diff --git a/frappe/model/naming.py b/frappe/model/naming.py
index b8d6a6f8d7..fe136adce8 100644
--- a/frappe/model/naming.py
+++ b/frappe/model/naming.py
@@ -1,12 +1,10 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import now_datetime, cint, cstr
import re
-from six import string_types
from frappe.model import log_types
@@ -146,7 +144,7 @@ def make_autoname(key="", doctype="", doc=""):
def parse_naming_series(parts, doctype='', doc=''):
n = ''
- if isinstance(parts, string_types):
+ if isinstance(parts, str):
parts = parts.split('.')
series_set = False
today = now_datetime()
@@ -177,7 +175,7 @@ def parse_naming_series(parts, doctype='', doc=''):
else:
part = e
- if isinstance(part, string_types):
+ if isinstance(part, str):
n += part
return n
@@ -203,7 +201,7 @@ def revert_series_if_last(key, name, doc=None):
Reverts the series for particular naming series:
* key is naming series - SINV-.YYYY-.####
* name is actual name - SINV-2021-0001
-
+
1. This function split the key into two parts prefix (SINV-YYYY) & hashes (####).
2. Use prefix to get the current index of that naming series from Series table
3. Then revert the current index.
@@ -213,7 +211,7 @@ def revert_series_if_last(key, name, doc=None):
2. If hash doesn't exit in hashes, we get the hash from prefix, then update name and prefix accordingly.
*Example:*
- 1. key = SINV-.YYYY.-
+ 1. key = SINV-.YYYY.-
* If key doesn't have hash it will add hash at the end
* prefix will be SINV-YYYY based on this will get current index from Series table.
2. key = SINV-.####.-2021
@@ -221,9 +219,9 @@ def revert_series_if_last(key, name, doc=None):
* will search hash in key then accordingly get prefix = SINV-
3. key = ####.-2021
* prefix = #### and hashes = 2021 (hash doesn't exist)
- * will search hash in key then accordingly get prefix = ""
+ * will search hash in key then accordingly get prefix = ""
"""
- if ".#" in key:
+ if ".#" in key:
prefix, hashes = key.rsplit(".", 1)
if "#" not in hashes:
# get the hash part from the key
diff --git a/frappe/model/rename_doc.py b/frappe/model/rename_doc.py
index 2c9dc5d823..fc5b3ca9fe 100644
--- a/frappe/model/rename_doc.py
+++ b/frappe/model/rename_doc.py
@@ -1,8 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import print_function, unicode_literals
-
import frappe
from frappe import _, bold
from frappe.model.dynamic_links import get_dynamic_link_map
diff --git a/frappe/model/sync.py b/frappe/model/sync.py
index 61983d322c..28f9deb25d 100644
--- a/frappe/model/sync.py
+++ b/frappe/model/sync.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
"""
Sync's doctype and docfields from txt files to database
perms will get synced only if none exist
diff --git a/frappe/model/utils/__init__.py b/frappe/model/utils/__init__.py
index efbe46a4ab..47615182e4 100644
--- a/frappe/model/utils/__init__.py
+++ b/frappe/model/utils/__init__.py
@@ -1,15 +1,10 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
-from six.moves import range
import frappe
from frappe import _
from frappe.utils import cstr
from frappe.build import html_to_js_template
import re
-from six import text_type
-
import io
STANDARD_FIELD_CONVERSION_MAP = {
diff --git a/frappe/model/utils/link_count.py b/frappe/model/utils/link_count.py
index 5faa5ba44b..7562aaae45 100644
--- a/frappe/model/utils/link_count.py
+++ b/frappe/model/utils/link_count.py
@@ -1,10 +1,7 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
-from six import iteritems
ignore_doctypes = ("DocType", "Print Format", "Role", "Module Def", "Communication",
"ToDo")
@@ -39,7 +36,7 @@ def update_link_count():
link_count = frappe.cache().get_value('_link_count')
if link_count:
- for key, count in iteritems(link_count):
+ for key, count in link_count.items():
if key[0] not in ignore_doctypes:
try:
frappe.db.sql('update `tab{0}` set idx = idx + {1} where name=%s'.format(key[0], count),
diff --git a/frappe/model/utils/rename_field.py b/frappe/model/utils/rename_field.py
index 778f623092..9fe9d64041 100644
--- a/frappe/model/utils/rename_field.py
+++ b/frappe/model/utils/rename_field.py
@@ -1,8 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
-
import frappe
import json
from frappe.model import no_value_fields, table_fields
diff --git a/frappe/model/utils/user_settings.py b/frappe/model/utils/user_settings.py
index d59bda71a5..ad378ab93f 100644
--- a/frappe/model/utils/user_settings.py
+++ b/frappe/model/utils/user_settings.py
@@ -1,9 +1,8 @@
-from __future__ import unicode_literals
+
# Settings saved per user basis
# such as page_limit, filters, last_view
import frappe, json
-from six import iteritems, string_types
from frappe import safe_decode
# dict for mapping the index and index type for the filters of different views
@@ -36,7 +35,7 @@ def update_user_settings(doctype, user_settings, for_update=False):
else:
current = json.loads(get_user_settings(doctype, for_update = True))
- if isinstance(current, string_types):
+ if isinstance(current, str):
# corrupt due to old code, remove this in a future release
current = {}
@@ -47,7 +46,7 @@ def update_user_settings(doctype, user_settings, for_update=False):
def sync_user_settings():
'''Sync from cache to database (called asynchronously via the browser)'''
- for key, data in iteritems(frappe.cache().hgetall('_user_settings')):
+ for key, data in frappe.cache().hgetall('_user_settings').items():
key = safe_decode(key)
doctype, user = key.split('::') # WTF?
frappe.db.multisql({
diff --git a/frappe/model/workflow.py b/frappe/model/workflow.py
index 3e8125f9b1..fa2f557370 100644
--- a/frappe/model/workflow.py
+++ b/frappe/model/workflow.py
@@ -1,11 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.utils import cint
from frappe import _
-from six import string_types
import json
class WorkflowStateError(frappe.ValidationError): pass
@@ -268,7 +266,7 @@ def print_workflow_log(messages, title, doctype, indicator):
@frappe.whitelist()
def get_common_transition_actions(docs, doctype):
common_actions = []
- if isinstance(docs, string_types):
+ if isinstance(docs, str):
docs = json.loads(docs)
try:
for (i, doc) in enumerate(docs, 1):
diff --git a/frappe/modules/__init__.py b/frappe/modules/__init__.py
index fef4829bb6..33411f8d74 100644
--- a/frappe/modules/__init__.py
+++ b/frappe/modules/__init__.py
@@ -1,2 +1,2 @@
-from __future__ import unicode_literals
+
from .utils import *
\ No newline at end of file
diff --git a/frappe/modules/export_file.py b/frappe/modules/export_file.py
index 4b22c82105..ae9f11d53b 100644
--- a/frappe/modules/export_file.py
+++ b/frappe/modules/export_file.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, os
import frappe.model
from frappe.modules import scrub, get_module_path, scrub_dt_dn
diff --git a/frappe/modules/import_file.py b/frappe/modules/import_file.py
index fdfd00404c..e743f0c3da 100644
--- a/frappe/modules/import_file.py
+++ b/frappe/modules/import_file.py
@@ -1,8 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
-
import frappe, os, json
from frappe.modules import get_module_path, scrub_dt_dn
from frappe.utils import get_datetime_str
diff --git a/frappe/modules/patch_handler.py b/frappe/modules/patch_handler.py
index 0ed10d1e0d..029234d5d9 100644
--- a/frappe/modules/patch_handler.py
+++ b/frappe/modules/patch_handler.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
"""
Execute Patch Files
@@ -14,9 +12,6 @@ from __future__ import unicode_literals, print_function
"""
import frappe, frappe.permissions, time
-# for patches
-import os
-
class PatchError(Exception): pass
def run_all(skip_failing=False):
diff --git a/frappe/modules/utils.py b/frappe/modules/utils.py
index 132aa1e2a5..0f3e57a5a0 100644
--- a/frappe/modules/utils.py
+++ b/frappe/modules/utils.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
"""
Utilities for using modules
"""
diff --git a/frappe/monitor.py b/frappe/monitor.py
index 6802a59584..34ca7d67f7 100644
--- a/frappe/monitor.py
+++ b/frappe/monitor.py
@@ -2,8 +2,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
from datetime import datetime
import json
import traceback
diff --git a/frappe/patches/v10_0/enable_chat_by_default_within_system_settings.py b/frappe/patches/v10_0/enable_chat_by_default_within_system_settings.py
index eddca78051..24f915c512 100644
--- a/frappe/patches/v10_0/enable_chat_by_default_within_system_settings.py
+++ b/frappe/patches/v10_0/enable_chat_by_default_within_system_settings.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v10_0/enhance_security.py b/frappe/patches/v10_0/enhance_security.py
index 865d18dcff..4f6ca4faa1 100644
--- a/frappe/patches/v10_0/enhance_security.py
+++ b/frappe/patches/v10_0/enhance_security.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import frappe
from frappe.utils import cint
diff --git a/frappe/patches/v10_0/increase_single_table_column_length.py b/frappe/patches/v10_0/increase_single_table_column_length.py
index 18de0cff9e..e578d192fc 100644
--- a/frappe/patches/v10_0/increase_single_table_column_length.py
+++ b/frappe/patches/v10_0/increase_single_table_column_length.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
"""
Run this after updating country_info.json and or
"""
diff --git a/frappe/patches/v10_0/migrate_passwords_passlib.py b/frappe/patches/v10_0/migrate_passwords_passlib.py
index 22b7a86f85..d0b36efbaa 100644
--- a/frappe/patches/v10_0/migrate_passwords_passlib.py
+++ b/frappe/patches/v10_0/migrate_passwords_passlib.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.utils.password import LegacyPassword
diff --git a/frappe/patches/v10_0/modify_naming_series_table.py b/frappe/patches/v10_0/modify_naming_series_table.py
index 659e247a38..ca6114eb55 100644
--- a/frappe/patches/v10_0/modify_naming_series_table.py
+++ b/frappe/patches/v10_0/modify_naming_series_table.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
'''
Modify the Integer 10 Digits Value to BigInt 20 Digit value
to generate long Naming Series
diff --git a/frappe/patches/v10_0/modify_smallest_currency_fraction.py b/frappe/patches/v10_0/modify_smallest_currency_fraction.py
index f875d6b87d..c9ae477359 100644
--- a/frappe/patches/v10_0/modify_smallest_currency_fraction.py
+++ b/frappe/patches/v10_0/modify_smallest_currency_fraction.py
@@ -1,7 +1,6 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v10_0/refactor_social_login_keys.py b/frappe/patches/v10_0/refactor_social_login_keys.py
index 07737912df..a3f08939ec 100644
--- a/frappe/patches/v10_0/refactor_social_login_keys.py
+++ b/frappe/patches/v10_0/refactor_social_login_keys.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import frappe
from frappe.utils import cstr
diff --git a/frappe/patches/v10_0/reload_countries_and_currencies.py b/frappe/patches/v10_0/reload_countries_and_currencies.py
index f83ed9c3aa..8d019a4855 100644
--- a/frappe/patches/v10_0/reload_countries_and_currencies.py
+++ b/frappe/patches/v10_0/reload_countries_and_currencies.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
"""
Run this after updating country_info.json and or
"""
diff --git a/frappe/patches/v10_0/remove_custom_field_for_disabled_domain.py b/frappe/patches/v10_0/remove_custom_field_for_disabled_domain.py
index f27639388e..54839cfe02 100644
--- a/frappe/patches/v10_0/remove_custom_field_for_disabled_domain.py
+++ b/frappe/patches/v10_0/remove_custom_field_for_disabled_domain.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v10_0/set_default_locking_time.py b/frappe/patches/v10_0/set_default_locking_time.py
index 1c9797a6cc..045fa0e3fa 100644
--- a/frappe/patches/v10_0/set_default_locking_time.py
+++ b/frappe/patches/v10_0/set_default_locking_time.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v10_0/set_no_copy_to_workflow_state.py b/frappe/patches/v10_0/set_no_copy_to_workflow_state.py
index 800d4a4d1b..eb469b8452 100644
--- a/frappe/patches/v10_0/set_no_copy_to_workflow_state.py
+++ b/frappe/patches/v10_0/set_no_copy_to_workflow_state.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v11_0/change_email_signature_fieldtype.py b/frappe/patches/v11_0/change_email_signature_fieldtype.py
index f6d4bd5dcb..ccfa8541c3 100644
--- a/frappe/patches/v11_0/change_email_signature_fieldtype.py
+++ b/frappe/patches/v11_0/change_email_signature_fieldtype.py
@@ -1,7 +1,6 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v11_0/copy_fetch_data_from_options.py b/frappe/patches/v11_0/copy_fetch_data_from_options.py
index ae7788450a..e256c7085f 100644
--- a/frappe/patches/v11_0/copy_fetch_data_from_options.py
+++ b/frappe/patches/v11_0/copy_fetch_data_from_options.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v11_0/create_contact_for_user.py b/frappe/patches/v11_0/create_contact_for_user.py
index b4722ab3ae..21e681a83e 100644
--- a/frappe/patches/v11_0/create_contact_for_user.py
+++ b/frappe/patches/v11_0/create_contact_for_user.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.core.doctype.user.user import create_contact
import re
diff --git a/frappe/patches/v11_0/delete_all_prepared_reports.py b/frappe/patches/v11_0/delete_all_prepared_reports.py
index 1d722da7e6..77f041e3ee 100644
--- a/frappe/patches/v11_0/delete_all_prepared_reports.py
+++ b/frappe/patches/v11_0/delete_all_prepared_reports.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v11_0/delete_duplicate_user_permissions.py b/frappe/patches/v11_0/delete_duplicate_user_permissions.py
index 9d9d516ac5..518c1f7714 100644
--- a/frappe/patches/v11_0/delete_duplicate_user_permissions.py
+++ b/frappe/patches/v11_0/delete_duplicate_user_permissions.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v11_0/drop_column_apply_user_permissions.py b/frappe/patches/v11_0/drop_column_apply_user_permissions.py
index 4f46bc0907..629d5a5da4 100644
--- a/frappe/patches/v11_0/drop_column_apply_user_permissions.py
+++ b/frappe/patches/v11_0/drop_column_apply_user_permissions.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v11_0/fix_order_by_in_reports_json.py b/frappe/patches/v11_0/fix_order_by_in_reports_json.py
index 2cd82d442d..096e0e7654 100644
--- a/frappe/patches/v11_0/fix_order_by_in_reports_json.py
+++ b/frappe/patches/v11_0/fix_order_by_in_reports_json.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe, json
def execute():
diff --git a/frappe/patches/v11_0/make_all_prepared_report_attachments_private.py b/frappe/patches/v11_0/make_all_prepared_report_attachments_private.py
index f7b9e476a9..a099b89b40 100644
--- a/frappe/patches/v11_0/make_all_prepared_report_attachments_private.py
+++ b/frappe/patches/v11_0/make_all_prepared_report_attachments_private.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
diff --git a/frappe/patches/v11_0/migrate_report_settings_for_new_listview.py b/frappe/patches/v11_0/migrate_report_settings_for_new_listview.py
index 5bef52c295..e5b18368db 100644
--- a/frappe/patches/v11_0/migrate_report_settings_for_new_listview.py
+++ b/frappe/patches/v11_0/migrate_report_settings_for_new_listview.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe, json
def execute():
diff --git a/frappe/patches/v11_0/multiple_references_in_events.py b/frappe/patches/v11_0/multiple_references_in_events.py
index 57d4787eca..9fa5968d8e 100644
--- a/frappe/patches/v11_0/multiple_references_in_events.py
+++ b/frappe/patches/v11_0/multiple_references_in_events.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v11_0/reload_and_rename_view_log.py b/frappe/patches/v11_0/reload_and_rename_view_log.py
index 12c71b746f..fa0432c4e2 100644
--- a/frappe/patches/v11_0/reload_and_rename_view_log.py
+++ b/frappe/patches/v11_0/reload_and_rename_view_log.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v11_0/remove_doctype_user_permissions_for_page_and_report.py b/frappe/patches/v11_0/remove_doctype_user_permissions_for_page_and_report.py
index e2c2ef5f0e..5c54b1e5c1 100644
--- a/frappe/patches/v11_0/remove_doctype_user_permissions_for_page_and_report.py
+++ b/frappe/patches/v11_0/remove_doctype_user_permissions_for_page_and_report.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v11_0/remove_skip_for_doctype.py b/frappe/patches/v11_0/remove_skip_for_doctype.py
index edd385e317..638a5a0fd7 100644
--- a/frappe/patches/v11_0/remove_skip_for_doctype.py
+++ b/frappe/patches/v11_0/remove_skip_for_doctype.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.desk.form.linked_with import get_linked_doctypes
from frappe.patches.v11_0.replicate_old_user_permissions import get_doctypes_to_skip
diff --git a/frappe/patches/v11_0/rename_email_alert_to_notification.py b/frappe/patches/v11_0/rename_email_alert_to_notification.py
index 727055fcc4..365b76ea48 100644
--- a/frappe/patches/v11_0/rename_email_alert_to_notification.py
+++ b/frappe/patches/v11_0/rename_email_alert_to_notification.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.model.rename_doc import rename_doc
diff --git a/frappe/patches/v11_0/rename_google_maps_doctype.py b/frappe/patches/v11_0/rename_google_maps_doctype.py
index 5420dcfc20..4e8aee6280 100644
--- a/frappe/patches/v11_0/rename_google_maps_doctype.py
+++ b/frappe/patches/v11_0/rename_google_maps_doctype.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.model.rename_doc import rename_doc
diff --git a/frappe/patches/v11_0/rename_standard_reply_to_email_template.py b/frappe/patches/v11_0/rename_standard_reply_to_email_template.py
index 06869530e2..2906085738 100644
--- a/frappe/patches/v11_0/rename_standard_reply_to_email_template.py
+++ b/frappe/patches/v11_0/rename_standard_reply_to_email_template.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.model.rename_doc import rename_doc
diff --git a/frappe/patches/v11_0/rename_workflow_action_to_workflow_action_master.py b/frappe/patches/v11_0/rename_workflow_action_to_workflow_action_master.py
index 32f17ac2d8..9a48104611 100644
--- a/frappe/patches/v11_0/rename_workflow_action_to_workflow_action_master.py
+++ b/frappe/patches/v11_0/rename_workflow_action_to_workflow_action_master.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.model.rename_doc import rename_doc
diff --git a/frappe/patches/v11_0/replicate_old_user_permissions.py b/frappe/patches/v11_0/replicate_old_user_permissions.py
index d1ceae8a7f..50a81b5ce7 100644
--- a/frappe/patches/v11_0/replicate_old_user_permissions.py
+++ b/frappe/patches/v11_0/replicate_old_user_permissions.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
import json
from frappe.utils import cint
diff --git a/frappe/patches/v11_0/set_allow_self_approval_in_workflow.py b/frappe/patches/v11_0/set_allow_self_approval_in_workflow.py
index 24c01e1a58..63ae5f949f 100644
--- a/frappe/patches/v11_0/set_allow_self_approval_in_workflow.py
+++ b/frappe/patches/v11_0/set_allow_self_approval_in_workflow.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v11_0/set_default_letter_head_source.py b/frappe/patches/v11_0/set_default_letter_head_source.py
index a43ea397e4..3639524e7d 100644
--- a/frappe/patches/v11_0/set_default_letter_head_source.py
+++ b/frappe/patches/v11_0/set_default_letter_head_source.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import frappe
def execute():
diff --git a/frappe/patches/v11_0/set_dropbox_file_backup.py b/frappe/patches/v11_0/set_dropbox_file_backup.py
index 884fef320e..27492b3ab2 100644
--- a/frappe/patches/v11_0/set_dropbox_file_backup.py
+++ b/frappe/patches/v11_0/set_dropbox_file_backup.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
from frappe.utils import cint
import frappe
diff --git a/frappe/patches/v11_0/sync_stripe_settings_before_migrate.py b/frappe/patches/v11_0/sync_stripe_settings_before_migrate.py
index 331b0eba32..a8e9bd4de1 100644
--- a/frappe/patches/v11_0/sync_stripe_settings_before_migrate.py
+++ b/frappe/patches/v11_0/sync_stripe_settings_before_migrate.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.utils.password import get_decrypted_password
diff --git a/frappe/patches/v11_0/sync_user_permission_doctype_before_migrate.py b/frappe/patches/v11_0/sync_user_permission_doctype_before_migrate.py
index 738fea1a48..55a7b74f7e 100644
--- a/frappe/patches/v11_0/sync_user_permission_doctype_before_migrate.py
+++ b/frappe/patches/v11_0/sync_user_permission_doctype_before_migrate.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v11_0/update_list_user_settings.py b/frappe/patches/v11_0/update_list_user_settings.py
index d492ff1704..1b179d8cdf 100644
--- a/frappe/patches/v11_0/update_list_user_settings.py
+++ b/frappe/patches/v11_0/update_list_user_settings.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe, json
from frappe.model.utils.user_settings import update_user_settings, sync_user_settings
diff --git a/frappe/patches/v12_0/create_notification_settings_for_user.py b/frappe/patches/v12_0/create_notification_settings_for_user.py
index 63eeccc07a..6edfd88872 100644
--- a/frappe/patches/v12_0/create_notification_settings_for_user.py
+++ b/frappe/patches/v12_0/create_notification_settings_for_user.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.desk.doctype.notification_settings.notification_settings import create_notification_settings
diff --git a/frappe/patches/v12_0/init_desk_settings.py b/frappe/patches/v12_0/init_desk_settings.py
index ecd9c94d5b..fceb44b924 100644
--- a/frappe/patches/v12_0/init_desk_settings.py
+++ b/frappe/patches/v12_0/init_desk_settings.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import json
import frappe
from frappe.config import get_modules_from_all_apps_for_user
diff --git a/frappe/patches/v12_0/move_timeline_links_to_dynamic_links.py b/frappe/patches/v12_0/move_timeline_links_to_dynamic_links.py
index 040fde1bee..85be3f7feb 100644
--- a/frappe/patches/v12_0/move_timeline_links_to_dynamic_links.py
+++ b/frappe/patches/v12_0/move_timeline_links_to_dynamic_links.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import frappe
def execute():
diff --git a/frappe/patches/v12_0/setup_comments_from_communications.py b/frappe/patches/v12_0/setup_comments_from_communications.py
index 28c7aa93c0..039ceeff35 100644
--- a/frappe/patches/v12_0/setup_comments_from_communications.py
+++ b/frappe/patches/v12_0/setup_comments_from_communications.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import frappe
def execute():
diff --git a/frappe/patches/v12_0/setup_email_linking.py b/frappe/patches/v12_0/setup_email_linking.py
index 08f57ca5e4..9e939e1245 100644
--- a/frappe/patches/v12_0/setup_email_linking.py
+++ b/frappe/patches/v12_0/setup_email_linking.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
from frappe.desk.page.setup_wizard.install_fixtures import setup_email_linking
def execute():
diff --git a/frappe/patches/v12_0/update_auto_repeat_status_and_not_submittable.py b/frappe/patches/v12_0/update_auto_repeat_status_and_not_submittable.py
index d696b6c53a..3a3dcec315 100644
--- a/frappe/patches/v12_0/update_auto_repeat_status_and_not_submittable.py
+++ b/frappe/patches/v12_0/update_auto_repeat_status_and_not_submittable.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
diff --git a/frappe/patches/v13_0/add_standard_navbar_items.py b/frappe/patches/v13_0/add_standard_navbar_items.py
index 9982e6e3f5..4473cb8c07 100644
--- a/frappe/patches/v13_0/add_standard_navbar_items.py
+++ b/frappe/patches/v13_0/add_standard_navbar_items.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.utils.install import add_standard_navbar_items
diff --git a/frappe/patches/v13_0/add_switch_theme_to_navbar_settings.py b/frappe/patches/v13_0/add_switch_theme_to_navbar_settings.py
index 29b99464b5..b5542c9c8a 100644
--- a/frappe/patches/v13_0/add_switch_theme_to_navbar_settings.py
+++ b/frappe/patches/v13_0/add_switch_theme_to_navbar_settings.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v13_0/add_toggle_width_in_navbar_settings.py b/frappe/patches/v13_0/add_toggle_width_in_navbar_settings.py
index 59acb77480..bd3367377c 100644
--- a/frappe/patches/v13_0/add_toggle_width_in_navbar_settings.py
+++ b/frappe/patches/v13_0/add_toggle_width_in_navbar_settings.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v13_0/cleanup_desk_cards.py b/frappe/patches/v13_0/cleanup_desk_cards.py
index 6ac8604041..b6fab66475 100644
--- a/frappe/patches/v13_0/cleanup_desk_cards.py
+++ b/frappe/patches/v13_0/cleanup_desk_cards.py
@@ -1,11 +1,10 @@
import frappe
-from six import string_types
from json import loads
from frappe.desk.doctype.workspace.workspace import get_link_type, get_report_type
def execute():
frappe.reload_doc('desk', 'doctype', 'workspace')
-
+
pages = frappe.db.sql("Select `name` from `tabDesk Page`")
# pages = frappe.get_all("Workspace", filters={"is_standard": 0}, pluck="name")
@@ -21,14 +20,14 @@ def rebuild_links(page):
doc = frappe.get_doc("Workspace", page)
except frappe.DoesNotExistError:
db_doc = get_doc_from_db(page)
-
+
doc = frappe.get_doc(db_doc)
doc.insert(ignore_permissions=True)
-
+
doc.links = []
for card in get_all_cards(page):
- if isinstance(card.links, string_types):
+ if isinstance(card.links, str):
links = loads(card.links)
else:
links = card.links
@@ -43,7 +42,7 @@ def rebuild_links(page):
for link in links:
if not frappe.db.exists(get_link_type(link.get('type')), link.get('name')):
continue
-
+
doc.append('links', {
"label": link.get('label') or link.get('name'),
"type": "Link",
@@ -53,7 +52,7 @@ def rebuild_links(page):
"dependencies": ', '.join(link.get('dependencies', [])),
"is_query_report": get_report_type(link.get('name')) if link.get('type').lower() == "report" else 0
})
-
+
try:
doc.save(ignore_permissions=True)
except frappe.LinkValidationError:
diff --git a/frappe/patches/v13_0/delete_event_producer_and_consumer_keys.py b/frappe/patches/v13_0/delete_event_producer_and_consumer_keys.py
index 1eba5871c2..776e9c796e 100644
--- a/frappe/patches/v13_0/delete_event_producer_and_consumer_keys.py
+++ b/frappe/patches/v13_0/delete_event_producer_and_consumer_keys.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v13_0/delete_package_publish_tool.py b/frappe/patches/v13_0/delete_package_publish_tool.py
index 25024f58dd..bf9aaf5a76 100644
--- a/frappe/patches/v13_0/delete_package_publish_tool.py
+++ b/frappe/patches/v13_0/delete_package_publish_tool.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
diff --git a/frappe/patches/v13_0/enable_custom_script.py b/frappe/patches/v13_0/enable_custom_script.py
index edc242e700..0684074fe7 100644
--- a/frappe/patches/v13_0/enable_custom_script.py
+++ b/frappe/patches/v13_0/enable_custom_script.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v13_0/generate_theme_files_in_public_folder.py b/frappe/patches/v13_0/generate_theme_files_in_public_folder.py
index bcb47bec24..dd9fb1961a 100644
--- a/frappe/patches/v13_0/generate_theme_files_in_public_folder.py
+++ b/frappe/patches/v13_0/generate_theme_files_in_public_folder.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
diff --git a/frappe/patches/v13_0/jinja_hook.py b/frappe/patches/v13_0/jinja_hook.py
index 84ed6e6cff..990ae50f35 100644
--- a/frappe/patches/v13_0/jinja_hook.py
+++ b/frappe/patches/v13_0/jinja_hook.py
@@ -1,7 +1,6 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from click import secho
diff --git a/frappe/patches/v13_0/queryreport_columns.py b/frappe/patches/v13_0/queryreport_columns.py
index 6c2a1b1219..5c381f4f3e 100644
--- a/frappe/patches/v13_0/queryreport_columns.py
+++ b/frappe/patches/v13_0/queryreport_columns.py
@@ -1,7 +1,6 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import json
diff --git a/frappe/patches/v13_0/remove_duplicate_navbar_items.py b/frappe/patches/v13_0/remove_duplicate_navbar_items.py
index cb4de4ca07..b6c6033f64 100644
--- a/frappe/patches/v13_0/remove_duplicate_navbar_items.py
+++ b/frappe/patches/v13_0/remove_duplicate_navbar_items.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v13_0/remove_tailwind_from_page_builder.py b/frappe/patches/v13_0/remove_tailwind_from_page_builder.py
index 6e7bf67bac..2bf2c7bf87 100644
--- a/frappe/patches/v13_0/remove_tailwind_from_page_builder.py
+++ b/frappe/patches/v13_0/remove_tailwind_from_page_builder.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
diff --git a/frappe/patches/v13_0/rename_list_view_setting_to_list_view_settings.py b/frappe/patches/v13_0/rename_list_view_setting_to_list_view_settings.py
index 7c3aec9510..3122de8bea 100644
--- a/frappe/patches/v13_0/rename_list_view_setting_to_list_view_settings.py
+++ b/frappe/patches/v13_0/rename_list_view_setting_to_list_view_settings.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
diff --git a/frappe/patches/v13_0/rename_notification_fields.py b/frappe/patches/v13_0/rename_notification_fields.py
index 2984e6503c..1413d80358 100644
--- a/frappe/patches/v13_0/rename_notification_fields.py
+++ b/frappe/patches/v13_0/rename_notification_fields.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.utils.rename_field import rename_field
diff --git a/frappe/patches/v13_0/rename_onboarding.py b/frappe/patches/v13_0/rename_onboarding.py
index c506c6076e..852065dfd2 100644
--- a/frappe/patches/v13_0/rename_onboarding.py
+++ b/frappe/patches/v13_0/rename_onboarding.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v13_0/replace_old_data_import.py b/frappe/patches/v13_0/replace_old_data_import.py
index 920ee7b553..838881b48e 100644
--- a/frappe/patches/v13_0/replace_old_data_import.py
+++ b/frappe/patches/v13_0/replace_old_data_import.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
diff --git a/frappe/patches/v13_0/update_date_filters_in_user_settings.py b/frappe/patches/v13_0/update_date_filters_in_user_settings.py
index d4c6aa1d03..3b1b07fe0a 100644
--- a/frappe/patches/v13_0/update_date_filters_in_user_settings.py
+++ b/frappe/patches/v13_0/update_date_filters_in_user_settings.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe, json
from frappe.model.utils.user_settings import update_user_settings, sync_user_settings
diff --git a/frappe/patches/v13_0/update_duration_options.py b/frappe/patches/v13_0/update_duration_options.py
index 60eef8fc93..e0d8dea4ea 100644
--- a/frappe/patches/v13_0/update_duration_options.py
+++ b/frappe/patches/v13_0/update_duration_options.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v13_0/update_icons_in_customized_desk_pages.py b/frappe/patches/v13_0/update_icons_in_customized_desk_pages.py
index 93bf5c766e..ff58f99c2f 100644
--- a/frappe/patches/v13_0/update_icons_in_customized_desk_pages.py
+++ b/frappe/patches/v13_0/update_icons_in_customized_desk_pages.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v13_0/update_newsletter_content_type.py b/frappe/patches/v13_0/update_newsletter_content_type.py
index 6f8dcc1935..5f047680ee 100644
--- a/frappe/patches/v13_0/update_newsletter_content_type.py
+++ b/frappe/patches/v13_0/update_newsletter_content_type.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v13_0/update_notification_channel_if_empty.py b/frappe/patches/v13_0/update_notification_channel_if_empty.py
index 2c2a40e81b..bcf9a7b28c 100644
--- a/frappe/patches/v13_0/update_notification_channel_if_empty.py
+++ b/frappe/patches/v13_0/update_notification_channel_if_empty.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v13_0/web_template_set_module.py b/frappe/patches/v13_0/web_template_set_module.py
index df008557d8..2ee9e3ba2d 100644
--- a/frappe/patches/v13_0/web_template_set_module.py
+++ b/frappe/patches/v13_0/web_template_set_module.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v4_0/add_delete_permission.py b/frappe/patches/v4_0/add_delete_permission.py
index 091bdab3ff..9e375a431d 100644
--- a/frappe/patches/v4_0/add_delete_permission.py
+++ b/frappe/patches/v4_0/add_delete_permission.py
@@ -1,13 +1,13 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
frappe.reload_doc("core", "doctype", "docperm")
-
+
# delete same as cancel (map old permissions)
frappe.db.sql("""update tabDocPerm set `delete`=ifnull(`cancel`,0)""")
-
+
# can't cancel if can't submit
frappe.db.sql("""update tabDocPerm set `cancel`=0 where ifnull(`submit`,0)=0""")
-
+
frappe.clear_cache()
\ No newline at end of file
diff --git a/frappe/patches/v4_0/change_varchar_length.py b/frappe/patches/v4_0/change_varchar_length.py
index 29fe8f310d..914034ccba 100644
--- a/frappe/patches/v4_0/change_varchar_length.py
+++ b/frappe/patches/v4_0/change_varchar_length.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v4_0/create_custom_field_for_owner_match.py b/frappe/patches/v4_0/create_custom_field_for_owner_match.py
index 60dafc27da..438e280669 100644
--- a/frappe/patches/v4_0/create_custom_field_for_owner_match.py
+++ b/frappe/patches/v4_0/create_custom_field_for_owner_match.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
diff --git a/frappe/patches/v4_0/deprecate_control_panel.py b/frappe/patches/v4_0/deprecate_control_panel.py
index 892d3043c4..29ec8d35f6 100644
--- a/frappe/patches/v4_0/deprecate_control_panel.py
+++ b/frappe/patches/v4_0/deprecate_control_panel.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v4_0/deprecate_link_selects.py b/frappe/patches/v4_0/deprecate_link_selects.py
index a3243cffb8..837144a6ba 100644
--- a/frappe/patches/v4_0/deprecate_link_selects.py
+++ b/frappe/patches/v4_0/deprecate_link_selects.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v4_0/enable_scheduler_in_system_settings.py b/frappe/patches/v4_0/enable_scheduler_in_system_settings.py
index 5d1b836270..68c74edb4f 100644
--- a/frappe/patches/v4_0/enable_scheduler_in_system_settings.py
+++ b/frappe/patches/v4_0/enable_scheduler_in_system_settings.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.utils.scheduler import disable_scheduler, enable_scheduler
from frappe.utils import cint
diff --git a/frappe/patches/v4_0/file_manager_hooks.py b/frappe/patches/v4_0/file_manager_hooks.py
index 6be3b25124..ccf95d1d31 100644
--- a/frappe/patches/v4_0/file_manager_hooks.py
+++ b/frappe/patches/v4_0/file_manager_hooks.py
@@ -1,11 +1,7 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
-
import frappe
import os
-from frappe.utils import get_files_path
from frappe.core.doctype.file.file import get_content_hash
diff --git a/frappe/patches/v4_0/fix_attach_field_file_url.py b/frappe/patches/v4_0/fix_attach_field_file_url.py
index c29e5763f1..61c35b120d 100644
--- a/frappe/patches/v4_0/fix_attach_field_file_url.py
+++ b/frappe/patches/v4_0/fix_attach_field_file_url.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v4_0/private_backups.py b/frappe/patches/v4_0/private_backups.py
index 016af0615d..7920564677 100644
--- a/frappe/patches/v4_0/private_backups.py
+++ b/frappe/patches/v4_0/private_backups.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.installer import make_site_dirs
diff --git a/frappe/patches/v4_0/remove_index_sitemap.py b/frappe/patches/v4_0/remove_index_sitemap.py
index 5dcd0d79c7..8f48729276 100644
--- a/frappe/patches/v4_0/remove_index_sitemap.py
+++ b/frappe/patches/v4_0/remove_index_sitemap.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v4_0/remove_old_parent.py b/frappe/patches/v4_0/remove_old_parent.py
index 7717f7b7e3..f2d125953a 100644
--- a/frappe/patches/v4_0/remove_old_parent.py
+++ b/frappe/patches/v4_0/remove_old_parent.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v4_0/remove_user_owner_custom_field.py b/frappe/patches/v4_0/remove_user_owner_custom_field.py
index be6a45e090..4620f055d9 100644
--- a/frappe/patches/v4_0/remove_user_owner_custom_field.py
+++ b/frappe/patches/v4_0/remove_user_owner_custom_field.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v4_0/rename_profile_to_user.py b/frappe/patches/v4_0/rename_profile_to_user.py
index 48555ead9e..3e6f269329 100644
--- a/frappe/patches/v4_0/rename_profile_to_user.py
+++ b/frappe/patches/v4_0/rename_profile_to_user.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
diff --git a/frappe/patches/v4_0/rename_sitemap_to_route.py b/frappe/patches/v4_0/rename_sitemap_to_route.py
index 8ae5170b44..b4606672bc 100644
--- a/frappe/patches/v4_0/rename_sitemap_to_route.py
+++ b/frappe/patches/v4_0/rename_sitemap_to_route.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
diff --git a/frappe/patches/v4_0/replace_deprecated_timezones.py b/frappe/patches/v4_0/replace_deprecated_timezones.py
index a491325ebc..a3d8ecbf2b 100644
--- a/frappe/patches/v4_0/replace_deprecated_timezones.py
+++ b/frappe/patches/v4_0/replace_deprecated_timezones.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.utils.momentjs import data as momentjs_data
diff --git a/frappe/patches/v4_0/set_module_in_report.py b/frappe/patches/v4_0/set_module_in_report.py
index 9760f7efb3..6c670f4c8e 100644
--- a/frappe/patches/v4_0/set_module_in_report.py
+++ b/frappe/patches/v4_0/set_module_in_report.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v4_0/set_todo_checked_as_closed.py b/frappe/patches/v4_0/set_todo_checked_as_closed.py
index 59e8df3793..5f02e1447b 100644
--- a/frappe/patches/v4_0/set_todo_checked_as_closed.py
+++ b/frappe/patches/v4_0/set_todo_checked_as_closed.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v4_0/set_user_gravatar.py b/frappe/patches/v4_0/set_user_gravatar.py
index 733b9bfe11..348991c320 100644
--- a/frappe/patches/v4_0/set_user_gravatar.py
+++ b/frappe/patches/v4_0/set_user_gravatar.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v4_0/set_user_permissions.py b/frappe/patches/v4_0/set_user_permissions.py
index 726b9ee715..ef6f3a27e5 100644
--- a/frappe/patches/v4_0/set_user_permissions.py
+++ b/frappe/patches/v4_0/set_user_permissions.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import frappe.permissions
diff --git a/frappe/patches/v4_0/set_website_route_idx.py b/frappe/patches/v4_0/set_website_route_idx.py
index 663a324008..c3dba712d8 100644
--- a/frappe/patches/v4_0/set_website_route_idx.py
+++ b/frappe/patches/v4_0/set_website_route_idx.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v4_0/update_custom_field_insert_after.py b/frappe/patches/v4_0/update_custom_field_insert_after.py
index ddb888c493..4cb50956d6 100644
--- a/frappe/patches/v4_0/update_custom_field_insert_after.py
+++ b/frappe/patches/v4_0/update_custom_field_insert_after.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v4_0/update_datetime.py b/frappe/patches/v4_0/update_datetime.py
index 0e91174780..4034d8f665 100644
--- a/frappe/patches/v4_0/update_datetime.py
+++ b/frappe/patches/v4_0/update_datetime.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v4_0/webnotes_to_frappe.py b/frappe/patches/v4_0/webnotes_to_frappe.py
index 22b3848d5a..c29f6f603e 100644
--- a/frappe/patches/v4_0/webnotes_to_frappe.py
+++ b/frappe/patches/v4_0/webnotes_to_frappe.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe, json
def execute():
diff --git a/frappe/patches/v4_0/website_sitemap_hierarchy.py b/frappe/patches/v4_0/website_sitemap_hierarchy.py
index bb22144cd7..6404986245 100644
--- a/frappe/patches/v4_0/website_sitemap_hierarchy.py
+++ b/frappe/patches/v4_0/website_sitemap_hierarchy.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
def execute():
diff --git a/frappe/patches/v4_1/enable_outgoing_email_settings.py b/frappe/patches/v4_1/enable_outgoing_email_settings.py
index 7ffa84a278..ffa891ae7c 100644
--- a/frappe/patches/v4_1/enable_outgoing_email_settings.py
+++ b/frappe/patches/v4_1/enable_outgoing_email_settings.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v4_1/enable_print_as_pdf.py b/frappe/patches/v4_1/enable_print_as_pdf.py
index 74db9f72ca..e5a8f830f6 100644
--- a/frappe/patches/v4_1/enable_print_as_pdf.py
+++ b/frappe/patches/v4_1/enable_print_as_pdf.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v4_1/file_manager_fix.py b/frappe/patches/v4_1/file_manager_fix.py
index cd30c94177..18f44203f2 100644
--- a/frappe/patches/v4_1/file_manager_fix.py
+++ b/frappe/patches/v4_1/file_manager_fix.py
@@ -1,8 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
-
import frappe
import os
from frappe.core.doctype.file.file import get_content_hash, get_file_name
@@ -19,7 +16,6 @@ from frappe.utils import get_files_path, get_site_path
# a backup from a time before version 3 migration
#
# * Patch remaining unpatched File records.
-from six import iteritems
def execute():
@@ -52,7 +48,7 @@ def get_replaced_files():
old_files = dict(frappe.db.sql("select name, file_name from `tabFile` where ifnull(content_hash, '')=''"))
invfiles = invert_dict(new_files)
- for nname, nfilename in iteritems(new_files):
+ for nname, nfilename in new_files.items():
if 'files/' + nfilename in old_files.values():
ret.append((nfilename, invfiles[nfilename]))
return ret
@@ -85,7 +81,7 @@ def rename_replacing_files():
def invert_dict(ddict):
ret = {}
- for k,v in iteritems(ddict):
+ for k,v in ddict.items():
if not ret.get(v):
ret[v] = [k]
else:
diff --git a/frappe/patches/v4_2/print_with_letterhead.py b/frappe/patches/v4_2/print_with_letterhead.py
index 3e611ce073..111f6c762e 100644
--- a/frappe/patches/v4_2/print_with_letterhead.py
+++ b/frappe/patches/v4_2/print_with_letterhead.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v4_2/refactor_website_routing.py b/frappe/patches/v4_2/refactor_website_routing.py
index a5856db1c9..77eea3d429 100644
--- a/frappe/patches/v4_2/refactor_website_routing.py
+++ b/frappe/patches/v4_2/refactor_website_routing.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v4_2/set_assign_in_doc.py b/frappe/patches/v4_2/set_assign_in_doc.py
index a6a06492a0..8fbd37c5c5 100644
--- a/frappe/patches/v4_2/set_assign_in_doc.py
+++ b/frappe/patches/v4_2/set_assign_in_doc.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v4_3/remove_allow_on_submit_customization.py b/frappe/patches/v4_3/remove_allow_on_submit_customization.py
index af6ade68e6..a762fd10ab 100644
--- a/frappe/patches/v4_3/remove_allow_on_submit_customization.py
+++ b/frappe/patches/v4_3/remove_allow_on_submit_customization.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v5_0/bookmarks_to_stars.py b/frappe/patches/v5_0/bookmarks_to_stars.py
index 048d059701..0d2c13525e 100644
--- a/frappe/patches/v5_0/bookmarks_to_stars.py
+++ b/frappe/patches/v5_0/bookmarks_to_stars.py
@@ -1,9 +1,8 @@
-from __future__ import unicode_literals
+
import json
import frappe
import frappe.defaults
from frappe.desk.like import _toggle_like
-from six import string_types
def execute():
for user in frappe.get_all("User"):
@@ -13,7 +12,7 @@ def execute():
if not bookmarks:
continue
- if isinstance(bookmarks, string_types):
+ if isinstance(bookmarks, str):
bookmarks = json.loads(bookmarks)
for opts in bookmarks:
diff --git a/frappe/patches/v5_0/clear_website_group_and_notifications.py b/frappe/patches/v5_0/clear_website_group_and_notifications.py
index bad50222a3..3d3d0c0d16 100644
--- a/frappe/patches/v5_0/clear_website_group_and_notifications.py
+++ b/frappe/patches/v5_0/clear_website_group_and_notifications.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v5_0/communication_parent.py b/frappe/patches/v5_0/communication_parent.py
index 2ea3b401c6..3c73d91972 100644
--- a/frappe/patches/v5_0/communication_parent.py
+++ b/frappe/patches/v5_0/communication_parent.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v5_0/convert_to_barracuda_and_utf8mb4.py b/frappe/patches/v5_0/convert_to_barracuda_and_utf8mb4.py
index 0ea2ee2387..6fa6434f98 100644
--- a/frappe/patches/v5_0/convert_to_barracuda_and_utf8mb4.py
+++ b/frappe/patches/v5_0/convert_to_barracuda_and_utf8mb4.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.database.mariadb.setup_db import check_database_settings
from frappe.model.meta import trim_tables
diff --git a/frappe/patches/v5_0/expire_old_scheduler_logs.py b/frappe/patches/v5_0/expire_old_scheduler_logs.py
index 8b65ed5fb1..0262acd346 100644
--- a/frappe/patches/v5_0/expire_old_scheduler_logs.py
+++ b/frappe/patches/v5_0/expire_old_scheduler_logs.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v5_0/fix_email_alert.py b/frappe/patches/v5_0/fix_email_alert.py
index 0676f50a9c..e7366e8b66 100644
--- a/frappe/patches/v5_0/fix_email_alert.py
+++ b/frappe/patches/v5_0/fix_email_alert.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import frappe
def execute():
diff --git a/frappe/patches/v5_0/fix_null_date_datetime.py b/frappe/patches/v5_0/fix_null_date_datetime.py
index e4f4e9e8b9..078cba079a 100644
--- a/frappe/patches/v5_0/fix_null_date_datetime.py
+++ b/frappe/patches/v5_0/fix_null_date_datetime.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v5_0/fix_text_editor_file_urls.py b/frappe/patches/v5_0/fix_text_editor_file_urls.py
index a6d7d2fb9a..43f0c9d8a5 100644
--- a/frappe/patches/v5_0/fix_text_editor_file_urls.py
+++ b/frappe/patches/v5_0/fix_text_editor_file_urls.py
@@ -1,4 +1,3 @@
-from __future__ import unicode_literals, print_function
import frappe
import re
diff --git a/frappe/patches/v5_0/force_sync_website.py b/frappe/patches/v5_0/force_sync_website.py
index 5dcd0d79c7..8f48729276 100644
--- a/frappe/patches/v5_0/force_sync_website.py
+++ b/frappe/patches/v5_0/force_sync_website.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v5_0/modify_session.py b/frappe/patches/v5_0/modify_session.py
index f0e247a633..1c2ff0d6e6 100644
--- a/frappe/patches/v5_0/modify_session.py
+++ b/frappe/patches/v5_0/modify_session.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v5_0/move_scheduler_last_event_to_system_settings.py b/frappe/patches/v5_0/move_scheduler_last_event_to_system_settings.py
index 0fa1dad1e5..bdc52e6152 100644
--- a/frappe/patches/v5_0/move_scheduler_last_event_to_system_settings.py
+++ b/frappe/patches/v5_0/move_scheduler_last_event_to_system_settings.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v5_0/remove_shopping_cart_app.py b/frappe/patches/v5_0/remove_shopping_cart_app.py
index babde585a1..ed9414159e 100644
--- a/frappe/patches/v5_0/remove_shopping_cart_app.py
+++ b/frappe/patches/v5_0/remove_shopping_cart_app.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
-
def execute():
from frappe.installer import remove_from_installed_apps
remove_from_installed_apps("shopping_cart")
diff --git a/frappe/patches/v5_0/rename_ref_type_fieldnames.py b/frappe/patches/v5_0/rename_ref_type_fieldnames.py
index dd24f6e5b5..01e36af8a9 100644
--- a/frappe/patches/v5_0/rename_ref_type_fieldnames.py
+++ b/frappe/patches/v5_0/rename_ref_type_fieldnames.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v5_0/rename_table_fieldnames.py b/frappe/patches/v5_0/rename_table_fieldnames.py
index b716599f28..79703bbba2 100644
--- a/frappe/patches/v5_0/rename_table_fieldnames.py
+++ b/frappe/patches/v5_0/rename_table_fieldnames.py
@@ -1,7 +1,6 @@
# 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.model.utils.rename_field import rename_field
from frappe.modules import scrub, get_doctype_module
diff --git a/frappe/patches/v5_0/style_settings_to_website_theme.py b/frappe/patches/v5_0/style_settings_to_website_theme.py
index 40414d4e20..73ee28c1fc 100644
--- a/frappe/patches/v5_0/style_settings_to_website_theme.py
+++ b/frappe/patches/v5_0/style_settings_to_website_theme.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import cint
diff --git a/frappe/patches/v5_0/update_shared.py b/frappe/patches/v5_0/update_shared.py
index f2b77895d8..e549d7271d 100644
--- a/frappe/patches/v5_0/update_shared.py
+++ b/frappe/patches/v5_0/update_shared.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
import frappe.share
diff --git a/frappe/patches/v5_0/v4_to_v5.py b/frappe/patches/v5_0/v4_to_v5.py
index cd34f04c97..479acc6d63 100644
--- a/frappe/patches/v5_0/v4_to_v5.py
+++ b/frappe/patches/v5_0/v4_to_v5.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v5_2/change_checks_to_not_null.py b/frappe/patches/v5_2/change_checks_to_not_null.py
index 23f5d659b5..32be3aa752 100644
--- a/frappe/patches/v5_2/change_checks_to_not_null.py
+++ b/frappe/patches/v5_2/change_checks_to_not_null.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.utils import cint
from frappe.model import default_fields
diff --git a/frappe/patches/v5_3/rename_chinese_languages.py b/frappe/patches/v5_3/rename_chinese_languages.py
index 8bc954c04c..f720fb7538 100644
--- a/frappe/patches/v5_3/rename_chinese_languages.py
+++ b/frappe/patches/v5_3/rename_chinese_languages.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
import frappe
from frappe.translate import rename_language
diff --git a/frappe/patches/v6_0/communication_status_and_permission.py b/frappe/patches/v6_0/communication_status_and_permission.py
index c68ed9b4d6..435dcc21a5 100644
--- a/frappe/patches/v6_0/communication_status_and_permission.py
+++ b/frappe/patches/v6_0/communication_status_and_permission.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.permissions import reset_perms
diff --git a/frappe/patches/v6_0/document_type_rename.py b/frappe/patches/v6_0/document_type_rename.py
index 16c7d34286..53eec5d85c 100644
--- a/frappe/patches/v6_0/document_type_rename.py
+++ b/frappe/patches/v6_0/document_type_rename.py
@@ -1,8 +1,8 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
frappe.db.sql("""update tabDocType set document_type='Document'
where document_type='Transaction'""")
frappe.db.sql("""update tabDocType set document_type='Setup'
- where document_type='Master'""")
+ where document_type='Master'""")
diff --git a/frappe/patches/v6_0/fix_ghana_currency.py b/frappe/patches/v6_0/fix_ghana_currency.py
index 67f740d240..50feb3ca3f 100644
--- a/frappe/patches/v6_0/fix_ghana_currency.py
+++ b/frappe/patches/v6_0/fix_ghana_currency.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
def execute():
from frappe.geo.country_info import get_all
import frappe.utils.install
diff --git a/frappe/patches/v6_0/make_task_log_folder.py b/frappe/patches/v6_0/make_task_log_folder.py
index 87d6e4126f..b5ed547d71 100644
--- a/frappe/patches/v6_0/make_task_log_folder.py
+++ b/frappe/patches/v6_0/make_task_log_folder.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe.utils, os
def execute():
diff --git a/frappe/patches/v6_1/rename_file_data.py b/frappe/patches/v6_1/rename_file_data.py
index 83152271eb..3c62217e8d 100644
--- a/frappe/patches/v6_1/rename_file_data.py
+++ b/frappe/patches/v6_1/rename_file_data.py
@@ -1,4 +1,3 @@
-from __future__ import print_function, unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v6_11/rename_field_in_email_account.py b/frappe/patches/v6_11/rename_field_in_email_account.py
index 319b569802..8e600cc2b9 100644
--- a/frappe/patches/v6_11/rename_field_in_email_account.py
+++ b/frappe/patches/v6_11/rename_field_in_email_account.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v6_15/remove_property_setter_for_previous_field.py b/frappe/patches/v6_15/remove_property_setter_for_previous_field.py
index b24bf38442..9f0cd69489 100644
--- a/frappe/patches/v6_15/remove_property_setter_for_previous_field.py
+++ b/frappe/patches/v6_15/remove_property_setter_for_previous_field.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe, json
from frappe.utils import cstr
diff --git a/frappe/patches/v6_15/set_username.py b/frappe/patches/v6_15/set_username.py
index 513ff3301d..ebf01763d0 100644
--- a/frappe/patches/v6_15/set_username.py
+++ b/frappe/patches/v6_15/set_username.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v6_16/feed_doc_owner.py b/frappe/patches/v6_16/feed_doc_owner.py
index 2dac9a143d..b7e738b6d9 100644
--- a/frappe/patches/v6_16/feed_doc_owner.py
+++ b/frappe/patches/v6_16/feed_doc_owner.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v6_16/star_to_like.py b/frappe/patches/v6_16/star_to_like.py
index e859223d54..f3fc6310d9 100644
--- a/frappe/patches/v6_16/star_to_like.py
+++ b/frappe/patches/v6_16/star_to_like.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.database.schema import add_column
diff --git a/frappe/patches/v6_19/comment_feed_communication.py b/frappe/patches/v6_19/comment_feed_communication.py
index a7503c08ab..64c5ad9c4c 100644
--- a/frappe/patches/v6_19/comment_feed_communication.py
+++ b/frappe/patches/v6_19/comment_feed_communication.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.rename_doc import get_link_fields
diff --git a/frappe/patches/v6_2/ignore_user_permissions_if_missing.py b/frappe/patches/v6_2/ignore_user_permissions_if_missing.py
index 356d28989a..e216dc36b6 100644
--- a/frappe/patches/v6_2/ignore_user_permissions_if_missing.py
+++ b/frappe/patches/v6_2/ignore_user_permissions_if_missing.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v6_2/rename_backup_manager.py b/frappe/patches/v6_2/rename_backup_manager.py
index af02e55878..df2fa72c05 100644
--- a/frappe/patches/v6_2/rename_backup_manager.py
+++ b/frappe/patches/v6_2/rename_backup_manager.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v6_20x/remove_roles_from_website_user.py b/frappe/patches/v6_20x/remove_roles_from_website_user.py
index a4d579a1f0..19009ff455 100644
--- a/frappe/patches/v6_20x/remove_roles_from_website_user.py
+++ b/frappe/patches/v6_20x/remove_roles_from_website_user.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v6_20x/set_allow_draft_for_print.py b/frappe/patches/v6_20x/set_allow_draft_for_print.py
index 90c15e22b2..0b604567ec 100644
--- a/frappe/patches/v6_20x/set_allow_draft_for_print.py
+++ b/frappe/patches/v6_20x/set_allow_draft_for_print.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v6_20x/update_insert_after.py b/frappe/patches/v6_20x/update_insert_after.py
index 5ebec52fc9..37820b2437 100644
--- a/frappe/patches/v6_20x/update_insert_after.py
+++ b/frappe/patches/v6_20x/update_insert_after.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe, json
def execute():
diff --git a/frappe/patches/v6_21/print_settings_repeat_header_footer.py b/frappe/patches/v6_21/print_settings_repeat_header_footer.py
index 941a145a54..0919c35903 100644
--- a/frappe/patches/v6_21/print_settings_repeat_header_footer.py
+++ b/frappe/patches/v6_21/print_settings_repeat_header_footer.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v6_24/set_language_as_code.py b/frappe/patches/v6_24/set_language_as_code.py
index d685fd7d0e..6f862ede2e 100644
--- a/frappe/patches/v6_24/set_language_as_code.py
+++ b/frappe/patches/v6_24/set_language_as_code.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.translate import get_lang_dict
diff --git a/frappe/patches/v6_4/reduce_varchar_length.py b/frappe/patches/v6_4/reduce_varchar_length.py
index 93a8be8c92..7edde55778 100644
--- a/frappe/patches/v6_4/reduce_varchar_length.py
+++ b/frappe/patches/v6_4/reduce_varchar_length.py
@@ -1,4 +1,3 @@
-from __future__ import unicode_literals, print_function
import frappe
def execute():
diff --git a/frappe/patches/v6_4/rename_bengali_language.py b/frappe/patches/v6_4/rename_bengali_language.py
index dbbcb62f8d..f872dea1b9 100644
--- a/frappe/patches/v6_4/rename_bengali_language.py
+++ b/frappe/patches/v6_4/rename_bengali_language.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
import frappe
from frappe.translate import rename_language
diff --git a/frappe/patches/v6_6/fix_file_url.py b/frappe/patches/v6_6/fix_file_url.py
index 4f8956d343..48e292f4d4 100644
--- a/frappe/patches/v6_6/fix_file_url.py
+++ b/frappe/patches/v6_6/fix_file_url.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.model.meta import is_single
diff --git a/frappe/patches/v6_6/rename_slovak_language.py b/frappe/patches/v6_6/rename_slovak_language.py
index a942543372..198949e79c 100644
--- a/frappe/patches/v6_6/rename_slovak_language.py
+++ b/frappe/patches/v6_6/rename_slovak_language.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
import frappe
from frappe.translate import rename_language
diff --git a/frappe/patches/v6_6/user_last_active.py b/frappe/patches/v6_6/user_last_active.py
index fd55935174..b9f63fa45e 100644
--- a/frappe/patches/v6_6/user_last_active.py
+++ b/frappe/patches/v6_6/user_last_active.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v6_9/int_float_not_null.py b/frappe/patches/v6_9/int_float_not_null.py
index 97495f9077..c414d6b583 100644
--- a/frappe/patches/v6_9/int_float_not_null.py
+++ b/frappe/patches/v6_9/int_float_not_null.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.utils import cint, flt
diff --git a/frappe/patches/v6_9/rename_burmese_language.py b/frappe/patches/v6_9/rename_burmese_language.py
index 66477f7efe..5e1333077e 100644
--- a/frappe/patches/v6_9/rename_burmese_language.py
+++ b/frappe/patches/v6_9/rename_burmese_language.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
import frappe
from frappe.translate import rename_language
diff --git a/frappe/patches/v7_0/add_communication_in_doc.py b/frappe/patches/v7_0/add_communication_in_doc.py
index 4db02c5bab..8be229fe3a 100644
--- a/frappe/patches/v7_0/add_communication_in_doc.py
+++ b/frappe/patches/v7_0/add_communication_in_doc.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.core.doctype.comment.comment import update_comment_in_doc
diff --git a/frappe/patches/v7_0/cleanup_list_settings.py b/frappe/patches/v7_0/cleanup_list_settings.py
index e03ff57406..9fe2e71ed1 100644
--- a/frappe/patches/v7_0/cleanup_list_settings.py
+++ b/frappe/patches/v7_0/cleanup_list_settings.py
@@ -1,8 +1,8 @@
-from __future__ import unicode_literals
+
import frappe, json
def execute():
- if frappe.db.table_exists("__ListSettings"):
+ if frappe.db.table_exists("__ListSettings"):
list_settings = frappe.db.sql("select user, doctype, data from __ListSettings", as_dict=1)
for ls in list_settings:
if ls and ls.data:
@@ -14,7 +14,7 @@ def execute():
if "name as" in field:
fields.remove(field)
data["fields"] = fields
-
- frappe.db.sql("update __ListSettings set data = %s where user=%s and doctype=%s",
- (json.dumps(data), ls.user, ls.doctype))
-
+
+ frappe.db.sql("update __ListSettings set data = %s where user=%s and doctype=%s",
+ (json.dumps(data), ls.user, ls.doctype))
+
diff --git a/frappe/patches/v7_0/create_private_file_folder.py b/frappe/patches/v7_0/create_private_file_folder.py
index bd26917a78..e89beb5d0f 100644
--- a/frappe/patches/v7_0/create_private_file_folder.py
+++ b/frappe/patches/v7_0/create_private_file_folder.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe, os
def execute():
diff --git a/frappe/patches/v7_0/re_route.py b/frappe/patches/v7_0/re_route.py
index cc36594ae8..8a4daaea86 100644
--- a/frappe/patches/v7_0/re_route.py
+++ b/frappe/patches/v7_0/re_route.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.model.base_document import get_controller
diff --git a/frappe/patches/v7_0/rename_bulk_email_to_email_queue.py b/frappe/patches/v7_0/rename_bulk_email_to_email_queue.py
index 9a7a756144..42f2dfe4c2 100644
--- a/frappe/patches/v7_0/rename_bulk_email_to_email_queue.py
+++ b/frappe/patches/v7_0/rename_bulk_email_to_email_queue.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v7_0/rename_newsletter_list_to_email_group.py b/frappe/patches/v7_0/rename_newsletter_list_to_email_group.py
index 79061d383c..5e40d9df35 100644
--- a/frappe/patches/v7_0/rename_newsletter_list_to_email_group.py
+++ b/frappe/patches/v7_0/rename_newsletter_list_to_email_group.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v7_0/set_email_group.py b/frappe/patches/v7_0/set_email_group.py
index e3dd66ebf3..251e9a27b6 100644
--- a/frappe/patches/v7_0/set_email_group.py
+++ b/frappe/patches/v7_0/set_email_group.py
@@ -1,11 +1,10 @@
# 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
def execute():
frappe.reload_doc("email", "doctype", "email_group_member")
if "newsletter_list" in frappe.db.get_table_columns("Email Group Member"):
- frappe.db.sql("""update `tabEmail Group Member` set email_group = newsletter_list
+ frappe.db.sql("""update `tabEmail Group Member` set email_group = newsletter_list
where email_group is null or email_group = ''""")
\ No newline at end of file
diff --git a/frappe/patches/v7_0/set_user_fullname.py b/frappe/patches/v7_0/set_user_fullname.py
index a7c6670f45..e69c180c27 100644
--- a/frappe/patches/v7_0/set_user_fullname.py
+++ b/frappe/patches/v7_0/set_user_fullname.py
@@ -1,9 +1,9 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
frappe.reload_doc("Core", "DocType", "User")
-
+
for user in frappe.db.get_all('User'):
user = frappe.get_doc('User', user.name)
user.set_full_name()
diff --git a/frappe/patches/v7_0/update_auth.py b/frappe/patches/v7_0/update_auth.py
index 3d47edf4b5..098081563f 100644
--- a/frappe/patches/v7_0/update_auth.py
+++ b/frappe/patches/v7_0/update_auth.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.utils.password import create_auth_table, set_encrypted_password
diff --git a/frappe/patches/v7_0/update_report_builder_json.py b/frappe/patches/v7_0/update_report_builder_json.py
index a344ca5412..01a6126de7 100644
--- a/frappe/patches/v7_0/update_report_builder_json.py
+++ b/frappe/patches/v7_0/update_report_builder_json.py
@@ -1,7 +1,6 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v7_0/update_send_after_in_bulk_email.py b/frappe/patches/v7_0/update_send_after_in_bulk_email.py
index 1b08309b6a..b9da83eaab 100644
--- a/frappe/patches/v7_0/update_send_after_in_bulk_email.py
+++ b/frappe/patches/v7_0/update_send_after_in_bulk_email.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.utils import now_datetime
diff --git a/frappe/patches/v7_1/disabled_print_settings_for_custom_print_format.py b/frappe/patches/v7_1/disabled_print_settings_for_custom_print_format.py
index c74d2d98f9..6ab9340845 100644
--- a/frappe/patches/v7_1/disabled_print_settings_for_custom_print_format.py
+++ b/frappe/patches/v7_1/disabled_print_settings_for_custom_print_format.py
@@ -2,16 +2,15 @@
# 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
def execute():
frappe.reload_doctype('Print Format')
- frappe.db.sql("""
- update
- `tabPrint Format`
- set
- align_labels_right = 0, line_breaks = 0, show_section_headings = 0
- where
+ frappe.db.sql("""
+ update
+ `tabPrint Format`
+ set
+ align_labels_right = 0, line_breaks = 0, show_section_headings = 0
+ where
custom_format = 1
""")
diff --git a/frappe/patches/v7_1/refactor_integration_broker.py b/frappe/patches/v7_1/refactor_integration_broker.py
index 8c9aaa6795..05ccae5d46 100644
--- a/frappe/patches/v7_1/refactor_integration_broker.py
+++ b/frappe/patches/v7_1/refactor_integration_broker.py
@@ -2,14 +2,13 @@
# 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
import json
def execute():
for doctype_name in ["Razorpay Log", "Razorpay Payment", "Razorpay Settings"]:
delete_doc("DocType", doctype_name)
-
+
reload_doctypes()
setup_services()
@@ -32,19 +31,19 @@ def setup_services():
service_settings = frappe.new_doc("{0} Settings".format(service["new_name"]))
service_settings.update(settings)
-
+
service_settings.flags.ignore_mandatory = True
service_settings.save(ignore_permissions=True)
if service["old_name"] in ["Dropbox Integration", "LDAP Auth"]:
delete_doc("Integration Service", service["old_name"])
-
+
new_service_doc = frappe.get_doc({
"doctype": "Integration Service",
"service": service["new_name"],
"enabled": 1
})
-
+
new_service_doc.flags.ignore_mandatory = True
new_service_doc.save(ignore_permissions=True)
diff --git a/frappe/patches/v7_1/rename_chinese_language_codes.py b/frappe/patches/v7_1/rename_chinese_language_codes.py
index 1ed25a4959..91ed73ccae 100644
--- a/frappe/patches/v7_1/rename_chinese_language_codes.py
+++ b/frappe/patches/v7_1/rename_chinese_language_codes.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v7_1/rename_scheduler_log_to_error_log.py b/frappe/patches/v7_1/rename_scheduler_log_to_error_log.py
index 4d1a39538f..c0c9e03565 100644
--- a/frappe/patches/v7_1/rename_scheduler_log_to_error_log.py
+++ b/frappe/patches/v7_1/rename_scheduler_log_to_error_log.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v7_1/set_backup_limit.py b/frappe/patches/v7_1/set_backup_limit.py
index 7b0a344305..ce502393b2 100644
--- a/frappe/patches/v7_1/set_backup_limit.py
+++ b/frappe/patches/v7_1/set_backup_limit.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
from frappe.utils import cint
import frappe
diff --git a/frappe/patches/v7_1/setup_integration_services.py b/frappe/patches/v7_1/setup_integration_services.py
index 1c70b8e835..9f4c8a3915 100644
--- a/frappe/patches/v7_1/setup_integration_services.py
+++ b/frappe/patches/v7_1/setup_integration_services.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.exceptions import DataError
from frappe.utils.password import get_decrypted_password
diff --git a/frappe/patches/v7_1/sync_language_doctype.py b/frappe/patches/v7_1/sync_language_doctype.py
index 83d1a4f5a6..a5e9ad1cb1 100644
--- a/frappe/patches/v7_1/sync_language_doctype.py
+++ b/frappe/patches/v7_1/sync_language_doctype.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.translate import get_lang_dict
diff --git a/frappe/patches/v7_2/fix_email_queue_recipient.py b/frappe/patches/v7_2/fix_email_queue_recipient.py
index 645b17b5c9..021397031b 100644
--- a/frappe/patches/v7_2/fix_email_queue_recipient.py
+++ b/frappe/patches/v7_2/fix_email_queue_recipient.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v7_2/merge_knowledge_base.py b/frappe/patches/v7_2/merge_knowledge_base.py
index 301d15e1dd..04e6c16213 100644
--- a/frappe/patches/v7_2/merge_knowledge_base.py
+++ b/frappe/patches/v7_2/merge_knowledge_base.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.patches.v7_0.re_route import update_routes
diff --git a/frappe/patches/v7_2/remove_in_filter.py b/frappe/patches/v7_2/remove_in_filter.py
index 36556d7c13..306879f996 100644
--- a/frappe/patches/v7_2/remove_in_filter.py
+++ b/frappe/patches/v7_2/remove_in_filter.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v7_2/set_doctype_engine.py b/frappe/patches/v7_2/set_doctype_engine.py
index 3a5cc384a2..e0df9cff87 100644
--- a/frappe/patches/v7_2/set_doctype_engine.py
+++ b/frappe/patches/v7_2/set_doctype_engine.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v7_2/set_in_standard_filter_property.py b/frappe/patches/v7_2/set_in_standard_filter_property.py
index 12f97f7f8e..568f43d2aa 100644
--- a/frappe/patches/v7_2/set_in_standard_filter_property.py
+++ b/frappe/patches/v7_2/set_in_standard_filter_property.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v7_2/setup_custom_perms.py b/frappe/patches/v7_2/setup_custom_perms.py
index 1b3b86236c..1f46072782 100644
--- a/frappe/patches/v7_2/setup_custom_perms.py
+++ b/frappe/patches/v7_2/setup_custom_perms.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.permissions import setup_custom_perms
from frappe.core.page.permission_manager.permission_manager import get_standard_permissions
diff --git a/frappe/patches/v7_2/setup_ldap_config.py b/frappe/patches/v7_2/setup_ldap_config.py
index 31dd8ca6fe..c9ad3e6714 100644
--- a/frappe/patches/v7_2/setup_ldap_config.py
+++ b/frappe/patches/v7_2/setup_ldap_config.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.utils import cint
diff --git a/frappe/patches/v7_2/update_communications.py b/frappe/patches/v7_2/update_communications.py
index f3d859b95a..114e531324 100644
--- a/frappe/patches/v7_2/update_communications.py
+++ b/frappe/patches/v7_2/update_communications.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v7_2/update_feedback_request.py b/frappe/patches/v7_2/update_feedback_request.py
index 11e9eb8e92..9bc656bf67 100644
--- a/frappe/patches/v7_2/update_feedback_request.py
+++ b/frappe/patches/v7_2/update_feedback_request.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v8_0/deprecate_integration_broker.py b/frappe/patches/v8_0/deprecate_integration_broker.py
index ad1a7d9571..9aeee17837 100644
--- a/frappe/patches/v8_0/deprecate_integration_broker.py
+++ b/frappe/patches/v8_0/deprecate_integration_broker.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.integrations.utils import create_payment_gateway
@@ -7,14 +7,14 @@ def execute():
for doctype in ["integration_request", "oauth_authorization_code", "oauth_bearer_token", "oauth_client"]:
frappe.reload_doc('integrations', 'doctype', doctype)
-
+
frappe.reload_doc("core", "doctype", "payment_gateway")
update_doctype_module()
create_payment_gateway_master_records()
for doctype in ["Integration Service", "Integration Service Parameter"]:
frappe.delete_doc("DocType", doctype)
-
+
if not frappe.db.get_value("DocType", {"module": "Integration Broker"}, "name"):
frappe.delete_doc("Module Def", "Integration Broker")
diff --git a/frappe/patches/v8_0/drop_in_dialog.py b/frappe/patches/v8_0/drop_in_dialog.py
index 231d757f26..5022333d22 100644
--- a/frappe/patches/v8_0/drop_in_dialog.py
+++ b/frappe/patches/v8_0/drop_in_dialog.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v8_0/drop_is_custom_from_docperm.py b/frappe/patches/v8_0/drop_is_custom_from_docperm.py
index 4530dcd2e0..0f17bbef5c 100644
--- a/frappe/patches/v8_0/drop_is_custom_from_docperm.py
+++ b/frappe/patches/v8_0/drop_is_custom_from_docperm.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v8_0/drop_unwanted_indexes.py b/frappe/patches/v8_0/drop_unwanted_indexes.py
index fc66ed43fd..655bce1a4b 100644
--- a/frappe/patches/v8_0/drop_unwanted_indexes.py
+++ b/frappe/patches/v8_0/drop_unwanted_indexes.py
@@ -2,14 +2,13 @@
# License: GNU General Public License v3. See license.txt
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
import frappe
def execute():
# communication
- unwanted_indexes = ["communication_date_index", "message_id_index", "modified_index",
+ unwanted_indexes = ["communication_date_index", "message_id_index", "modified_index",
"creation_index", "reference_owner", "communication_date"]
-
+
for k in unwanted_indexes:
try:
frappe.db.sql("drop index {0} on `tabCommunication`".format(k))
diff --git a/frappe/patches/v8_0/install_new_build_system_requirements.py b/frappe/patches/v8_0/install_new_build_system_requirements.py
index 536c2fcfb3..75ccfa87cd 100644
--- a/frappe/patches/v8_0/install_new_build_system_requirements.py
+++ b/frappe/patches/v8_0/install_new_build_system_requirements.py
@@ -1,4 +1,3 @@
-from __future__ import print_function, unicode_literals
from subprocess import Popen, call, PIPE
def execute():
diff --git a/frappe/patches/v8_0/newsletter_childtable_migrate.py b/frappe/patches/v8_0/newsletter_childtable_migrate.py
index f652b37f56..67ff5e586f 100644
--- a/frappe/patches/v8_0/newsletter_childtable_migrate.py
+++ b/frappe/patches/v8_0/newsletter_childtable_migrate.py
@@ -1,7 +1,6 @@
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
@@ -10,7 +9,7 @@ def execute():
if "email_group" not in frappe.db.get_table_columns("Newsletter"):
return
-
+
newsletters = frappe.get_all("Newsletter", fields=["name", "email_group"])
for newsletter in newsletters:
if newsletter.email_group:
diff --git a/frappe/patches/v8_0/rename_listsettings_to_usersettings.py b/frappe/patches/v8_0/rename_listsettings_to_usersettings.py
index 584e4a1111..9545953e34 100644
--- a/frappe/patches/v8_0/rename_listsettings_to_usersettings.py
+++ b/frappe/patches/v8_0/rename_listsettings_to_usersettings.py
@@ -1,7 +1,6 @@
-from __future__ import unicode_literals
+
from frappe.model.utils.user_settings import update_user_settings
import frappe, json
-from six import iteritems
def execute():
@@ -35,7 +34,7 @@ def execute():
for user in frappe.db.get_all('User', {'user_type': 'System User'}):
defaults = frappe.defaults.get_defaults_for(user.name)
- for key, value in iteritems(defaults):
+ for key, value in defaults.items():
if key.startswith('_list_settings:'):
doctype = key.replace('_list_settings:', '')
columns = ['`tab{1}`.`{0}`'.format(*c) for c in json.loads(value)]
diff --git a/frappe/patches/v8_0/rename_page_role_to_has_role.py b/frappe/patches/v8_0/rename_page_role_to_has_role.py
index 9c610d857d..49006ea419 100644
--- a/frappe/patches/v8_0/rename_page_role_to_has_role.py
+++ b/frappe/patches/v8_0/rename_page_role_to_has_role.py
@@ -1,7 +1,6 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
@@ -17,7 +16,7 @@ def reload_doc():
frappe.reload_doc("core", 'doctype', "report")
frappe.reload_doc("core", 'doctype', "user")
frappe.reload_doc("core", 'doctype', "has_role")
-
+
def set_ref_doctype_roles_to_report():
for data in frappe.get_all('Report', fields=["name"]):
doc = frappe.get_doc('Report', data.name)
diff --git a/frappe/patches/v8_0/rename_print_to_printing.py b/frappe/patches/v8_0/rename_print_to_printing.py
index ecdbc3f7be..56889d630e 100644
--- a/frappe/patches/v8_0/rename_print_to_printing.py
+++ b/frappe/patches/v8_0/rename_print_to_printing.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
@@ -9,5 +9,5 @@ def execute():
frappe.reload_doc('printing', 'doctype', 'letter_head')
frappe.reload_doc('printing', 'page', 'print_format_builder')
frappe.db.sql("""update `tabPrint Format` set module='Printing' where module='Print'""")
-
+
frappe.delete_doc('Module Def', 'Print')
\ No newline at end of file
diff --git a/frappe/patches/v8_0/set_allow_traceback.py b/frappe/patches/v8_0/set_allow_traceback.py
index 3eceb3e29c..bb72e7dde6 100644
--- a/frappe/patches/v8_0/set_allow_traceback.py
+++ b/frappe/patches/v8_0/set_allow_traceback.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v8_0/set_currency_field_precision.py b/frappe/patches/v8_0/set_currency_field_precision.py
index 89835c8c1e..57b12ffdee 100644
--- a/frappe/patches/v8_0/set_currency_field_precision.py
+++ b/frappe/patches/v8_0/set_currency_field_precision.py
@@ -1,7 +1,6 @@
# Copyright (c) 2013, Web Notes 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 get_number_format_info
diff --git a/frappe/patches/v8_0/set_doctype_values_in_custom_role.py b/frappe/patches/v8_0/set_doctype_values_in_custom_role.py
index 58cdc4497d..50e7eb83e1 100644
--- a/frappe/patches/v8_0/set_doctype_values_in_custom_role.py
+++ b/frappe/patches/v8_0/set_doctype_values_in_custom_role.py
@@ -1,13 +1,12 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doctype('Custom Role')
-
+
# set ref doctype in custom role for reports
- frappe.db.sql(""" update `tabCustom Role` set
+ frappe.db.sql(""" update `tabCustom Role` set
`tabCustom Role`.ref_doctype = (select ref_doctype from `tabReport` where name = `tabCustom Role`.report)
where `tabCustom Role`.report is not null""")
diff --git a/frappe/patches/v8_0/set_user_permission_for_page_and_report.py b/frappe/patches/v8_0/set_user_permission_for_page_and_report.py
index 560ea46db2..55789a8301 100644
--- a/frappe/patches/v8_0/set_user_permission_for_page_and_report.py
+++ b/frappe/patches/v8_0/set_user_permission_for_page_and_report.py
@@ -1,7 +1,6 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
@@ -9,13 +8,13 @@ def execute():
frappe.reload_doc("core", 'doctype', "custom_role")
set_user_permission_for_page_and_report()
- update_ref_doctype_in_custom_role()
+ update_ref_doctype_in_custom_role()
def update_ref_doctype_in_custom_role():
frappe.reload_doc("core", 'doctype', "custom_role")
- frappe.db.sql("""update `tabCustom Role`
- set
- ref_doctype = (select ref_doctype from tabReport where name = `tabCustom Role`.report)
+ frappe.db.sql("""update `tabCustom Role`
+ set
+ ref_doctype = (select ref_doctype from tabReport where name = `tabCustom Role`.report)
where report is not null""")
def set_user_permission_for_page_and_report():
diff --git a/frappe/patches/v8_0/setup_email_inbox.py b/frappe/patches/v8_0/setup_email_inbox.py
index 1bfe3b0b74..ad99068eb9 100644
--- a/frappe/patches/v8_0/setup_email_inbox.py
+++ b/frappe/patches/v8_0/setup_email_inbox.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe, json
from frappe.core.doctype.user.user import ask_pass_update, setup_user_email_inbox
diff --git a/frappe/patches/v8_0/update_gender_and_salutation.py b/frappe/patches/v8_0/update_gender_and_salutation.py
index bcd9d4cbd7..913e0f714b 100644
--- a/frappe/patches/v8_0/update_gender_and_salutation.py
+++ b/frappe/patches/v8_0/update_gender_and_salutation.py
@@ -1,6 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-from __future__ import unicode_literals
import frappe
from frappe.desk.page.setup_wizard.install_fixtures import update_genders, update_salutations
diff --git a/frappe/patches/v8_0/update_global_search_table.py b/frappe/patches/v8_0/update_global_search_table.py
index 3c0a70155b..4d5c8be9cf 100644
--- a/frappe/patches/v8_0/update_global_search_table.py
+++ b/frappe/patches/v8_0/update_global_search_table.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v8_0/update_published_in_global_search.py b/frappe/patches/v8_0/update_published_in_global_search.py
index a378f24732..ae86cb8b24 100644
--- a/frappe/patches/v8_0/update_published_in_global_search.py
+++ b/frappe/patches/v8_0/update_published_in_global_search.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v8_0/update_records_in_global_search.py b/frappe/patches/v8_0/update_records_in_global_search.py
index dafa1e76d3..316f84b2f0 100644
--- a/frappe/patches/v8_0/update_records_in_global_search.py
+++ b/frappe/patches/v8_0/update_records_in_global_search.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.utils.global_search import get_doctypes_with_global_search, rebuild_for_doctype
from frappe.utils import update_progress_bar
@@ -6,7 +6,7 @@ from frappe.utils import update_progress_bar
def execute():
frappe.cache().delete_value('doctypes_with_global_search')
doctypes_with_global_search = get_doctypes_with_global_search(with_child_tables=False)
-
+
for i, doctype in enumerate(doctypes_with_global_search):
update_progress_bar("Updating Global Search", i, len(doctypes_with_global_search))
rebuild_for_doctype(doctype)
diff --git a/frappe/patches/v8_1/delete_custom_docperm_if_doctype_not_exists.py b/frappe/patches/v8_1/delete_custom_docperm_if_doctype_not_exists.py
index 92b54edfd4..510018eb47 100644
--- a/frappe/patches/v8_1/delete_custom_docperm_if_doctype_not_exists.py
+++ b/frappe/patches/v8_1/delete_custom_docperm_if_doctype_not_exists.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v8_1/enable_allow_error_traceback_in_system_settings.py b/frappe/patches/v8_1/enable_allow_error_traceback_in_system_settings.py
index 9bd9757a86..513bb274bc 100644
--- a/frappe/patches/v8_1/enable_allow_error_traceback_in_system_settings.py
+++ b/frappe/patches/v8_1/enable_allow_error_traceback_in_system_settings.py
@@ -1,7 +1,6 @@
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v8_1/update_format_options_in_auto_email_report.py b/frappe/patches/v8_1/update_format_options_in_auto_email_report.py
index 56609780cb..8bea2b7bf5 100644
--- a/frappe/patches/v8_1/update_format_options_in_auto_email_report.py
+++ b/frappe/patches/v8_1/update_format_options_in_auto_email_report.py
@@ -1,7 +1,6 @@
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v8_10/delete_static_web_page_from_global_search.py b/frappe/patches/v8_10/delete_static_web_page_from_global_search.py
index 336562c157..aa6a053412 100644
--- a/frappe/patches/v8_10/delete_static_web_page_from_global_search.py
+++ b/frappe/patches/v8_10/delete_static_web_page_from_global_search.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v8_5/delete_email_group_member_with_invalid_emails.py b/frappe/patches/v8_5/delete_email_group_member_with_invalid_emails.py
index 89a9a7a1b9..5851e2855b 100644
--- a/frappe/patches/v8_5/delete_email_group_member_with_invalid_emails.py
+++ b/frappe/patches/v8_5/delete_email_group_member_with_invalid_emails.py
@@ -1,7 +1,6 @@
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.utils import validate_email_address
diff --git a/frappe/patches/v8_5/patch_event_colors.py b/frappe/patches/v8_5/patch_event_colors.py
index 8ac7aec238..3c34f7946b 100644
--- a/frappe/patches/v8_5/patch_event_colors.py
+++ b/frappe/patches/v8_5/patch_event_colors.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v8_x/update_user_permission.py b/frappe/patches/v8_x/update_user_permission.py
index 693b87c974..387751500f 100644
--- a/frappe/patches/v8_x/update_user_permission.py
+++ b/frappe/patches/v8_x/update_user_permission.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v9_1/__init__.py b/frappe/patches/v9_1/__init__.py
index baffc48825..8b13789179 100644
--- a/frappe/patches/v9_1/__init__.py
+++ b/frappe/patches/v9_1/__init__.py
@@ -1 +1 @@
-from __future__ import unicode_literals
+
diff --git a/frappe/patches/v9_1/add_sms_sender_name_as_parameters.py b/frappe/patches/v9_1/add_sms_sender_name_as_parameters.py
index 9d7c0f003f..f63e86a340 100644
--- a/frappe/patches/v9_1/add_sms_sender_name_as_parameters.py
+++ b/frappe/patches/v9_1/add_sms_sender_name_as_parameters.py
@@ -1,7 +1,6 @@
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
import frappe
def execute():
diff --git a/frappe/patches/v9_1/move_feed_to_activity_log.py b/frappe/patches/v9_1/move_feed_to_activity_log.py
index db46b4e419..a549296357 100644
--- a/frappe/patches/v9_1/move_feed_to_activity_log.py
+++ b/frappe/patches/v9_1/move_feed_to_activity_log.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.utils.background_jobs import enqueue
diff --git a/frappe/patches/v9_1/resave_domain_settings.py b/frappe/patches/v9_1/resave_domain_settings.py
index 1e54ad3aa5..5814871c2e 100644
--- a/frappe/patches/v9_1/resave_domain_settings.py
+++ b/frappe/patches/v9_1/resave_domain_settings.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/patches/v9_1/revert_domain_settings.py b/frappe/patches/v9_1/revert_domain_settings.py
index a14b48dae6..99c5561d78 100644
--- a/frappe/patches/v9_1/revert_domain_settings.py
+++ b/frappe/patches/v9_1/revert_domain_settings.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
def execute():
diff --git a/frappe/permissions.py b/frappe/permissions.py
index 19f101aab5..e139b04a4e 100644
--- a/frappe/permissions.py
+++ b/frappe/permissions.py
@@ -1,12 +1,10 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
-from six import string_types
-import frappe, copy, json
+import frappe, copy
from frappe import _, msgprint
from frappe.utils import cint
import frappe.share
+
rights = ("select", "read", "write", "create", "delete", "submit", "cancel", "amend",
"print", "email", "report", "import", "export", "set_user_permissions", "share")
@@ -58,7 +56,7 @@ def has_permission(doctype, ptype="read", doc=None, verbose=False, user=None, ra
meta = frappe.get_meta(doctype)
if doc:
- if isinstance(doc, string_types):
+ if isinstance(doc, str):
doc = frappe.get_doc(meta.name, doc)
perm = get_doc_permissions(doc, user=user, ptype=ptype).get(ptype)
if not perm: push_perm_check_log(_('User {0} does not have access to this document').format(frappe.bold(user)))
@@ -159,7 +157,7 @@ def get_role_permissions(doctype_meta, user=None, is_owner=None):
}
}
"""
- if isinstance(doctype_meta, string_types):
+ if isinstance(doctype_meta, str):
doctype_meta = frappe.get_meta(doctype_meta) # assuming doctype name was passed
if not user: user = frappe.session.user
@@ -534,7 +532,7 @@ def get_linked_doctypes(dt):
def get_doc_name(doc):
if not doc: return None
- return doc if isinstance(doc, string_types) else doc.name
+ return doc if isinstance(doc, str) else doc.name
def allow_everything():
'''
diff --git a/frappe/printing/doctype/letter_head/letter_head.py b/frappe/printing/doctype/letter_head/letter_head.py
index 3a3b14faad..948be60b88 100644
--- a/frappe/printing/doctype/letter_head/letter_head.py
+++ b/frappe/printing/doctype/letter_head/letter_head.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.utils import is_image
from frappe.model.document import Document
@@ -19,7 +18,7 @@ class LetterHead(Document):
def validate_disabled_and_default(self):
if self.disabled and self.is_default:
frappe.throw(_("Letter Head cannot be both disabled and default"))
-
+
if not self.is_default and not self.disabled:
if not frappe.db.exists('Letter Head', dict(is_default=1)):
self.is_default = 1
diff --git a/frappe/printing/doctype/letter_head/test_letter_head.py b/frappe/printing/doctype/letter_head/test_letter_head.py
index b69e9924ea..96dfc68705 100644
--- a/frappe/printing/doctype/letter_head/test_letter_head.py
+++ b/frappe/printing/doctype/letter_head/test_letter_head.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/printing/doctype/print_format/print_format.py b/frappe/printing/doctype/print_format/print_format.py
index 1c11f2d519..5d4ff92fe2 100644
--- a/frappe/printing/doctype/print_format/print_format.py
+++ b/frappe/printing/doctype/print_format/print_format.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
import frappe.utils
import json
diff --git a/frappe/printing/doctype/print_format/test_print_format.py b/frappe/printing/doctype/print_format/test_print_format.py
index 121916ae5f..e65eb0183f 100644
--- a/frappe/printing/doctype/print_format/test_print_format.py
+++ b/frappe/printing/doctype/print_format/test_print_format.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals, print_function
-
import frappe
import unittest
import re
diff --git a/frappe/printing/doctype/print_heading/print_heading.py b/frappe/printing/doctype/print_heading/print_heading.py
index 1bb3e52dd5..f9955c019d 100644
--- a/frappe/printing/doctype/print_heading/print_heading.py
+++ b/frappe/printing/doctype/print_heading/print_heading.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/printing/doctype/print_heading/test_print_heading.py b/frappe/printing/doctype/print_heading/test_print_heading.py
index 1a6435e783..ce99cde607 100644
--- a/frappe/printing/doctype/print_heading/test_print_heading.py
+++ b/frappe/printing/doctype/print_heading/test_print_heading.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/printing/doctype/print_settings/print_settings.py b/frappe/printing/doctype/print_settings/print_settings.py
index cf6a71a8ac..610c083097 100644
--- a/frappe/printing/doctype/print_settings/print_settings.py
+++ b/frappe/printing/doctype/print_settings/print_settings.py
@@ -2,7 +2,6 @@
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import cint
diff --git a/frappe/printing/doctype/print_settings/test_print_settings.py b/frappe/printing/doctype/print_settings/test_print_settings.py
index b8ad70a681..d1dec861b2 100644
--- a/frappe/printing/doctype/print_settings/test_print_settings.py
+++ b/frappe/printing/doctype/print_settings/test_print_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import unittest
class TestPrintSettings(unittest.TestCase):
diff --git a/frappe/printing/doctype/print_style/print_style.py b/frappe/printing/doctype/print_style/print_style.py
index 310babd5df..a91786795c 100644
--- a/frappe/printing/doctype/print_style/print_style.py
+++ b/frappe/printing/doctype/print_style/print_style.py
@@ -2,7 +2,6 @@
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/printing/doctype/print_style/test_print_style.py b/frappe/printing/doctype/print_style/test_print_style.py
index cee57f8826..b717b23df8 100644
--- a/frappe/printing/doctype/print_style/test_print_style.py
+++ b/frappe/printing/doctype/print_style/test_print_style.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/pythonrc.py b/frappe/pythonrc.py
index 308bad7382..6761ead05b 100755
--- a/frappe/pythonrc.py
+++ b/frappe/pythonrc.py
@@ -3,8 +3,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import os
import frappe
frappe.connect(site=os.environ.get("site"))
\ No newline at end of file
diff --git a/frappe/rate_limiter.py b/frappe/rate_limiter.py
index 40db8fe892..023cdb9cb0 100644
--- a/frappe/rate_limiter.py
+++ b/frappe/rate_limiter.py
@@ -2,8 +2,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
from datetime import datetime
from functools import wraps
from typing import Union, Callable
diff --git a/frappe/recorder.py b/frappe/recorder.py
index e3eef94809..02036b7374 100644
--- a/frappe/recorder.py
+++ b/frappe/recorder.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
from collections import Counter
import datetime
import inspect
diff --git a/frappe/sessions.py b/frappe/sessions.py
index 9e503bbe25..1bc78448e7 100644
--- a/frappe/sessions.py
+++ b/frappe/sessions.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals
"""
Boot session from cache or build
@@ -16,8 +14,7 @@ import frappe.model.meta
import frappe.defaults
import frappe.translate
import redis
-from six.moves.urllib.parse import unquote
-from six import text_type
+from urllib.parse import unquote
from frappe.cache_manager import clear_user_cache
@frappe.whitelist(allow_guest=True)
@@ -337,7 +334,7 @@ class Session:
now = frappe.utils.now()
self.data['data']['last_updated'] = now
- self.data['data']['lang'] = text_type(frappe.lang)
+ self.data['data']['lang'] = str(frappe.lang)
# update session in db
last_updated = frappe.cache().hget("last_db_session_update", self.sid)
diff --git a/frappe/share.py b/frappe/share.py
index 63c6ce2f35..10c0f26c22 100644
--- a/frappe/share.py
+++ b/frappe/share.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.desk.form.document_follow import follow_document
diff --git a/frappe/social/doctype/energy_point_log/energy_point_log.py b/frappe/social/doctype/energy_point_log/energy_point_log.py
index 2e2289aed4..aff3c7cd59 100644
--- a/frappe/social/doctype/energy_point_log/energy_point_log.py
+++ b/frappe/social/doctype/energy_point_log/energy_point_log.py
@@ -2,7 +2,6 @@
# 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 json
diff --git a/frappe/social/doctype/energy_point_log/test_energy_point_log.py b/frappe/social/doctype/energy_point_log/test_energy_point_log.py
index 222c64389b..8c4dba5d6b 100644
--- a/frappe/social/doctype/energy_point_log/test_energy_point_log.py
+++ b/frappe/social/doctype/energy_point_log/test_energy_point_log.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
from .energy_point_log import get_energy_points as _get_energy_points, create_review_points_log, review
diff --git a/frappe/social/doctype/energy_point_rule/energy_point_rule.py b/frappe/social/doctype/energy_point_rule/energy_point_rule.py
index 9acb63d087..1c736528de 100644
--- a/frappe/social/doctype/energy_point_rule/energy_point_rule.py
+++ b/frappe/social/doctype/energy_point_rule/energy_point_rule.py
@@ -2,7 +2,6 @@
# 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 frappe.cache_manager
diff --git a/frappe/social/doctype/energy_point_settings/energy_point_settings.py b/frappe/social/doctype/energy_point_settings/energy_point_settings.py
index 7299eef916..64944d64e8 100644
--- a/frappe/social/doctype/energy_point_settings/energy_point_settings.py
+++ b/frappe/social/doctype/energy_point_settings/energy_point_settings.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, 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.social.doctype.energy_point_log.energy_point_log import create_review_points_log
diff --git a/frappe/social/doctype/post/post.py b/frappe/social/doctype/post/post.py
index 9c7c1db1d4..62a0155d3c 100644
--- a/frappe/social/doctype/post/post.py
+++ b/frappe/social/doctype/post/post.py
@@ -2,7 +2,6 @@
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
import requests
from bs4 import BeautifulSoup
diff --git a/frappe/social/doctype/post_comment/post_comment.py b/frappe/social/doctype/post_comment/post_comment.py
index df24c4609a..14001ba537 100644
--- a/frappe/social/doctype/post_comment/post_comment.py
+++ b/frappe/social/doctype/post_comment/post_comment.py
@@ -2,7 +2,6 @@
# Copyright (c) 2018, 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.core.doctype.user.user import extract_mentions
diff --git a/frappe/social/doctype/review_level/review_level.py b/frappe/social/doctype/review_level/review_level.py
index 87720b63fc..6622a89ab9 100644
--- a/frappe/social/doctype/review_level/review_level.py
+++ b/frappe/social/doctype/review_level/review_level.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/templates/includes/comments/comments.py b/frappe/templates/includes/comments/comments.py
index d08eb12ba8..2dda492593 100644
--- a/frappe/templates/includes/comments/comments.py
+++ b/frappe/templates/includes/comments/comments.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
import re
from frappe.website.render import clear_cache
diff --git a/frappe/templates/pages/integrations/braintree_checkout.py b/frappe/templates/pages/integrations/braintree_checkout.py
index ad262c34b2..c4aa1a7b9f 100644
--- a/frappe/templates/pages/integrations/braintree_checkout.py
+++ b/frappe/templates/pages/integrations/braintree_checkout.py
@@ -1,6 +1,5 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
diff --git a/frappe/templates/pages/integrations/payment_cancel.py b/frappe/templates/pages/integrations/payment_cancel.py
index db335b8549..0387c9e50a 100644
--- a/frappe/templates/pages/integrations/payment_cancel.py
+++ b/frappe/templates/pages/integrations/payment_cancel.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
import frappe
def get_context(context):
diff --git a/frappe/templates/pages/integrations/payment_success.py b/frappe/templates/pages/integrations/payment_success.py
index bdc14db5b9..1eb9215121 100644
--- a/frappe/templates/pages/integrations/payment_success.py
+++ b/frappe/templates/pages/integrations/payment_success.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
no_cache = True
diff --git a/frappe/templates/pages/integrations/paytm_checkout.py b/frappe/templates/pages/integrations/paytm_checkout.py
index bc385b5784..1bd9457ef6 100644
--- a/frappe/templates/pages/integrations/paytm_checkout.py
+++ b/frappe/templates/pages/integrations/paytm_checkout.py
@@ -1,6 +1,5 @@
# 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 import _
import json
diff --git a/frappe/templates/pages/integrations/razorpay_checkout.py b/frappe/templates/pages/integrations/razorpay_checkout.py
index 039ea1776e..1901577d4b 100644
--- a/frappe/templates/pages/integrations/razorpay_checkout.py
+++ b/frappe/templates/pages/integrations/razorpay_checkout.py
@@ -1,11 +1,9 @@
# 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 import _
from frappe.utils import flt, cint
import json
-from six import string_types
no_cache = 1
@@ -47,7 +45,7 @@ def get_api_key():
def make_payment(razorpay_payment_id, options, reference_doctype, reference_docname, token):
data = {}
- if isinstance(options, string_types):
+ if isinstance(options, str):
data = json.loads(options)
data.update({
diff --git a/frappe/templates/pages/integrations/stripe_checkout.py b/frappe/templates/pages/integrations/stripe_checkout.py
index 142d5b35cd..186c3e0942 100644
--- a/frappe/templates/pages/integrations/stripe_checkout.py
+++ b/frappe/templates/pages/integrations/stripe_checkout.py
@@ -1,6 +1,5 @@
# 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 import _
from frappe.utils import cint, fmt_money
diff --git a/frappe/test_runner.py b/frappe/test_runner.py
index cd71dd46c5..1f99e55fb8 100644
--- a/frappe/test_runner.py
+++ b/frappe/test_runner.py
@@ -1,8 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
-
import frappe
import unittest, json, sys, os
import time
@@ -11,8 +8,8 @@ import importlib
from frappe.modules import load_doctype_module, get_module_name
import frappe.utils.scheduler
import cProfile, pstats
-from six import StringIO
-from six.moves import reload_module
+from io import StringIO
+from importlib import reload
from frappe.model.naming import revert_series_if_last
unittest_runner = unittest.TextTestRunner
@@ -281,7 +278,7 @@ def get_modules(doctype):
try:
test_module = load_doctype_module(doctype, module, "test_")
if test_module:
- reload_module(test_module)
+ reload(test_module)
except ImportError:
test_module = None
diff --git a/frappe/tests/test_assign.py b/frappe/tests/test_assign.py
index 439e1546c0..e9c1ccec6d 100644
--- a/frappe/tests/test_assign.py
+++ b/frappe/tests/test_assign.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, unittest
import frappe.desk.form.assign_to
from frappe.desk.listview import get_group_by_count
diff --git a/frappe/tests/test_auth.py b/frappe/tests/test_auth.py
index bbe9c36aea..bc23cb591c 100644
--- a/frappe/tests/test_auth.py
+++ b/frappe/tests/test_auth.py
@@ -1,7 +1,5 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import time
import unittest
diff --git a/frappe/tests/test_bot.py b/frappe/tests/test_bot.py
index b098584a8f..4500ab95ac 100644
--- a/frappe/tests/test_bot.py
+++ b/frappe/tests/test_bot.py
@@ -3,7 +3,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import unittest
class TestBot(unittest.TestCase):
diff --git a/frappe/tests/test_client.py b/frappe/tests/test_client.py
index 6be437601b..aed8dc8581 100644
--- a/frappe/tests/test_client.py
+++ b/frappe/tests/test_client.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-from __future__ import unicode_literals
-
import unittest
import frappe
diff --git a/frappe/tests/test_cors.py b/frappe/tests/test_cors.py
index d4ed260f61..38c3fd8132 100644
--- a/frappe/tests/test_cors.py
+++ b/frappe/tests/test_cors.py
@@ -1,7 +1,5 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, unittest
from werkzeug.wrappers import Response
from frappe.app import process_response
diff --git a/frappe/tests/test_db.py b/frappe/tests/test_db.py
index 79ab8bf421..a31a898d73 100644
--- a/frappe/tests/test_db.py
+++ b/frappe/tests/test_db.py
@@ -3,8 +3,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import unittest
from random import choice
diff --git a/frappe/tests/test_db_query.py b/frappe/tests/test_db_query.py
index 085c257550..42ebd05b67 100644
--- a/frappe/tests/test_db_query.py
+++ b/frappe/tests/test_db_query.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, unittest
from frappe.model.db_query import DatabaseQuery
diff --git a/frappe/tests/test_defaults.py b/frappe/tests/test_defaults.py
index 210ea0d36c..d051c0a184 100644
--- a/frappe/tests/test_defaults.py
+++ b/frappe/tests/test_defaults.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, unittest
from frappe.defaults import *
diff --git a/frappe/tests/test_document.py b/frappe/tests/test_document.py
index 1a5a8721fd..7c0c95671a 100644
--- a/frappe/tests/test_document.py
+++ b/frappe/tests/test_document.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import os
import unittest
diff --git a/frappe/tests/test_document_locks.py b/frappe/tests/test_document_locks.py
index c270b1bf28..650a913bee 100644
--- a/frappe/tests/test_document_locks.py
+++ b/frappe/tests/test_document_locks.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, unittest
class TestDocumentLocks(unittest.TestCase):
diff --git a/frappe/tests/test_domainification.py b/frappe/tests/test_domainification.py
index 2fd2e7f3ff..c9acd9ec45 100644
--- a/frappe/tests/test_domainification.py
+++ b/frappe/tests/test_domainification.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import unittest, frappe
from frappe.core.page.permission_manager.permission_manager import get_roles_and_doctypes
from frappe.desk.doctype.desktop_icon.desktop_icon import (get_desktop_icons, add_user_icon,
diff --git a/frappe/tests/test_dynamic_links.py b/frappe/tests/test_dynamic_links.py
index 98da2cbc35..04ccc91ff2 100644
--- a/frappe/tests/test_dynamic_links.py
+++ b/frappe/tests/test_dynamic_links.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, unittest
class TestDynamicLinks(unittest.TestCase):
diff --git a/frappe/tests/test_email.py b/frappe/tests/test_email.py
index 8340db4852..445ee21b36 100644
--- a/frappe/tests/test_email.py
+++ b/frappe/tests/test_email.py
@@ -1,10 +1,7 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import unittest, frappe, re, email
-from six import PY3
test_dependencies = ['Email Account']
@@ -118,10 +115,7 @@ class TestEmail(unittest.TestCase):
content = part.get_payload(decode=True)
if content:
- if PY3:
- eol = "\r\n"
- else:
- eol = "\n"
+ eol = "\r\n"
frappe.local.flags.signed_query_string = \
re.search(r'(?<=/api/method/frappe.email.queue.unsubscribe\?).*(?=' + eol + ')',
diff --git a/frappe/tests/test_exporter_fixtures.py b/frappe/tests/test_exporter_fixtures.py
index b8bd94e3e9..0893500daf 100644
--- a/frappe/tests/test_exporter_fixtures.py
+++ b/frappe/tests/test_exporter_fixtures.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
import frappe.defaults
from frappe.core.doctype.data_import.data_import import export_csv
diff --git a/frappe/tests/test_fmt_datetime.py b/frappe/tests/test_fmt_datetime.py
index e19eb25fe6..8f5408948d 100644
--- a/frappe/tests/test_fmt_datetime.py
+++ b/frappe/tests/test_fmt_datetime.py
@@ -1,7 +1,5 @@
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import datetime
import frappe
diff --git a/frappe/tests/test_fmt_money.py b/frappe/tests/test_fmt_money.py
index a1321658b7..160ea33378 100644
--- a/frappe/tests/test_fmt_money.py
+++ b/frappe/tests/test_fmt_money.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
from frappe.utils import fmt_money
import unittest
diff --git a/frappe/tests/test_form_load.py b/frappe/tests/test_form_load.py
index b382fa7381..dd6ccd9bcd 100644
--- a/frappe/tests/test_form_load.py
+++ b/frappe/tests/test_form_load.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, unittest
from frappe.desk.form.load import getdoctype, getdoc
from frappe.core.page.permission_manager.permission_manager import update, reset, add
diff --git a/frappe/tests/test_geo_ip.py b/frappe/tests/test_geo_ip.py
index b292e43ba5..f085838f37 100644
--- a/frappe/tests/test_geo_ip.py
+++ b/frappe/tests/test_geo_ip.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import unittest
class TestGeoIP(unittest.TestCase):
diff --git a/frappe/tests/test_global_search.py b/frappe/tests/test_global_search.py
index 5cffbaaf64..3921af6738 100644
--- a/frappe/tests/test_global_search.py
+++ b/frappe/tests/test_global_search.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import unittest
import frappe
diff --git a/frappe/tests/test_goal.py b/frappe/tests/test_goal.py
index b4c0736482..5a83baa1af 100644
--- a/frappe/tests/test_goal.py
+++ b/frappe/tests/test_goal.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import unittest
import frappe
diff --git a/frappe/tests/test_hooks.py b/frappe/tests/test_hooks.py
index ff71e2414c..3f66afe34a 100644
--- a/frappe/tests/test_hooks.py
+++ b/frappe/tests/test_hooks.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import unittest
import frappe
from frappe.desk.doctype.todo.todo import ToDo
@@ -19,12 +18,12 @@ class TestHooks(unittest.TestCase):
def test_override_doctype_class(self):
from frappe import hooks
-
+
# Set hook
hooks.override_doctype_class = {
'ToDo': ['frappe.tests.test_hooks.CustomToDo']
}
-
+
# Clear cache
frappe.cache().delete_value('app_hooks')
clear_controller_cache('ToDo')
diff --git a/frappe/tests/test_listview.py b/frappe/tests/test_listview.py
index 1ef72fdd32..4efb570e7e 100644
--- a/frappe/tests/test_listview.py
+++ b/frappe/tests/test_listview.py
@@ -1,7 +1,5 @@
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import unittest
import frappe
import json
diff --git a/frappe/tests/test_monitor.py b/frappe/tests/test_monitor.py
index b447e89b06..dbc5fe35e1 100644
--- a/frappe/tests/test_monitor.py
+++ b/frappe/tests/test_monitor.py
@@ -2,7 +2,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import unittest
import frappe
import frappe.monitor
diff --git a/frappe/tests/test_naming.py b/frappe/tests/test_naming.py
index 66d48e3612..557993882f 100644
--- a/frappe/tests/test_naming.py
+++ b/frappe/tests/test_naming.py
@@ -1,7 +1,6 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import unittest
import frappe
from frappe.utils import now_datetime
diff --git a/frappe/tests/test_password.py b/frappe/tests/test_password.py
index 98141072e2..6a5b948d93 100644
--- a/frappe/tests/test_password.py
+++ b/frappe/tests/test_password.py
@@ -1,6 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import unittest
from frappe.utils.password import update_password, check_password, passlibctx
diff --git a/frappe/tests/test_patches.py b/frappe/tests/test_patches.py
index ed22afc0af..7f4efc700c 100644
--- a/frappe/tests/test_patches.py
+++ b/frappe/tests/test_patches.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import unittest, frappe
from frappe.modules import patch_handler
diff --git a/frappe/tests/test_pdf.py b/frappe/tests/test_pdf.py
index be287e0d92..b67aee7a68 100644
--- a/frappe/tests/test_pdf.py
+++ b/frappe/tests/test_pdf.py
@@ -1,11 +1,9 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import unittest
import frappe.utils.pdf as pdfgen
-import frappe, io, six
+import frappe, io
from PyPDF2 import PdfFileReader
#class TestPdfBorders(unittest.TestCase):
@@ -44,8 +42,6 @@ class TestPdf(unittest.TestCase):
pdf = pdfgen.get_pdf(self.html, options={"password": password})
reader = PdfFileReader(io.BytesIO(pdf))
self.assertTrue(reader.isEncrypted)
- if six.PY2:
- password = frappe.safe_encode(password)
self.assertTrue(reader.decrypt(password))
def test_pdf_generation_as_a_user(self):
diff --git a/frappe/tests/test_permissions.py b/frappe/tests/test_permissions.py
index 82f0ee920a..ada64156de 100644
--- a/frappe/tests/test_permissions.py
+++ b/frappe/tests/test_permissions.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
"""Use blog post test to test user permissions logic"""
import frappe
diff --git a/frappe/tests/test_query_report.py b/frappe/tests/test_query_report.py
index eaf4dc7070..3d9791d399 100644
--- a/frappe/tests/test_query_report.py
+++ b/frappe/tests/test_query_report.py
@@ -1,8 +1,6 @@
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import unittest
import frappe
diff --git a/frappe/tests/test_rate_limiter.py b/frappe/tests/test_rate_limiter.py
index ae1857bb31..71977935a9 100644
--- a/frappe/tests/test_rate_limiter.py
+++ b/frappe/tests/test_rate_limiter.py
@@ -3,8 +3,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import unittest
from werkzeug.wrappers import Response
import time
diff --git a/frappe/tests/test_recorder.py b/frappe/tests/test_recorder.py
index 64d3c52f63..08dbde0144 100644
--- a/frappe/tests/test_recorder.py
+++ b/frappe/tests/test_recorder.py
@@ -3,7 +3,6 @@
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import unittest
import frappe
import frappe.recorder
diff --git a/frappe/tests/test_safe_exec.py b/frappe/tests/test_safe_exec.py
index d7b25b8194..79f2c504a4 100644
--- a/frappe/tests/test_safe_exec.py
+++ b/frappe/tests/test_safe_exec.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import unittest, frappe
from frappe.utils.safe_exec import safe_exec, get_safe_globals
diff --git a/frappe/tests/test_scheduler.py b/frappe/tests/test_scheduler.py
index d5344c60b5..ec43c08ab7 100644
--- a/frappe/tests/test_scheduler.py
+++ b/frappe/tests/test_scheduler.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
from unittest import TestCase
from dateutil.relativedelta import relativedelta
from frappe.core.doctype.scheduled_job_type.scheduled_job_type import sync_jobs
diff --git a/frappe/tests/test_search.py b/frappe/tests/test_search.py
index e39d6c4691..9ad02f49a6 100644
--- a/frappe/tests/test_search.py
+++ b/frappe/tests/test_search.py
@@ -1,7 +1,6 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import unittest
import frappe
from frappe.desk.search import search_link
diff --git a/frappe/tests/test_seen.py b/frappe/tests/test_seen.py
index 8eea30d773..7f4e8719a3 100644
--- a/frappe/tests/test_seen.py
+++ b/frappe/tests/test_seen.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, unittest, json
class TestSeen(unittest.TestCase):
diff --git a/frappe/tests/test_sitemap.py b/frappe/tests/test_sitemap.py
index 22669000c1..e29a453a14 100644
--- a/frappe/tests/test_sitemap.py
+++ b/frappe/tests/test_sitemap.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import frappe, unittest
from frappe.utils import get_html_for_route
diff --git a/frappe/tests/test_translate.py b/frappe/tests/test_translate.py
index c29390c429..f51f31d509 100644
--- a/frappe/tests/test_translate.py
+++ b/frappe/tests/test_translate.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, unittest, os
import frappe.translate
from frappe import _
diff --git a/frappe/tests/test_translation.py b/frappe/tests/test_translation.py
index 0e1e6e452c..94af1bb870 100644
--- a/frappe/tests/test_translation.py
+++ b/frappe/tests/test_translation.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, unittest, os
import frappe.translate
diff --git a/frappe/tests/test_twofactor.py b/frappe/tests/test_twofactor.py
index 709b88b8f3..7de155bc96 100644
--- a/frappe/tests/test_twofactor.py
+++ b/frappe/tests/test_twofactor.py
@@ -1,7 +1,5 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import unittest, frappe, pyotp
from frappe.auth import HTTPRequest
from frappe.utils import cint
diff --git a/frappe/tests/test_utils.py b/frappe/tests/test_utils.py
index 74ceec8287..c2e5d99731 100644
--- a/frappe/tests/test_utils.py
+++ b/frappe/tests/test_utils.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import unittest
import frappe
@@ -56,14 +54,14 @@ class TestMoney(unittest.TestCase):
for num in nums_bhd:
self.assertEqual(
- money_in_words(num[0], "BHD"),
- num[1],
+ money_in_words(num[0], "BHD"),
+ num[1],
"{0} is not the same as {1}".format(money_in_words(num[0], "BHD"), num[1])
)
for num in nums_ngn:
self.assertEqual(
- money_in_words(num[0], "NGN"), num[1],
+ money_in_words(num[0], "NGN"), num[1],
"{0} is not the same as {1}".format(money_in_words(num[0], "NGN"), num[1])
)
@@ -139,7 +137,7 @@ class TestValidationUtils(unittest.TestCase):
# Valid URLs
self.assertTrue(validate_url('https://google.com'))
self.assertTrue(validate_url('http://frappe.io', throw=True))
-
+
# Invalid URLs without throw
self.assertFalse(validate_url('google.io'))
self.assertFalse(validate_url('google.io'))
@@ -152,9 +150,9 @@ class TestValidationUtils(unittest.TestCase):
self.assertTrue(validate_url('ftp://frappe.cloud', valid_schemes=['https', 'ftp']))
self.assertFalse(validate_url('bolo://frappe.io', valid_schemes=("http", "https", "ftp", "ftps")))
self.assertRaises(
- frappe.ValidationError,
- validate_url,
- 'gopher://frappe.io',
+ frappe.ValidationError,
+ validate_url,
+ 'gopher://frappe.io',
valid_schemes='https',
throw=True
)
@@ -167,16 +165,16 @@ class TestValidationUtils(unittest.TestCase):
# Valid addresses
self.assertTrue(validate_email_address('someone@frappe.com'))
self.assertTrue(validate_email_address('someone@frappe.com, anyone@frappe.io'))
-
+
# Invalid address
self.assertFalse(validate_email_address('someone'))
self.assertFalse(validate_email_address('someone@----.com'))
# Invalid with throw
self.assertRaises(
- frappe.InvalidEmailAddressError,
- validate_email_address,
- 'someone.com',
+ frappe.InvalidEmailAddressError,
+ validate_email_address,
+ 'someone.com',
throw=True
)
diff --git a/frappe/tests/test_website.py b/frappe/tests/test_website.py
index dc3862174d..52ddc5ef71 100644
--- a/frappe/tests/test_website.py
+++ b/frappe/tests/test_website.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import unittest
import frappe
diff --git a/frappe/tests/tests_geo_utils.py b/frappe/tests/tests_geo_utils.py
index 2067a6aa97..e928bc0fef 100644
--- a/frappe/tests/tests_geo_utils.py
+++ b/frappe/tests/tests_geo_utils.py
@@ -2,8 +2,6 @@
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
-
import unittest
import frappe
diff --git a/frappe/translate.py b/frappe/translate.py
index b9dd5e263a..f95fdad015 100644
--- a/frappe/translate.py
+++ b/frappe/translate.py
@@ -1,12 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
-
-from six import iteritems, text_type, string_types, PY2
-
-from frappe.utils import cstr
-
"""
frappe.translate
~~~~~~~~~~~~~~~~
@@ -14,10 +7,11 @@ from frappe.utils import cstr
Translation tools for frappe
"""
-import frappe, os, re, io, codecs, json
+import frappe, os, re, io, json
from frappe.model.utils import render_include, InvalidIncludePath
from frappe.utils import strip, strip_html_tags, is_html
import itertools, operator
+from csv import reader
def guess_language(lang_list=None):
"""Set `frappe.local.lang` from HTTP headers at beginning of request"""
@@ -36,8 +30,8 @@ def guess_language(lang_list=None):
for l in lang_codes:
code = l.strip()
- if not isinstance(code, text_type):
- code = text_type(code, 'utf-8')
+ if not isinstance(code, str):
+ code = str(code, 'utf-8')
if code in lang_list or code == "en":
guess = code
break
@@ -127,7 +121,7 @@ def get_dict(fortype, name=None):
message_dict = make_dict_from_messages(messages, load_user_translation=False)
message_dict.update(get_dict_from_hooks(fortype, name))
# remove untranslated
- message_dict = {k:v for k, v in iteritems(message_dict) if k!=v}
+ message_dict = {k: v for k, v in message_dict.items() if k!=v}
translation_assets[asset_key] = message_dict
cache.hset("translation_assets", frappe.local.lang, translation_assets, shared=True)
@@ -389,7 +383,7 @@ def get_messages_from_workflow(doctype=None, app_name=None):
else:
fixtures = frappe.get_hooks('fixtures', app_name=app_name) or []
for fixture in fixtures:
- if isinstance(fixture, string_types) and fixture == 'Worflow':
+ if isinstance(fixture, str) and fixture == 'Worflow':
workflows = frappe.get_all('Workflow')
break
elif isinstance(fixture, dict) and fixture.get('dt', fixture.get('doctype')) == 'Workflow':
@@ -425,7 +419,7 @@ def get_messages_from_custom_fields(app_name):
custom_fields = []
for fixture in fixtures:
- if isinstance(fixture, string_types) and fixture == 'Custom Field':
+ if isinstance(fixture, str) and fixture == 'Custom Field':
custom_fields = frappe.get_all('Custom Field', fields=['name','label', 'description', 'fieldtype', 'options'])
break
elif isinstance(fixture, dict) and fixture.get('dt', fixture.get('doctype')) == 'Custom Field':
@@ -609,20 +603,11 @@ def read_csv_file(path):
"""Read CSV file and return as list of list
:param path: File path"""
- from csv import reader
- if PY2:
- with codecs.open(path, 'r', 'utf-8') as msgfile:
- data = msgfile.read()
+ with io.open(path, mode='r', encoding='utf-8', newline='') as msgfile:
+ data = reader(msgfile)
+ newdata = [[ val for val in row ] for row in data]
- # for japanese! #wtf
- data = data.replace(chr(28), "").replace(chr(29), "")
- data = reader([r.encode('utf-8') for r in data.splitlines()])
- newdata = [[text_type(val, 'utf-8') for val in row] for row in data]
- else:
- with io.open(path, mode='r', encoding='utf-8', newline='') as msgfile:
- data = reader(msgfile)
- newdata = [[ val for val in row ] for row in data]
return newdata
def write_csv_file(path, app_messages, lang_dict):
@@ -812,7 +797,7 @@ def update_translations_for_source(source=None, translation_dict=None):
frappe.delete_doc('Translation', d.name)
# remaining values are to be inserted
- for lang, translated_text in iteritems(translation_dict):
+ for lang, translated_text in translation_dict.items():
doc = frappe.new_doc('Translation')
doc.language = lang
doc.source_text = source
diff --git a/frappe/twofactor.py b/frappe/twofactor.py
index 4e098c3075..c2fb6d5de9 100644
--- a/frappe/twofactor.py
+++ b/frappe/twofactor.py
@@ -1,17 +1,13 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals
-
import frappe
from frappe import _
import pyotp, os
from frappe.utils.background_jobs import enqueue
from pyqrcode import create as qrcreate
-from six import BytesIO
+from io import BytesIO
from base64 import b64encode, b32encode
from frappe.utils import get_url, get_datetime, time_diff_in_seconds, cint
-from six import iteritems, string_types
class ExpiredLoginException(Exception): pass
@@ -78,7 +74,7 @@ def cache_2fa_data(user, token, otp_secret, tmp_id):
frappe.cache().expire(tmp_id + '_token', expiry_time)
else:
expiry_time = frappe.flags.otp_expiry or 180
- for k, v in iteritems({'_usr': user, '_pwd': pwd, '_otp_secret': otp_secret}):
+ for k, v in {'_usr': user, '_pwd': pwd, '_otp_secret': otp_secret}.items():
frappe.cache().set("{0}{1}".format(tmp_id, k), v)
frappe.cache().expire("{0}{1}".format(tmp_id, k), expiry_time)
@@ -87,7 +83,7 @@ def two_factor_is_enabled_for_(user):
if user == "Administrator":
return False
- if isinstance(user, string_types):
+ if isinstance(user, str):
user = frappe.get_doc('User', user)
roles = [frappe.db.escape(d.role) for d in user.roles or []]
@@ -393,7 +389,7 @@ def delete_all_barcodes_for_users():
def should_remove_barcode_image(barcode):
'''Check if it's time to delete barcode image from server. '''
- if isinstance(barcode, string_types):
+ if isinstance(barcode, str):
barcode = frappe.get_doc('File', barcode)
lifespan = frappe.db.get_value('System Settings', 'System Settings', 'lifespan_qrcode_image') or 240
if time_diff_in_seconds(get_datetime(), barcode.creation) > int(lifespan):
diff --git a/frappe/utils/__init__.py b/frappe/utils/__init__.py
index 436dcba028..cb02035299 100644
--- a/frappe/utils/__init__.py
+++ b/frappe/utils/__init__.py
@@ -739,7 +739,7 @@ def get_safe_filters(filters):
try:
filters = json.loads(filters)
- if isinstance(filters, (integer_types, float)):
+ if isinstance(filters, (int, float)):
filters = frappe.as_unicode(filters)
except (TypeError, ValueError):
diff --git a/frappe/utils/background_jobs.py b/frappe/utils/background_jobs.py
index bd1f1154a9..8456835ca7 100755
--- a/frappe/utils/background_jobs.py
+++ b/frappe/utils/background_jobs.py
@@ -1,4 +1,3 @@
-from __future__ import unicode_literals, print_function
import redis
from rq import Connection, Queue, Worker
from rq.logutils import setup_loghandlers
@@ -7,11 +6,9 @@ from collections import defaultdict
import frappe
import os, socket, time
from frappe import _
-from six import string_types
from uuid import uuid4
import frappe.monitor
-# imports - third-party imports
default_timeout = 300
queue_timeout = {
@@ -89,7 +86,7 @@ def execute_job(site, method, event, job_name, kwargs, user=None, is_async=True,
if user:
frappe.set_user(user)
- if isinstance(method, string_types):
+ if isinstance(method, str):
method_name = method
method = frappe.get_attr(method)
else:
@@ -193,7 +190,7 @@ def get_queue_list(queue_list=None):
'''Defines possible queues. Also wraps a given queue in a list after validating.'''
default_queue_list = list(queue_timeout)
if queue_list:
- if isinstance(queue_list, string_types):
+ if isinstance(queue_list, str):
queue_list = [queue_list]
for queue in queue_list:
diff --git a/frappe/utils/bench_helper.py b/frappe/utils/bench_helper.py
index 2fb0bda058..ec08d2a15e 100644
--- a/frappe/utils/bench_helper.py
+++ b/frappe/utils/bench_helper.py
@@ -1,4 +1,3 @@
-from __future__ import unicode_literals, print_function
import click
import frappe
import os
diff --git a/frappe/utils/boilerplate.py b/frappe/utils/boilerplate.py
index d950d9f082..92150b79cf 100755
--- a/frappe/utils/boilerplate.py
+++ b/frappe/utils/boilerplate.py
@@ -1,8 +1,5 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
-
import frappe, os, re, git
from frappe.utils import touch_file, cstr
diff --git a/frappe/utils/bot.py b/frappe/utils/bot.py
index 45e1bd5a4e..572723c056 100644
--- a/frappe/utils/bot.py
+++ b/frappe/utils/bot.py
@@ -1,8 +1,6 @@
# Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe, re, frappe.utils
from frappe.desk.notifications import get_notifications
from frappe import _
diff --git a/frappe/utils/change_log.py b/frappe/utils/change_log.py
index 33801af722..6cb71c6ac5 100644
--- a/frappe/utils/change_log.py
+++ b/frappe/utils/change_log.py
@@ -7,7 +7,6 @@ import subprocess # nosec
import requests
from semantic_version import Version
-from six.moves import range
import frappe
from frappe import _, safe_decode
diff --git a/frappe/utils/connections.py b/frappe/utils/connections.py
index 1f57d8fbae..5640da666c 100644
--- a/frappe/utils/connections.py
+++ b/frappe/utils/connections.py
@@ -1,6 +1,6 @@
import socket
-from six.moves.urllib.parse import urlparse
+from urllib.parse import urlparse
from frappe import get_conf
REDIS_KEYS = ('redis_cache', 'redis_queue', 'redis_socketio')
diff --git a/frappe/utils/csvutils.py b/frappe/utils/csvutils.py
index 00163ade5f..734d68fe8a 100644
--- a/frappe/utils/csvutils.py
+++ b/frappe/utils/csvutils.py
@@ -1,14 +1,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals
import frappe
from frappe import msgprint, _
import json
import csv
-import six
import requests
-from six import StringIO, text_type, string_types
+from io import StringIO
from frappe.utils import encode, cstr, cint, flt, comma_or
def read_csv_content_from_uploaded_file(ignore_encoding=False):
@@ -40,11 +37,11 @@ def read_csv_content_from_attached_file(doc):
def read_csv_content(fcontent, ignore_encoding=False):
rows = []
- if not isinstance(fcontent, text_type):
+ if not isinstance(fcontent, str):
decoded = False
for encoding in ["utf-8", "windows-1250", "windows-1252"]:
try:
- fcontent = text_type(fcontent, encoding)
+ fcontent = str(fcontent, encoding)
decoded = True
break
except UnicodeDecodeError:
@@ -56,10 +53,7 @@ def read_csv_content(fcontent, ignore_encoding=False):
fcontent = fcontent.encode("utf-8")
content = [ ]
for line in fcontent.splitlines(True):
- if six.PY2:
- content.append(line)
- else:
- content.append(frappe.safe_decode(line))
+ content.append(frappe.safe_decode(line))
try:
rows = []
@@ -85,7 +79,7 @@ def read_csv_content(fcontent, ignore_encoding=False):
@frappe.whitelist()
def send_csv_to_client(args):
- if isinstance(args, string_types):
+ if isinstance(args, str):
args = json.loads(args)
args = frappe._dict(args)
@@ -113,8 +107,6 @@ class UnicodeWriter:
self.writer = csv.writer(self.queue, quoting=quoting)
def writerow(self, row):
- if six.PY2:
- row = encode(row, self.encoding)
self.writer.writerow(row)
def getvalue(self):
diff --git a/frappe/utils/dashboard.py b/frappe/utils/dashboard.py
index e386dcd881..ad61486113 100644
--- a/frappe/utils/dashboard.py
+++ b/frappe/utils/dashboard.py
@@ -1,6 +1,5 @@
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from functools import wraps
diff --git a/frappe/utils/data.py b/frappe/utils/data.py
index a9af30ab2c..09b02a918a 100644
--- a/frappe/utils/data.py
+++ b/frappe/utils/data.py
@@ -1,14 +1,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
import operator
import json
import re, datetime, math, time
-from six.moves.urllib.parse import quote, urljoin
-from six import iteritems, text_type, string_types, integer_types
+from urllib.parse import quote, urljoin
from frappe.desk.utils import slug
DATE_FORMAT = "%Y-%m-%d"
@@ -72,7 +69,7 @@ def get_datetime(datetime_str=None):
def to_timedelta(time_str):
from dateutil import parser
- if isinstance(time_str, string_types):
+ if isinstance(time_str, str):
t = parser.parse(time_str)
return datetime.timedelta(hours=t.hour, minutes=t.minute, seconds=t.second, microseconds=t.microsecond)
@@ -91,7 +88,7 @@ def add_to_date(date, years=0, months=0, weeks=0, days=0, hours=0, minutes=0, se
if hours:
as_datetime = True
- if isinstance(date, string_types):
+ if isinstance(date, str):
as_string = True
if " " in date:
as_datetime = True
@@ -274,17 +271,17 @@ def get_time(time_str):
return parser.parse(time_str).time()
def get_datetime_str(datetime_obj):
- if isinstance(datetime_obj, string_types):
+ if isinstance(datetime_obj, str):
datetime_obj = get_datetime(datetime_obj)
return datetime_obj.strftime(DATETIME_FORMAT)
def get_date_str(date_obj):
- if isinstance(date_obj, string_types):
+ if isinstance(date_obj, str):
date_obj = get_datetime(date_obj)
return date_obj.strftime(DATE_FORMAT)
def get_time_str(timedelta_obj):
- if isinstance(timedelta_obj, string_types):
+ if isinstance(timedelta_obj, str):
timedelta_obj = to_timedelta(timedelta_obj)
hours, remainder = divmod(timedelta_obj.seconds, 3600)
@@ -549,7 +546,7 @@ def flt(s, precision=None):
>>> flt("a")
0.0
"""
- if isinstance(s, string_types):
+ if isinstance(s, str):
s = s.replace(',','')
try:
@@ -706,12 +703,12 @@ def encode(obj, encoding="utf-8"):
if isinstance(obj, list):
out = []
for o in obj:
- if isinstance(o, text_type):
+ if isinstance(o, str):
out.append(o.encode(encoding))
else:
out.append(o)
return out
- elif isinstance(obj, text_type):
+ elif isinstance(obj, str):
return obj.encode(encoding)
else:
return obj
@@ -719,10 +716,10 @@ def encode(obj, encoding="utf-8"):
def parse_val(v):
"""Converts to simple datatypes from SQL query results"""
if isinstance(v, (datetime.date, datetime.datetime)):
- v = text_type(v)
+ v = str(v)
elif isinstance(v, datetime.timedelta):
- v = ":".join(text_type(v).split(":")[:2])
- elif isinstance(v, integer_types):
+ v = ":".join(str(v).split(":")[:2])
+ elif isinstance(v, int):
v = int(v)
return v
@@ -743,7 +740,7 @@ def fmt_money(amount, precision=None, currency=None, format=None):
# 40,000.00000 -> 40,000.00
# 40,000.23000 -> 40,000.23
- if isinstance(amount, string_types):
+ if isinstance(amount, str):
amount = flt(amount, precision)
if decimal_str:
@@ -959,7 +956,7 @@ def strip_html(text):
return _striptags_re.sub("", text)
def escape_html(text):
- if not isinstance(text, string_types):
+ if not isinstance(text, str):
return text
html_escape_table = {
@@ -982,7 +979,7 @@ def pretty_date(iso_datetime):
if not iso_datetime: return ''
import math
- if isinstance(iso_datetime, string_types):
+ if isinstance(iso_datetime, str):
iso_datetime = datetime.datetime.strptime(iso_datetime, DATETIME_FORMAT)
now_dt = datetime.datetime.strptime(now(), DATETIME_FORMAT)
dt_diff = now_dt - iso_datetime
@@ -1031,7 +1028,7 @@ def comma_and(some_list ,add_quotes=True):
def comma_sep(some_list, pattern, add_quotes=True):
if isinstance(some_list, (list, tuple)):
# list(some_list) is done to preserve the existing list
- some_list = [text_type(s) for s in list(some_list)]
+ some_list = [str(s) for s in list(some_list)]
if not some_list:
return ""
elif len(some_list) == 1:
@@ -1045,7 +1042,7 @@ def comma_sep(some_list, pattern, add_quotes=True):
def new_line_sep(some_list):
if isinstance(some_list, (list, tuple)):
# list(some_list) is done to preserve the existing list
- some_list = [text_type(s) for s in list(some_list)]
+ some_list = [str(s) for s in list(some_list)]
if not some_list:
return ""
elif len(some_list) == 1:
@@ -1131,7 +1128,7 @@ def get_link_to_report(name, label=None, report_type=None, doctype=None, filters
if filters:
conditions = []
- for k,v in iteritems(filters):
+ for k,v in filters.items():
if isinstance(v, list):
for value in v:
conditions.append(str(k)+'='+'["'+str(value[0]+'"'+','+'"'+str(value[1])+'"]'))
@@ -1187,7 +1184,7 @@ operator_map = {
def evaluate_filters(doc, filters):
'''Returns true if doc matches filters'''
if isinstance(filters, dict):
- for key, value in iteritems(filters):
+ for key, value in filters.items():
f = get_filter(None, {key:value})
if not compare(doc.get(f.fieldname), f.operator, f.value, f.fieldtype):
return False
@@ -1375,7 +1372,7 @@ def strip(val, chars=None):
def to_markdown(html):
from html2text import html2text
- from six.moves import html_parser as HTMLParser
+ from html.parser import HTMLParser
text = None
try:
@@ -1514,7 +1511,7 @@ def get_user_info_for_avatar(user_id):
return user_info
-class UnicodeWithAttrs(text_type):
+class UnicodeWithAttrs(str):
def __init__(self, text):
self.toc_html = text.toc_html
self.metadata = text.metadata
diff --git a/frappe/utils/dateutils.py b/frappe/utils/dateutils.py
index 06b434a512..2c2537da5f 100644
--- a/frappe/utils/dateutils.py
+++ b/frappe/utils/dateutils.py
@@ -1,14 +1,12 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import frappe.defaults
import datetime
from frappe.utils import get_datetime, add_to_date, getdate
from frappe.utils.data import get_first_day, get_first_day_of_week, get_quarter_start, get_year_start,\
get_last_day, get_last_day_of_week, get_quarter_ending, get_year_ending
-from six import string_types
# global values -- used for caching
dateformats = {
@@ -71,7 +69,7 @@ def get_user_date_format():
def datetime_in_user_format(date_time):
if not date_time:
return ""
- if isinstance(date_time, string_types):
+ if isinstance(date_time, str):
date_time = get_datetime(date_time)
from frappe.utils import formatdate
return formatdate(date_time.date()) + " " + date_time.strftime("%H:%M")
diff --git a/frappe/utils/doctor.py b/frappe/utils/doctor.py
index e97f792b88..9dafc4dd21 100644
--- a/frappe/utils/doctor.py
+++ b/frappe/utils/doctor.py
@@ -1,10 +1,8 @@
-from __future__ import unicode_literals, print_function
import frappe.utils
from collections import defaultdict
from rq import Worker, Connection
from frappe.utils.background_jobs import get_redis_conn, get_queue, get_queue_list
from frappe.utils.scheduler import is_scheduler_disabled, is_scheduler_inactive
-from six import iteritems
def get_workers():
@@ -130,7 +128,7 @@ def doctor(site=None):
print("Queue:", queue)
print("Number of Jobs: ", job_count[queue])
print("Methods:")
- for method, count in iteritems(jobs_per_queue[queue]):
+ for method, count in jobs_per_queue[queue].items():
print("{0} : {1}".format(method, count))
print("------------")
diff --git a/frappe/utils/error.py b/frappe/utils/error.py
index 2d8d6491a5..61905b4985 100644
--- a/frappe/utils/error.py
+++ b/frappe/utils/error.py
@@ -2,8 +2,6 @@
# Copyright (c) 2015, Maxwell Morais and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
-
import os
import sys
import traceback
@@ -17,7 +15,7 @@ import pydoc
import cgitb
import datetime
import json
-import six
+
def make_error_snapshot(exception):
if frappe.conf.disable_error_snapshot:
@@ -51,7 +49,7 @@ def get_snapshot(exception, context=10):
"""
etype, evalue, etb = sys.exc_info()
- if isinstance(etype, six.class_types):
+ if isinstance(etype, type):
etype = etype.__name__
# creates a snapshot dict with some basic information
@@ -131,7 +129,7 @@ def get_snapshot(exception, context=10):
# add all local values (of last frame) to the snapshot
for name, value in locals.items():
- s['locals'][name] = value if isinstance(value, six.text_type) else pydoc.text.repr(value)
+ s['locals'][name] = value if isinstance(value, str) else pydoc.text.repr(value)
return s
diff --git a/frappe/utils/file_lock.py b/frappe/utils/file_lock.py
index b85ace7db9..8c65dd32ce 100644
--- a/frappe/utils/file_lock.py
+++ b/frappe/utils/file_lock.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
'''
File based locking utility
'''
diff --git a/frappe/utils/file_manager.py b/frappe/utils/file_manager.py
index 2177e67274..30b0d816bb 100644
--- a/frappe/utils/file_manager.py
+++ b/frappe/utils/file_manager.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import os, base64, re, json
import hashlib
@@ -11,8 +10,7 @@ from frappe.utils import get_hook_method, get_files_path, random_string, encode,
from frappe import _
from frappe import conf
from copy import copy
-from six.moves.urllib.parse import unquote
-from six import text_type, PY2, string_types
+from urllib.parse import unquote
class MaxFileSizeReachedError(frappe.ValidationError):
@@ -123,7 +121,7 @@ def get_uploaded_content():
def save_file(fname, content, dt, dn, folder=None, decode=False, is_private=0, df=None):
if decode:
- if isinstance(content, text_type):
+ if isinstance(content, str):
content = content.encode("utf-8")
if b"," in content:
@@ -207,7 +205,7 @@ def write_file(content, fname, is_private=0):
# create directory (if not exists)
frappe.create_folder(file_path)
# write the file
- if isinstance(content, text_type):
+ if isinstance(content, str):
content = content.encode()
with open(os.path.join(file_path.encode('utf-8'), fname.encode('utf-8')), 'wb+') as f:
f.write(content)
@@ -297,18 +295,14 @@ def get_file(fname):
file_path = get_file_path(fname)
# read the file
- if PY2:
- with open(encode(file_path)) as f:
- content = f.read()
- else:
- with io.open(encode(file_path), mode='rb') as f:
- content = f.read()
- try:
- # for plain text files
- content = content.decode()
- except UnicodeDecodeError:
- # for .png, .jpg, etc
- pass
+ with io.open(encode(file_path), mode='rb') as f:
+ content = f.read()
+ try:
+ # for plain text files
+ content = content.decode()
+ except UnicodeDecodeError:
+ # for .png, .jpg, etc
+ pass
return [file_path.rsplit("/", 1)[-1], content]
@@ -338,7 +332,7 @@ def get_file_path(file_name):
def get_content_hash(content):
- if isinstance(content, text_type):
+ if isinstance(content, str):
content = content.encode()
return hashlib.md5(content).hexdigest()
@@ -397,8 +391,8 @@ def extract_images_from_html(doc, content):
filename = headers.split("filename=")[-1]
# decode filename
- if not isinstance(filename, text_type):
- filename = text_type(filename, 'utf-8')
+ if not isinstance(filename, str):
+ filename = str(filename, 'utf-8')
else:
mtype = headers.split(";")[0]
filename = get_random_filename(content_type=mtype)
@@ -443,12 +437,12 @@ def validate_filename(filename):
@frappe.whitelist()
def add_attachments(doctype, name, attachments):
'''Add attachments to the given DocType'''
- if isinstance(attachments, string_types):
+ if isinstance(attachments, str):
attachments = json.loads(attachments)
# loop through attachments
files =[]
for a in attachments:
- if isinstance(a, string_types):
+ if isinstance(a, str):
attach = frappe.db.get_value("File", {"name":a}, ["file_name", "file_url", "is_private"], as_dict=1)
# save attachments to new doc
f = save_url(attach.file_url, attach.file_name, doctype, name, "Home/Attachments", attach.is_private)
diff --git a/frappe/utils/formatters.py b/frappe/utils/formatters.py
index 7913413878..9efccc15f0 100644
--- a/frappe/utils/formatters.py
+++ b/frappe/utils/formatters.py
@@ -1,18 +1,16 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import datetime
from frappe.utils import formatdate, fmt_money, flt, cstr, cint, format_datetime, format_time, format_duration
from frappe.model.meta import get_field_currency, get_field_precision
import re
-from six import string_types
def format_value(value, df=None, doc=None, currency=None, translated=False):
'''Format value based on given fieldtype, document reference, currency reference.
If docfield info (df) is not given, it will try and guess based on the datatype of the value'''
- if isinstance(df, string_types):
+ if isinstance(df, str):
df = frappe._dict(fieldtype=df)
if not df:
diff --git a/frappe/utils/global_search.py b/frappe/utils/global_search.py
index c20f3b29d4..3cf10cd9e0 100644
--- a/frappe/utils/global_search.py
+++ b/frappe/utils/global_search.py
@@ -1,8 +1,6 @@
# 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
import re
import redis
@@ -11,7 +9,6 @@ import os
from frappe.utils import cint, strip_html_tags
from frappe.utils.html_utils import unescape_html
from frappe.model.base_document import get_controller
-from six import text_type
def setup_global_search_table():
"""
@@ -348,9 +345,9 @@ def get_formatted_value(value, field):
if getattr(field, 'fieldtype', None) in ["Text", "Text Editor"]:
value = unescape_html(frappe.safe_decode(value))
- value = (re.subn(r'(?s)<[\s]*(script|style).*?\1>', '', text_type(value))[0])
+ value = (re.subn(r'(?s)<[\s]*(script|style).*?\1>', '', str(value))[0])
value = ' '.join(value.split())
- return field.label + " : " + strip_html_tags(text_type(value))
+ return field.label + " : " + strip_html_tags(str(value))
def sync_global_search():
diff --git a/frappe/utils/goal.py b/frappe/utils/goal.py
index 4c63eb9fc4..195c962aab 100644
--- a/frappe/utils/goal.py
+++ b/frappe/utils/goal.py
@@ -1,7 +1,6 @@
# 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 import _
diff --git a/frappe/utils/html_utils.py b/frappe/utils/html_utils.py
index f3f86dcad2..24def07c63 100644
--- a/frappe/utils/html_utils.py
+++ b/frappe/utils/html_utils.py
@@ -1,14 +1,13 @@
-from __future__ import unicode_literals
+
import frappe
import json
import re
import bleach_whitelist.bleach_whitelist as bleach_whitelist
-from six import string_types
def clean_html(html):
import bleach
- if not isinstance(html, string_types):
+ if not isinstance(html, str):
return html
return bleach.clean(clean_script_and_style(html),
@@ -21,7 +20,7 @@ def clean_html(html):
def clean_email_html(html):
import bleach
- if not isinstance(html, string_types):
+ if not isinstance(html, str):
return html
return bleach.clean(clean_script_and_style(html),
@@ -60,7 +59,7 @@ def sanitize_html(html, linkify=False):
import bleach
from bs4 import BeautifulSoup
- if not isinstance(html, string_types):
+ if not isinstance(html, str):
return html
elif is_json(html):
diff --git a/frappe/utils/identicon.py b/frappe/utils/identicon.py
index 328fb03836..e570875b4a 100644
--- a/frappe/utils/identicon.py
+++ b/frappe/utils/identicon.py
@@ -1,9 +1,9 @@
-from __future__ import unicode_literals
+
from PIL import Image, ImageDraw
from hashlib import md5
import base64
import random
-from six import StringIO
+from io import StringIO
GRID_SIZE = 5
BORDER_SIZE = 20
diff --git a/frappe/utils/image.py b/frappe/utils/image.py
index 60595464a1..b6f4c67c44 100644
--- a/frappe/utils/image.py
+++ b/frappe/utils/image.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
import os
def resize_images(path, maxdim=700):
@@ -24,7 +22,7 @@ def strip_exif_data(content, content_type):
Works by creating a new Image object which ignores exif by
default and then extracts the binary data back into content.
- Returns:
+ Returns:
Bytes: Stripped image content
"""
@@ -33,11 +31,11 @@ def strip_exif_data(content, content_type):
original_image = Image.open(io.BytesIO(content))
output = io.BytesIO()
-
+
new_image = Image.new(original_image.mode, original_image.size)
new_image.putdata(list(original_image.getdata()))
new_image.save(output, format=content_type.split('/')[1])
-
+
content = output.getvalue()
return content
\ No newline at end of file
diff --git a/frappe/utils/install.py b/frappe/utils/install.py
index 93f46a2a16..91d8f04eb4 100644
--- a/frappe/utils/install.py
+++ b/frappe/utils/install.py
@@ -1,8 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
-
import frappe
import getpass
from frappe.utils.password import update_password
diff --git a/frappe/utils/jinja.py b/frappe/utils/jinja.py
index a77eca4977..685208e71f 100644
--- a/frappe/utils/jinja.py
+++ b/frappe/utils/jinja.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
def get_jenv():
import frappe
from frappe.utils.safe_exec import get_safe_globals
diff --git a/frappe/utils/jinja_globals.py b/frappe/utils/jinja_globals.py
index 347d52dc57..e24dff05f1 100644
--- a/frappe/utils/jinja_globals.py
+++ b/frappe/utils/jinja_globals.py
@@ -1,7 +1,6 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
from frappe.utils.jinja import get_jenv
diff --git a/frappe/utils/logger.py b/frappe/utils/logger.py
index 364ffa776d..617572deb7 100755
--- a/frappe/utils/logger.py
+++ b/frappe/utils/logger.py
@@ -1,13 +1,9 @@
-# imports - compatibility imports
-from __future__ import unicode_literals
-
# imports - standard imports
import logging
import os
from logging.handlers import RotatingFileHandler
# imports - third party imports
-from six import text_type
# imports - module imports
import frappe
@@ -83,10 +79,10 @@ class SiteContextFilter(logging.Filter):
"""This is a filter which injects request information (if available) into the log."""
def filter(self, record):
- if "Form Dict" not in text_type(record.msg):
+ if "Form Dict" not in str(record.msg):
site = getattr(frappe.local, "site", None)
form_dict = getattr(frappe.local, "form_dict", None)
- record.msg = text_type(record.msg) + "\nSite: {0}\nForm Dict: {1}".format(site, form_dict)
+ record.msg = str(record.msg) + "\nSite: {0}\nForm Dict: {1}".format(site, form_dict)
return True
diff --git a/frappe/utils/make_random.py b/frappe/utils/make_random.py
index ad353dea84..2ebabb78f9 100644
--- a/frappe/utils/make_random.py
+++ b/frappe/utils/make_random.py
@@ -1,7 +1,5 @@
-from __future__ import unicode_literals
+
import frappe, random
-from six.moves import range
-from six import string_types
settings = frappe._dict(
prob = {
@@ -17,7 +15,7 @@ def add_random_children(doc, fieldname, rows, randomize, unique=None):
for i in range(nrows):
d = {}
for key, val in randomize.items():
- if isinstance(val[0], string_types):
+ if isinstance(val[0], str):
d[key] = get_random(*val)
else:
d[key] = random.randrange(*val)
diff --git a/frappe/utils/minify.py b/frappe/utils/minify.py
index 08d05c7225..b2cc93e554 100644
--- a/frappe/utils/minify.py
+++ b/frappe/utils/minify.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
# This code is original from jsmin by Douglas Crockford, it was translated to
# Python by Baruch Even. The original code had the following copyright and
# license.
@@ -29,7 +29,7 @@ from __future__ import unicode_literals
# SOFTWARE.
# */
-from six import StringIO
+from io import StringIO
def jsmin(js):
ins = StringIO(js)
diff --git a/frappe/utils/momentjs.py b/frappe/utils/momentjs.py
index 3c5ec91f63..18df9903a7 100644
--- a/frappe/utils/momentjs.py
+++ b/frappe/utils/momentjs.py
@@ -1,5 +1,4 @@
# get data for moment.js
-from __future__ import unicode_literals
def update(tz, out):
ltz = data["links"].get(tz, tz)
zone = data["zones"].get(ltz)
diff --git a/frappe/utils/nestedset.py b/frappe/utils/nestedset.py
index 531699db0c..3c024c40e4 100644
--- a/frappe/utils/nestedset.py
+++ b/frappe/utils/nestedset.py
@@ -10,8 +10,6 @@
# 3. call update_nsm(doc_obj) in the on_upate method
# ------------------------------------------
-from __future__ import unicode_literals
-
import frappe
from frappe import _
from frappe.model.document import Document
diff --git a/frappe/utils/oauth.py b/frappe/utils/oauth.py
index 6a92737a0d..45cce737e1 100644
--- a/frappe/utils/oauth.py
+++ b/frappe/utils/oauth.py
@@ -1,14 +1,12 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import frappe.utils
import json, jwt
import base64
from frappe import _
from frappe.utils.password import get_decrypted_password
-from six import string_types
class SignupDisabledError(frappe.PermissionError): pass
@@ -163,10 +161,10 @@ def login_oauth_user(data=None, provider=None, state=None, email_id=None, key=No
# return
# json.loads data and state
- if isinstance(data, string_types):
+ if isinstance(data, str):
data = json.loads(data)
- if isinstance(state, string_types):
+ if isinstance(state, str):
state = base64.b64decode(state)
state = json.loads(state.decode("utf-8"))
diff --git a/frappe/utils/password.py b/frappe/utils/password.py
index fbed3cd8e7..005a3cede6 100644
--- a/frappe/utils/password.py
+++ b/frappe/utils/password.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import string
import frappe
from frappe import _
diff --git a/frappe/utils/password_strength.py b/frappe/utils/password_strength.py
index a4182d1cab..3959d8c3dd 100644
--- a/frappe/utils/password_strength.py
+++ b/frappe/utils/password_strength.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
try:
from zxcvbn import zxcvbn
except Exception:
diff --git a/frappe/utils/pdf.py b/frappe/utils/pdf.py
index 70464aafc5..92459abc46 100644
--- a/frappe/utils/pdf.py
+++ b/frappe/utils/pdf.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import io
import os
import re
@@ -9,7 +7,6 @@ from distutils.version import LooseVersion
import subprocess
import pdfkit
-import six
from bs4 import BeautifulSoup
from PyPDF2 import PdfFileReader, PdfFileWriter
@@ -57,8 +54,6 @@ def get_pdf(html, options=None, output=None):
if "password" in options:
password = options["password"]
- if six.PY2:
- password = frappe.safe_encode(password)
if output:
output.appendPagesFromReader(reader)
diff --git a/frappe/utils/print_format.py b/frappe/utils/print_format.py
index e83a5f6c71..6cf2ecc304 100644
--- a/frappe/utils/print_format.py
+++ b/frappe/utils/print_format.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import frappe, os
from frappe import _
diff --git a/frappe/utils/redis_wrapper.py b/frappe/utils/redis_wrapper.py
index 678a61ca6e..41aa4e7ad1 100644
--- a/frappe/utils/redis_wrapper.py
+++ b/frappe/utils/redis_wrapper.py
@@ -1,11 +1,7 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
-import redis, frappe, re
-from six.moves import cPickle as pickle
+import redis, frappe, re, pickle
from frappe.utils import cstr
-from six import iteritems
class RedisWrapper(redis.Redis):
@@ -165,8 +161,10 @@ class RedisWrapper(redis.Redis):
pass
def hgetall(self, name):
- return {key: pickle.loads(value) for key, value in
- iteritems(super(RedisWrapper, self).hgetall(self.make_key(name)))}
+ value = super(RedisWrapper, self).hgetall(self.make_key(name))
+ return {
+ key: pickle.loads(value) for key, value in value.items()
+ }
def hget(self, name, key, generator=None, shared=False):
_name = self.make_key(name, shared=shared)
diff --git a/frappe/utils/reset_doc.py b/frappe/utils/reset_doc.py
index 2119df5897..15aff4dc6c 100755
--- a/frappe/utils/reset_doc.py
+++ b/frappe/utils/reset_doc.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
import json, os
from frappe.modules import scrub, get_module_path, utils
@@ -7,7 +7,7 @@ from frappe.custom.doctype.property_setter.property_setter import make_property_
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
from frappe.core.page.permission_manager.permission_manager import get_standard_permissions
from frappe.permissions import setup_custom_perms
-from six.moves.urllib.request import urlopen
+from urllib.request import urlopen
branch = 'develop'
diff --git a/frappe/utils/response.py b/frappe/utils/response.py
index b152d69d8d..84f30f22fd 100644
--- a/frappe/utils/response.py
+++ b/frappe/utils/response.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import json
import datetime
import decimal
@@ -18,8 +17,7 @@ from werkzeug.wsgi import wrap_file
from werkzeug.wrappers import Response
from werkzeug.exceptions import NotFound, Forbidden
from frappe.utils import cint
-from six import text_type
-from six.moves.urllib.parse import quote
+from urllib.parse import quote
from frappe.core.doctype.access_log.access_log import make_access_log
@@ -125,13 +123,13 @@ def json_handler(obj):
import collections.abc
if isinstance(obj, (datetime.date, datetime.timedelta, datetime.datetime)):
- return text_type(obj)
+ return str(obj)
elif isinstance(obj, decimal.Decimal):
return float(obj)
elif isinstance(obj, LocalProxy):
- return text_type(obj)
+ return str(obj)
elif isinstance(obj, frappe.model.document.BaseDocument):
doc = obj.as_dict(no_nulls=True)
diff --git a/frappe/utils/scheduler.py b/frappe/utils/scheduler.py
index 749a41682f..0bfc50eab5 100755
--- a/frappe/utils/scheduler.py
+++ b/frappe/utils/scheduler.py
@@ -7,8 +7,6 @@ Events:
monthly
weekly
"""
-# imports - compatibility imports
-from __future__ import print_function, unicode_literals
# imports - standard imports
import os
diff --git a/frappe/utils/testutils.py b/frappe/utils/testutils.py
index 4af3ad647c..c451d090f1 100644
--- a/frappe/utils/testutils.py
+++ b/frappe/utils/testutils.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
def add_custom_field(doctype, fieldname, fieldtype='Data', options=None):
diff --git a/frappe/utils/user.py b/frappe/utils/user.py
index 61b698db9f..fe768c28c5 100755
--- a/frappe/utils/user.py
+++ b/frappe/utils/user.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, json
from frappe import _dict
import frappe.share
diff --git a/frappe/utils/verified_command.py b/frappe/utils/verified_command.py
index 971c0a243c..4b038b88c3 100644
--- a/frappe/utils/verified_command.py
+++ b/frappe/utils/verified_command.py
@@ -1,20 +1,17 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals
import hmac, hashlib
-from six.moves.urllib.parse import urlencode
+from urllib.parse import urlencode
from frappe import _
import frappe
import frappe.utils
-from six import string_types
def get_signed_params(params):
"""Sign a url by appending `&_signature=xxxxx` to given params (string or dict).
:param params: String or dict of parameters."""
- if not isinstance(params, string_types):
+ if not isinstance(params, str):
params = urlencode(params)
signature = hmac.new(params.encode(), digestmod=hashlib.md5)
diff --git a/frappe/website/context.py b/frappe/website/context.py
index c898d39869..8278edb958 100644
--- a/frappe/website/context.py
+++ b/frappe/website/context.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe, os, json
from frappe.website.doctype.website_settings.website_settings import get_website_settings
diff --git a/frappe/website/doctype/__init__.py b/frappe/website/doctype/__init__.py
index baffc48825..8b13789179 100644
--- a/frappe/website/doctype/__init__.py
+++ b/frappe/website/doctype/__init__.py
@@ -1 +1 @@
-from __future__ import unicode_literals
+
diff --git a/frappe/website/doctype/about_us_settings/about_us_settings.py b/frappe/website/doctype/about_us_settings/about_us_settings.py
index 5b93cdcede..938a8de1b9 100644
--- a/frappe/website/doctype/about_us_settings/about_us_settings.py
+++ b/frappe/website/doctype/about_us_settings/about_us_settings.py
@@ -3,17 +3,16 @@
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class AboutUsSettings(Document):
-
+
def on_update(self):
from frappe.website.render import clear_cache
clear_cache("about")
-
+
def get_args():
obj = frappe.get_doc("About Us Settings")
return {
diff --git a/frappe/website/doctype/about_us_settings/test_about_us_settings.py b/frappe/website/doctype/about_us_settings/test_about_us_settings.py
index 85173a20e5..ab47505fb1 100644
--- a/frappe/website/doctype/about_us_settings/test_about_us_settings.py
+++ b/frappe/website/doctype/about_us_settings/test_about_us_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/website/doctype/about_us_team_member/about_us_team_member.py b/frappe/website/doctype/about_us_team_member/about_us_team_member.py
index a872a6e5e2..864b6a3e81 100644
--- a/frappe/website/doctype/about_us_team_member/about_us_team_member.py
+++ b/frappe/website/doctype/about_us_team_member/about_us_team_member.py
@@ -3,7 +3,6 @@
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/website/doctype/blog_category/blog_category.py b/frappe/website/doctype/blog_category/blog_category.py
index 375ba5b6a3..91b213744f 100644
--- a/frappe/website/doctype/blog_category/blog_category.py
+++ b/frappe/website/doctype/blog_category/blog_category.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
from frappe.website.website_generator import WebsiteGenerator
from frappe.website.render import clear_cache
diff --git a/frappe/website/doctype/blog_category/test_blog_category.py b/frappe/website/doctype/blog_category/test_blog_category.py
index fe8f4544cd..d9093e76f0 100644
--- a/frappe/website/doctype/blog_category/test_blog_category.py
+++ b/frappe/website/doctype/blog_category/test_blog_category.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/website/doctype/blog_post/blog_post.py b/frappe/website/doctype/blog_post/blog_post.py
index bfccc0bbc7..b39b7c7d04 100644
--- a/frappe/website/doctype/blog_post/blog_post.py
+++ b/frappe/website/doctype/blog_post/blog_post.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
from frappe import _
from frappe.website.website_generator import WebsiteGenerator
diff --git a/frappe/website/doctype/blog_post/test_blog_post.py b/frappe/website/doctype/blog_post/test_blog_post.py
index 9ecac07ee5..99acf2b710 100644
--- a/frappe/website/doctype/blog_post/test_blog_post.py
+++ b/frappe/website/doctype/blog_post/test_blog_post.py
@@ -1,6 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import unittest
from bs4 import BeautifulSoup
diff --git a/frappe/website/doctype/blog_settings/blog_settings.py b/frappe/website/doctype/blog_settings/blog_settings.py
index 0ed98b9b87..01e18931a3 100644
--- a/frappe/website/doctype/blog_settings/blog_settings.py
+++ b/frappe/website/doctype/blog_settings/blog_settings.py
@@ -3,13 +3,12 @@
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class BlogSettings(Document):
-
+
def on_update(self):
from frappe.website.render import clear_cache
clear_cache("blog")
diff --git a/frappe/website/doctype/blog_settings/test_blog_settings.py b/frappe/website/doctype/blog_settings/test_blog_settings.py
index e4ddb85c4b..6b03ab88d9 100644
--- a/frappe/website/doctype/blog_settings/test_blog_settings.py
+++ b/frappe/website/doctype/blog_settings/test_blog_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/website/doctype/blogger/blogger.py b/frappe/website/doctype/blogger/blogger.py
index cbba6a98a5..77e7a6e7a1 100644
--- a/frappe/website/doctype/blogger/blogger.py
+++ b/frappe/website/doctype/blogger/blogger.py
@@ -3,7 +3,6 @@
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
diff --git a/frappe/website/doctype/blogger/test_blogger.py b/frappe/website/doctype/blogger/test_blogger.py
index 77ade561fb..f121859cbb 100644
--- a/frappe/website/doctype/blogger/test_blogger.py
+++ b/frappe/website/doctype/blogger/test_blogger.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
test_records = frappe.get_test_records('Blogger')
\ No newline at end of file
diff --git a/frappe/website/doctype/color/color.py b/frappe/website/doctype/color/color.py
index 245b9e9165..080e51e406 100644
--- a/frappe/website/doctype/color/color.py
+++ b/frappe/website/doctype/color/color.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/website/doctype/color/test_color.py b/frappe/website/doctype/color/test_color.py
index 2f2be331ad..99e4310a1c 100644
--- a/frappe/website/doctype/color/test_color.py
+++ b/frappe/website/doctype/color/test_color.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/website/doctype/company_history/company_history.py b/frappe/website/doctype/company_history/company_history.py
index 2c3c81a898..128aefe636 100644
--- a/frappe/website/doctype/company_history/company_history.py
+++ b/frappe/website/doctype/company_history/company_history.py
@@ -3,7 +3,6 @@
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/website/doctype/contact_us_settings/contact_us_settings.py b/frappe/website/doctype/contact_us_settings/contact_us_settings.py
index 24e9811a47..12e62f8403 100644
--- a/frappe/website/doctype/contact_us_settings/contact_us_settings.py
+++ b/frappe/website/doctype/contact_us_settings/contact_us_settings.py
@@ -3,7 +3,6 @@
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/website/doctype/help_article/help_article.py b/frappe/website/doctype/help_article/help_article.py
index fa26cfef99..139fced70a 100644
--- a/frappe/website/doctype/help_article/help_article.py
+++ b/frappe/website/doctype/help_article/help_article.py
@@ -1,7 +1,6 @@
# Copyright (c) 2013, Frappe and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.website.website_generator import WebsiteGenerator
from frappe.utils import is_markdown, markdown, cint
diff --git a/frappe/website/doctype/help_article/test_help_article.py b/frappe/website/doctype/help_article/test_help_article.py
index e20a3a20e3..a1a0a59a24 100644
--- a/frappe/website/doctype/help_article/test_help_article.py
+++ b/frappe/website/doctype/help_article/test_help_article.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/website/doctype/help_category/help_category.py b/frappe/website/doctype/help_category/help_category.py
index 59df82b90c..912c1f568e 100644
--- a/frappe/website/doctype/help_category/help_category.py
+++ b/frappe/website/doctype/help_category/help_category.py
@@ -1,7 +1,6 @@
# Copyright (c) 2013, Frappe and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.website.website_generator import WebsiteGenerator
from frappe.website.doctype.help_article.help_article import clear_cache
diff --git a/frappe/website/doctype/help_category/test_help_category.py b/frappe/website/doctype/help_category/test_help_category.py
index 9954e7424e..68fcbd2872 100644
--- a/frappe/website/doctype/help_category/test_help_category.py
+++ b/frappe/website/doctype/help_category/test_help_category.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/website/doctype/personal_data_deletion_request/test_personal_data_deletion_request.py b/frappe/website/doctype/personal_data_deletion_request/test_personal_data_deletion_request.py
index 1bc90daf1c..606e5aad34 100644
--- a/frappe/website/doctype/personal_data_deletion_request/test_personal_data_deletion_request.py
+++ b/frappe/website/doctype/personal_data_deletion_request/test_personal_data_deletion_request.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
from frappe.website.doctype.personal_data_deletion_request.personal_data_deletion_request import (
diff --git a/frappe/website/doctype/personal_data_deletion_step/personal_data_deletion_step.py b/frappe/website/doctype/personal_data_deletion_step/personal_data_deletion_step.py
index 2a7451473d..7cd1277f6c 100644
--- a/frappe/website/doctype/personal_data_deletion_step/personal_data_deletion_step.py
+++ b/frappe/website/doctype/personal_data_deletion_step/personal_data_deletion_step.py
@@ -2,7 +2,6 @@
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/website/doctype/personal_data_download_request/personal_data_download_request.py b/frappe/website/doctype/personal_data_download_request/personal_data_download_request.py
index 46faeb8539..9255adb8c2 100644
--- a/frappe/website/doctype/personal_data_download_request/personal_data_download_request.py
+++ b/frappe/website/doctype/personal_data_download_request/personal_data_download_request.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
import json
from frappe import _
diff --git a/frappe/website/doctype/personal_data_download_request/test_personal_data_download_request.py b/frappe/website/doctype/personal_data_download_request/test_personal_data_download_request.py
index 6eb381e7ce..563b6b3843 100644
--- a/frappe/website/doctype/personal_data_download_request/test_personal_data_download_request.py
+++ b/frappe/website/doctype/personal_data_download_request/test_personal_data_download_request.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
import json
diff --git a/frappe/website/doctype/portal_menu_item/portal_menu_item.py b/frappe/website/doctype/portal_menu_item/portal_menu_item.py
index 5fe8e9fcd7..5effb3a195 100644
--- a/frappe/website/doctype/portal_menu_item/portal_menu_item.py
+++ b/frappe/website/doctype/portal_menu_item/portal_menu_item.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/website/doctype/portal_settings/portal_settings.py b/frappe/website/doctype/portal_settings/portal_settings.py
index 1bfbc70d60..589656bbf0 100644
--- a/frappe/website/doctype/portal_settings/portal_settings.py
+++ b/frappe/website/doctype/portal_settings/portal_settings.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/website/doctype/portal_settings/test_portal_settings.py b/frappe/website/doctype/portal_settings/test_portal_settings.py
index 3dd4aa0c35..40f6eaac2c 100644
--- a/frappe/website/doctype/portal_settings/test_portal_settings.py
+++ b/frappe/website/doctype/portal_settings/test_portal_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/website/doctype/social_link_settings/social_link_settings.py b/frappe/website/doctype/social_link_settings/social_link_settings.py
index b382afac99..093a21ea10 100644
--- a/frappe/website/doctype/social_link_settings/social_link_settings.py
+++ b/frappe/website/doctype/social_link_settings/social_link_settings.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/website/doctype/top_bar_item/__init__.py b/frappe/website/doctype/top_bar_item/__init__.py
index baffc48825..8b13789179 100644
--- a/frappe/website/doctype/top_bar_item/__init__.py
+++ b/frappe/website/doctype/top_bar_item/__init__.py
@@ -1 +1 @@
-from __future__ import unicode_literals
+
diff --git a/frappe/website/doctype/top_bar_item/top_bar_item.py b/frappe/website/doctype/top_bar_item/top_bar_item.py
index 6cda8e2beb..14e579dae2 100644
--- a/frappe/website/doctype/top_bar_item/top_bar_item.py
+++ b/frappe/website/doctype/top_bar_item/top_bar_item.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/website/doctype/web_form/test_web_form.py b/frappe/website/doctype/web_form/test_web_form.py
index 78f7fd6337..5ea18ed7cc 100644
--- a/frappe/website/doctype/web_form/test_web_form.py
+++ b/frappe/website/doctype/web_form/test_web_form.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest, json
diff --git a/frappe/website/doctype/web_form/web_form.py b/frappe/website/doctype/web_form/web_form.py
index f78aaac934..213c2a84dd 100644
--- a/frappe/website/doctype/web_form/web_form.py
+++ b/frappe/website/doctype/web_form/web_form.py
@@ -1,14 +1,8 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
-
import json
import os
-
-from six import iteritems
-from six.moves.urllib.parse import urlencode
-
import frappe
from frappe import _, scrub
from frappe.core.doctype.file.file import get_max_file_size, remove_file_by_url
@@ -109,9 +103,7 @@ class WebForm(WebsiteGenerator):
# py
if not os.path.exists(path + '.py'):
with open(path + '.py', 'w') as f:
- f.write("""from __future__ import unicode_literals
-
-import frappe
+ f.write("""import frappe
def get_context(context):
# do your magic here
@@ -219,7 +211,7 @@ def get_context(context):
from decimal import Decimal
if amount is None or Decimal(amount) <= 0:
return frappe.utils.get_url(self.success_url or self.route)
-
+
payment_details = {
"amount": amount,
"title": title,
diff --git a/frappe/website/doctype/web_form_field/web_form_field.py b/frappe/website/doctype/web_form_field/web_form_field.py
index ec3c3fbea4..44005d27e3 100644
--- a/frappe/website/doctype/web_form_field/web_form_field.py
+++ b/frappe/website/doctype/web_form_field/web_form_field.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/website/doctype/web_page/__init__.py b/frappe/website/doctype/web_page/__init__.py
index baffc48825..8b13789179 100644
--- a/frappe/website/doctype/web_page/__init__.py
+++ b/frappe/website/doctype/web_page/__init__.py
@@ -1 +1 @@
-from __future__ import unicode_literals
+
diff --git a/frappe/website/doctype/web_page/test_web_page.py b/frappe/website/doctype/web_page/test_web_page.py
index 7a2ddc6961..5dc2c9ff45 100644
--- a/frappe/website/doctype/web_page/test_web_page.py
+++ b/frappe/website/doctype/web_page/test_web_page.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import unittest
import frappe
from frappe.website.router import resolve_route
diff --git a/frappe/website/doctype/web_page/web_page.py b/frappe/website/doctype/web_page/web_page.py
index cce00564ff..cea14d3bbe 100644
--- a/frappe/website/doctype/web_page/web_page.py
+++ b/frappe/website/doctype/web_page/web_page.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import print_function, unicode_literals
-
import re
import requests
diff --git a/frappe/website/doctype/web_page_block/web_page_block.py b/frappe/website/doctype/web_page_block/web_page_block.py
index 7561e55aa9..77e7dec155 100644
--- a/frappe/website/doctype/web_page_block/web_page_block.py
+++ b/frappe/website/doctype/web_page_block/web_page_block.py
@@ -2,8 +2,6 @@
# 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
diff --git a/frappe/website/doctype/web_page_view/test_web_page_view.py b/frappe/website/doctype/web_page_view/test_web_page_view.py
index d51727ec68..c3d05fcaab 100644
--- a/frappe/website/doctype/web_page_view/test_web_page_view.py
+++ b/frappe/website/doctype/web_page_view/test_web_page_view.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/website/doctype/web_page_view/web_page_view.py b/frappe/website/doctype/web_page_view/web_page_view.py
index d9794c6d99..e679b58043 100644
--- a/frappe/website/doctype/web_page_view/web_page_view.py
+++ b/frappe/website/doctype/web_page_view/web_page_view.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/website/doctype/web_template/test_web_template.py b/frappe/website/doctype/web_template/test_web_template.py
index b4ea9e2f97..45e35c4626 100644
--- a/frappe/website/doctype/web_template/test_web_template.py
+++ b/frappe/website/doctype/web_template/test_web_template.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
from bs4 import BeautifulSoup
diff --git a/frappe/website/doctype/web_template/web_template.py b/frappe/website/doctype/web_template/web_template.py
index 2fd5bfa179..891a0c3679 100644
--- a/frappe/website/doctype/web_template/web_template.py
+++ b/frappe/website/doctype/web_template/web_template.py
@@ -2,8 +2,6 @@
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
-
import os
from shutil import rmtree
diff --git a/frappe/website/doctype/web_template_field/test_web_template_field.py b/frappe/website/doctype/web_template_field/test_web_template_field.py
index 40f5d7a1cc..5628da37db 100644
--- a/frappe/website/doctype/web_template_field/test_web_template_field.py
+++ b/frappe/website/doctype/web_template_field/test_web_template_field.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/website/doctype/web_template_field/web_template_field.py b/frappe/website/doctype/web_template_field/web_template_field.py
index 8c25b619b6..8270ac7845 100644
--- a/frappe/website/doctype/web_template_field/web_template_field.py
+++ b/frappe/website/doctype/web_template_field/web_template_field.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/website/doctype/website_meta_tag/website_meta_tag.py b/frappe/website/doctype/website_meta_tag/website_meta_tag.py
index 2972e6d317..0856440663 100644
--- a/frappe/website/doctype/website_meta_tag/website_meta_tag.py
+++ b/frappe/website/doctype/website_meta_tag/website_meta_tag.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/website/doctype/website_route_meta/test_website_route_meta.py b/frappe/website/doctype/website_route_meta/test_website_route_meta.py
index 0ccedb0ca4..1f927abafc 100644
--- a/frappe/website/doctype/website_route_meta/test_website_route_meta.py
+++ b/frappe/website/doctype/website_route_meta/test_website_route_meta.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
from frappe.utils import set_request
diff --git a/frappe/website/doctype/website_route_meta/website_route_meta.py b/frappe/website/doctype/website_route_meta/website_route_meta.py
index f31784e9bc..78d440a1a1 100644
--- a/frappe/website/doctype/website_route_meta/website_route_meta.py
+++ b/frappe/website/doctype/website_route_meta/website_route_meta.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
class WebsiteRouteMeta(Document):
diff --git a/frappe/website/doctype/website_route_redirect/website_route_redirect.py b/frappe/website/doctype/website_route_redirect/website_route_redirect.py
index 7255008dd0..f721ab81cb 100644
--- a/frappe/website/doctype/website_route_redirect/website_route_redirect.py
+++ b/frappe/website/doctype/website_route_redirect/website_route_redirect.py
@@ -2,7 +2,6 @@
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
diff --git a/frappe/website/doctype/website_script/website_script.py b/frappe/website/doctype/website_script/website_script.py
index 5648c27fd6..111beeaf2a 100644
--- a/frappe/website/doctype/website_script/website_script.py
+++ b/frappe/website/doctype/website_script/website_script.py
@@ -3,7 +3,6 @@
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/website/doctype/website_settings/__init__.py b/frappe/website/doctype/website_settings/__init__.py
index baffc48825..8b13789179 100644
--- a/frappe/website/doctype/website_settings/__init__.py
+++ b/frappe/website/doctype/website_settings/__init__.py
@@ -1 +1 @@
-from __future__ import unicode_literals
+
diff --git a/frappe/website/doctype/website_settings/test_website_settings.py b/frappe/website/doctype/website_settings/test_website_settings.py
index 9eca957713..f7bf9d3bf1 100644
--- a/frappe/website/doctype/website_settings/test_website_settings.py
+++ b/frappe/website/doctype/website_settings/test_website_settings.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
# import frappe
import unittest
diff --git a/frappe/website/doctype/website_settings/website_settings.py b/frappe/website/doctype/website_settings/website_settings.py
index f7f22aa2df..03a1aecc5f 100644
--- a/frappe/website/doctype/website_settings/website_settings.py
+++ b/frappe/website/doctype/website_settings/website_settings.py
@@ -1,12 +1,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import get_request_site_address, encode
from frappe.model.document import Document
-from six.moves.urllib.parse import quote
+from urllib.parse import quote
from frappe.website.router import resolve_route
from frappe.website.doctype.website_theme.website_theme import add_website_theme
from frappe.integrations.doctype.google_settings.google_settings import get_auth_url
diff --git a/frappe/website/doctype/website_sidebar/test_website_sidebar.py b/frappe/website/doctype/website_sidebar/test_website_sidebar.py
index d49ea84a35..bfaee51169 100644
--- a/frappe/website/doctype/website_sidebar/test_website_sidebar.py
+++ b/frappe/website/doctype/website_sidebar/test_website_sidebar.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/website/doctype/website_sidebar/website_sidebar.py b/frappe/website/doctype/website_sidebar/website_sidebar.py
index 87daf47680..f8a431ac15 100644
--- a/frappe/website/doctype/website_sidebar/website_sidebar.py
+++ b/frappe/website/doctype/website_sidebar/website_sidebar.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/website/doctype/website_sidebar_item/website_sidebar_item.py b/frappe/website/doctype/website_sidebar_item/website_sidebar_item.py
index 83e987ed09..f4d88e3259 100644
--- a/frappe/website/doctype/website_sidebar_item/website_sidebar_item.py
+++ b/frappe/website/doctype/website_sidebar_item/website_sidebar_item.py
@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/website/doctype/website_slideshow/test_website_slideshow.py b/frappe/website/doctype/website_slideshow/test_website_slideshow.py
index 9eccc71ad3..5e3ca3c617 100644
--- a/frappe/website/doctype/website_slideshow/test_website_slideshow.py
+++ b/frappe/website/doctype/website_slideshow/test_website_slideshow.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
diff --git a/frappe/website/doctype/website_slideshow/website_slideshow.py b/frappe/website/doctype/website_slideshow/website_slideshow.py
index 90f62d1bb1..d31adbf986 100644
--- a/frappe/website/doctype/website_slideshow/website_slideshow.py
+++ b/frappe/website/doctype/website_slideshow/website_slideshow.py
@@ -3,7 +3,6 @@
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
diff --git a/frappe/website/doctype/website_slideshow_item/website_slideshow_item.py b/frappe/website/doctype/website_slideshow_item/website_slideshow_item.py
index 3b809a7f65..beaa9ecf9e 100644
--- a/frappe/website/doctype/website_slideshow_item/website_slideshow_item.py
+++ b/frappe/website/doctype/website_slideshow_item/website_slideshow_item.py
@@ -3,7 +3,6 @@
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/website/doctype/website_theme/test_website_theme.py b/frappe/website/doctype/website_theme/test_website_theme.py
index 11956ba3d9..4ff4e269da 100644
--- a/frappe/website/doctype/website_theme/test_website_theme.py
+++ b/frappe/website/doctype/website_theme/test_website_theme.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import os
import frappe
import unittest
diff --git a/frappe/website/doctype/website_theme/website_theme.py b/frappe/website/doctype/website_theme/website_theme.py
index dbc54782e1..248c4bc176 100644
--- a/frappe/website/doctype/website_theme/website_theme.py
+++ b/frappe/website/doctype/website_theme/website_theme.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
diff --git a/frappe/website/doctype/website_theme_ignore_app/website_theme_ignore_app.py b/frappe/website/doctype/website_theme_ignore_app/website_theme_ignore_app.py
index e91e91a68f..ec232c0c79 100644
--- a/frappe/website/doctype/website_theme_ignore_app/website_theme_ignore_app.py
+++ b/frappe/website/doctype/website_theme_ignore_app/website_theme_ignore_app.py
@@ -2,7 +2,6 @@
# 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
diff --git a/frappe/website/page/__init__.py b/frappe/website/page/__init__.py
index baffc48825..8b13789179 100644
--- a/frappe/website/page/__init__.py
+++ b/frappe/website/page/__init__.py
@@ -1 +1 @@
-from __future__ import unicode_literals
+
diff --git a/frappe/website/purifycss.py b/frappe/website/purifycss.py
index 39e989db6e..bac68b881b 100644
--- a/frappe/website/purifycss.py
+++ b/frappe/website/purifycss.py
@@ -1,4 +1,3 @@
-from __future__ import print_function, unicode_literals
'''
Check for unused CSS Classes
diff --git a/frappe/website/redirect.py b/frappe/website/redirect.py
index 73e3c21727..3194895d95 100644
--- a/frappe/website/redirect.py
+++ b/frappe/website/redirect.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
import re, frappe
def resolve_redirect(path):
diff --git a/frappe/website/render.py b/frappe/website/render.py
index 71382c18ff..2b4a5e2dab 100644
--- a/frappe/website/render.py
+++ b/frappe/website/render.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
import frappe.sessions
@@ -9,8 +8,6 @@ from frappe.utils import cstr
import os, mimetypes, json
import re
-import six
-from six import iteritems
from werkzeug.wrappers import Response
from werkzeug.routing import Rule
from werkzeug.wsgi import wrap_file
@@ -131,7 +128,7 @@ def build_response(path, data, http_status_code, headers=None):
add_preload_headers(response)
if headers:
- for key, val in iteritems(headers):
+ for key, val in headers.items():
response.headers[key] = val.encode("ascii", errors="xmlcharrefreplace")
return response
@@ -321,7 +318,7 @@ def clear_cache(path=None):
frappe.get_attr(method)(path)
def render_403(e, pathname):
- frappe.local.message = cstr(e.message if six.PY2 else e)
+ frappe.local.message = cstr(e)
frappe.local.message_title = _("Not Permitted")
frappe.local.response['context'] = dict(
indicator_color = 'red',
diff --git a/frappe/website/report/website_analytics/website_analytics.py b/frappe/website/report/website_analytics/website_analytics.py
index b7e0aab27b..d141972679 100644
--- a/frappe/website/report/website_analytics/website_analytics.py
+++ b/frappe/website/report/website_analytics/website_analytics.py
@@ -1,7 +1,6 @@
# Copyright (c) 2013, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
import frappe
from datetime import datetime
from frappe.utils import getdate
diff --git a/frappe/website/router.py b/frappe/website/router.py
index f3518e179e..899f2722ab 100644
--- a/frappe/website/router.py
+++ b/frappe/website/router.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import io
import os
import re
diff --git a/frappe/website/utils.py b/frappe/website/utils.py
index 0738c836f3..aa98595e2d 100644
--- a/frappe/website/utils.py
+++ b/frappe/website/utils.py
@@ -1,6 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
import re
import os
import frappe
diff --git a/frappe/website/web_form/request_data/request_data.py b/frappe/website/web_form/request_data/request_data.py
index 07616644d3..1224e3f095 100644
--- a/frappe/website/web_form/request_data/request_data.py
+++ b/frappe/website/web_form/request_data/request_data.py
@@ -1,4 +1,2 @@
-from __future__ import unicode_literals
-
def get_context(context):
pass
diff --git a/frappe/website/web_form/request_to_delete_data/request_to_delete_data.py b/frappe/website/web_form/request_to_delete_data/request_to_delete_data.py
index 74908f4119..75b748913a 100644
--- a/frappe/website/web_form/request_to_delete_data/request_to_delete_data.py
+++ b/frappe/website/web_form/request_to_delete_data/request_to_delete_data.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
def get_context(context):
# do your magic here
pass
\ No newline at end of file
diff --git a/frappe/website/website_generator.py b/frappe/website/website_generator.py
index fc08abeed9..351f2f1832 100644
--- a/frappe/website/website_generator.py
+++ b/frappe/website/website_generator.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.website.utils import cleanup_page_name
diff --git a/frappe/workflow/doctype/workflow/test_workflow.py b/frappe/workflow/doctype/workflow/test_workflow.py
index 9ad0562a86..9bafd377fc 100644
--- a/frappe/workflow/doctype/workflow/test_workflow.py
+++ b/frappe/workflow/doctype/workflow/test_workflow.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-from __future__ import unicode_literals
-
import frappe
import unittest
from frappe.utils import random_string
diff --git a/frappe/workflow/doctype/workflow/workflow.py b/frappe/workflow/doctype/workflow/workflow.py
index b4d7293fed..4959ee5639 100644
--- a/frappe/workflow/doctype/workflow/workflow.py
+++ b/frappe/workflow/doctype/workflow/workflow.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
diff --git a/frappe/workflow/doctype/workflow_action/workflow_action.py b/frappe/workflow/doctype/workflow_action/workflow_action.py
index 8c10af8251..b70ffb2406 100644
--- a/frappe/workflow/doctype/workflow_action/workflow_action.py
+++ b/frappe/workflow/doctype/workflow_action/workflow_action.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils.background_jobs import enqueue
diff --git a/frappe/workflow/doctype/workflow_action_master/workflow_action_master.py b/frappe/workflow/doctype/workflow_action_master/workflow_action_master.py
index df1123f786..b438a708dc 100644
--- a/frappe/workflow/doctype/workflow_action_master/workflow_action_master.py
+++ b/frappe/workflow/doctype/workflow_action_master/workflow_action_master.py
@@ -2,7 +2,6 @@
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
-from __future__ import unicode_literals
from frappe.model.document import Document
class WorkflowActionMaster(Document):
diff --git a/frappe/workflow/doctype/workflow_document_state/workflow_document_state.py b/frappe/workflow/doctype/workflow_document_state/workflow_document_state.py
index 6e2ac212ae..ae7372f5c2 100644
--- a/frappe/workflow/doctype/workflow_document_state/workflow_document_state.py
+++ b/frappe/workflow/doctype/workflow_document_state/workflow_document_state.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/workflow/doctype/workflow_state/test_workflow_state.py b/frappe/workflow/doctype/workflow_state/test_workflow_state.py
index 63a2f9b151..eeb0807d52 100644
--- a/frappe/workflow/doctype/workflow_state/test_workflow_state.py
+++ b/frappe/workflow/doctype/workflow_state/test_workflow_state.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
test_records = frappe.get_test_records('Workflow State')
\ No newline at end of file
diff --git a/frappe/workflow/doctype/workflow_state/workflow_state.py b/frappe/workflow/doctype/workflow_state/workflow_state.py
index c446a4445e..40f7d370dd 100644
--- a/frappe/workflow/doctype/workflow_state/workflow_state.py
+++ b/frappe/workflow/doctype/workflow_state/workflow_state.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/workflow/doctype/workflow_transition/workflow_transition.py b/frappe/workflow/doctype/workflow_transition/workflow_transition.py
index 4c07d700c6..e49a90f9d6 100644
--- a/frappe/workflow/doctype/workflow_transition/workflow_transition.py
+++ b/frappe/workflow/doctype/workflow_transition/workflow_transition.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
diff --git a/frappe/www/404.py b/frappe/www/404.py
index c9de234743..f064a66c17 100644
--- a/frappe/www/404.py
+++ b/frappe/www/404.py
@@ -1,4 +1,2 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
diff --git a/frappe/www/__init__.py b/frappe/www/__init__.py
index baffc48825..8b13789179 100644
--- a/frappe/www/__init__.py
+++ b/frappe/www/__init__.py
@@ -1 +1 @@
-from __future__ import unicode_literals
+
diff --git a/frappe/www/about.py b/frappe/www/about.py
index e7a7be23e8..05fe34b162 100644
--- a/frappe/www/about.py
+++ b/frappe/www/about.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
sitemap = 1
diff --git a/frappe/www/app.py b/frappe/www/app.py
index 5f19712cd3..b0fa19df9b 100644
--- a/frappe/www/app.py
+++ b/frappe/www/app.py
@@ -1,8 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
-
no_cache = 1
base_template_path = "templates/www/app.html"
diff --git a/frappe/www/complete_signup.py b/frappe/www/complete_signup.py
index 00c499e786..0e57cb68c3 100644
--- a/frappe/www/complete_signup.py
+++ b/frappe/www/complete_signup.py
@@ -1,5 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
diff --git a/frappe/www/contact.py b/frappe/www/contact.py
index d976350075..53b0666be8 100644
--- a/frappe/www/contact.py
+++ b/frappe/www/contact.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
from frappe.utils import now
from frappe import _
diff --git a/frappe/www/error.py b/frappe/www/error.py
index 161038373d..dcbfb38e1f 100644
--- a/frappe/www/error.py
+++ b/frappe/www/error.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-
-from __future__ import unicode_literals, print_function
import frappe
no_cache = 1
diff --git a/frappe/www/list.py b/frappe/www/list.py
index fc4dc602c3..881aaf085b 100644
--- a/frappe/www/list.py
+++ b/frappe/www/list.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe, json
from frappe.utils import cint, quoted
from frappe.website.render import resolve_path
diff --git a/frappe/www/login.py b/frappe/www/login.py
index 1ce25a81d9..6542b29d42 100644
--- a/frappe/www/login.py
+++ b/frappe/www/login.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
import frappe.utils
from frappe.utils.oauth import get_oauth2_authorize_url, get_oauth_keys, login_via_oauth2, login_via_oauth2_id_token, login_oauth_user as _login_oauth_user, redirect_post_login
diff --git a/frappe/www/me.py b/frappe/www/me.py
index 2191f28bca..f8356b6d07 100644
--- a/frappe/www/me.py
+++ b/frappe/www/me.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe import _
import frappe.www.list
diff --git a/frappe/www/message.py b/frappe/www/message.py
index ea45b9c4b5..3658261503 100644
--- a/frappe/www/message.py
+++ b/frappe/www/message.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.utils import strip_html_tags
diff --git a/frappe/www/printview.py b/frappe/www/printview.py
index 132d863375..6b879e2452 100644
--- a/frappe/www/printview.py
+++ b/frappe/www/printview.py
@@ -1,15 +1,12 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe, os, copy, json, re
from frappe import _
from frappe.modules import get_doc_path
from frappe.core.doctype.access_log.access_log import make_access_log
from frappe.utils import cint, sanitize_html, strip_html
-from six import string_types
no_cache = 1
@@ -73,7 +70,7 @@ def get_rendered_template(doc, name=None, print_format=None, meta=None,
print_settings = frappe.get_single("Print Settings").as_dict()
print_settings.update(settings or {})
- if isinstance(no_letterhead, string_types):
+ if isinstance(no_letterhead, str):
no_letterhead = cint(no_letterhead)
elif no_letterhead is None:
@@ -186,10 +183,10 @@ def get_html_and_style(doc, name=None, print_format=None, meta=None,
settings=None, templates=None):
"""Returns `html` and `style` of print format, used in PDF etc"""
- if isinstance(doc, string_types) and isinstance(name, string_types):
+ if isinstance(doc, str) and isinstance(name, str):
doc = frappe.get_doc(doc, name)
- if isinstance(doc, string_types):
+ if isinstance(doc, str):
doc = frappe.get_doc(json.loads(doc))
print_format = get_print_format_doc(print_format, meta=meta or frappe.get_meta(doc.doctype))
@@ -211,10 +208,10 @@ def get_html_and_style(doc, name=None, print_format=None, meta=None,
def get_rendered_raw_commands(doc, name=None, print_format=None, meta=None, lang=None):
"""Returns Rendered Raw Commands of print format, used to send directly to printer"""
- if isinstance(doc, string_types) and isinstance(name, string_types):
+ if isinstance(doc, str) and isinstance(name, str):
doc = frappe.get_doc(doc, name)
- if isinstance(doc, string_types):
+ if isinstance(doc, str):
doc = frappe.get_doc(json.loads(doc))
print_format = get_print_format_doc(print_format, meta=meta or frappe.get_meta(doc.doctype))
@@ -380,7 +377,7 @@ def has_value(df, doc):
if value in (None, ""):
return False
- elif isinstance(value, string_types) and not strip_html(value).strip():
+ elif isinstance(value, str) and not strip_html(value).strip():
if df.fieldtype in ["Text", "Text Editor"]:
return True
@@ -480,7 +477,7 @@ def column_has_value(data, fieldname, col_df):
for row in data:
value = row.get(fieldname)
if value:
- if isinstance(value, string_types):
+ if isinstance(value, str):
if strip_html(value).strip():
has_value = True
break
diff --git a/frappe/www/profile.py b/frappe/www/profile.py
index e1badf10e5..7db7beb7d8 100644
--- a/frappe/www/profile.py
+++ b/frappe/www/profile.py
@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
no_cache = 1
diff --git a/frappe/www/qrcode.py b/frappe/www/qrcode.py
index ddee635ded..37ee204925 100644
--- a/frappe/www/qrcode.py
+++ b/frappe/www/qrcode.py
@@ -1,11 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
from frappe import _
-from six.moves.urllib.parse import parse_qsl
+from urllib.parse import parse_qsl
from frappe.twofactor import get_qr_svg_code
def get_context(context):
diff --git a/frappe/www/robots.py b/frappe/www/robots.py
index 6a7c74cf41..487f378415 100644
--- a/frappe/www/robots.py
+++ b/frappe/www/robots.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
base_template_path = "templates/www/robots.txt"
diff --git a/frappe/www/rss.py b/frappe/www/rss.py
index a389304e5e..033c341137 100644
--- a/frappe/www/rss.py
+++ b/frappe/www/rss.py
@@ -1,10 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.utils import escape_html, get_request_site_address, now, cstr
-from six.moves.urllib.parse import quote, urljoin
+from urllib.parse import quote, urljoin
no_cache = 1
base_template_path = "templates/www/rss.xml"
diff --git a/frappe/www/search.py b/frappe/www/search.py
index a8bb1a5294..292c9e532f 100644
--- a/frappe/www/search.py
+++ b/frappe/www/search.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.utils.global_search import web_search
from html2text import html2text
diff --git a/frappe/www/sitemap.py b/frappe/www/sitemap.py
index f8f03c45f8..9eb36e5335 100644
--- a/frappe/www/sitemap.py
+++ b/frappe/www/sitemap.py
@@ -1,14 +1,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
import frappe
from frappe.model.document import get_controller
from frappe.utils import get_datetime, nowdate, get_url
from frappe.website.router import get_pages, get_all_page_context_from_doctypes
-from six import iteritems
-from six.moves.urllib.parse import quote, urljoin
+from urllib.parse import quote
no_cache = 1
base_template_path = "templates/www/sitemap.xml"
@@ -22,14 +19,14 @@ def get_context(context):
host = frappe.utils.get_host_name_from_request()
links = []
- for route, page in iteritems(get_pages()):
+ for route, page in get_pages().items():
if page.sitemap:
links.append({
"loc": get_url(quote(page.name.encode("utf-8"))),
"lastmod": nowdate()
})
- for route, data in iteritems(get_public_pages_from_doctypes()):
+ for route, data in get_public_pages_from_doctypes().items:
links.append({
"loc": get_url(quote((route or "").encode("utf-8"))),
"lastmod": get_datetime(data.get("modified")).strftime("%Y-%m-%d")
diff --git a/frappe/www/third_party_apps.py b/frappe/www/third_party_apps.py
index 77928af511..2668923449 100644
--- a/frappe/www/third_party_apps.py
+++ b/frappe/www/third_party_apps.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe import _
import frappe.www.list
diff --git a/frappe/www/unsubscribe.py b/frappe/www/unsubscribe.py
index 8bf0741fef..4ebaa35991 100644
--- a/frappe/www/unsubscribe.py
+++ b/frappe/www/unsubscribe.py
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals
+
import frappe
from frappe.utils.verified_command import verify_request
from frappe.email.doctype.newsletter.newsletter import confirmed_unsubscribe
diff --git a/frappe/www/update_password.py b/frappe/www/update_password.py
index f81098b916..4c7d3d5401 100644
--- a/frappe/www/update_password.py
+++ b/frappe/www/update_password.py
@@ -1,7 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
-
from frappe import _
no_cache = 1
diff --git a/frappe/www/website_script.py b/frappe/www/website_script.py
index 0bb5a8a80b..915ef23367 100644
--- a/frappe/www/website_script.py
+++ b/frappe/www/website_script.py
@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals
import frappe
from frappe.utils import strip
from frappe.website.doctype.website_theme.website_theme import get_active_theme
diff --git a/setup.py b/setup.py
index 515e9448c2..f4f826d6b1 100644
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
# imports - standard imports
import os, shutil
from distutils.command.clean import clean as Clean