diff --git a/frappe/core/doctype/activity_log/activity_log.py b/frappe/core/doctype/activity_log/activity_log.py index 84c908d0ae..61dedd7bc0 100644 --- a/frappe/core/doctype/activity_log/activity_log.py +++ b/frappe/core/doctype/activity_log/activity_log.py @@ -2,7 +2,6 @@ # License: MIT. See LICENSE import frappe -from frappe import _ from frappe.core.utils import set_timeline_doc from frappe.model.document import Document from frappe.query_builder import DocType, Interval diff --git a/frappe/core/doctype/block_module/block_module.py b/frappe/core/doctype/block_module/block_module.py index 3158e3e6a5..456df5037c 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 # License: MIT. See LICENSE -import frappe from frappe.model.document import Document diff --git a/frappe/core/doctype/communication/communication.py b/frappe/core/doctype/communication/communication.py index 667d3ee135..9b86f18726 100644 --- a/frappe/core/doctype/communication/communication.py +++ b/frappe/core/doctype/communication/communication.py @@ -20,7 +20,6 @@ from frappe.core.doctype.communication.mixins import CommunicationEmailMixin from frappe.core.utils import get_parent_doc from frappe.model.document import Document from frappe.utils import ( - cstr, parse_addr, split_emails, strip_html, diff --git a/frappe/core/doctype/custom_docperm/test_custom_docperm.py b/frappe/core/doctype/custom_docperm/test_custom_docperm.py index e3a831bb8d..51923718b6 100644 --- a/frappe/core/doctype/custom_docperm/test_custom_docperm.py +++ b/frappe/core/doctype/custom_docperm/test_custom_docperm.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Custom DocPerm') diff --git a/frappe/core/doctype/custom_role/test_custom_role.py b/frappe/core/doctype/custom_role/test_custom_role.py index 01956ceda3..9c12bddd26 100644 --- a/frappe/core/doctype/custom_role/test_custom_role.py +++ b/frappe/core/doctype/custom_role/test_custom_role.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Custom Role') diff --git a/frappe/core/doctype/data_import/importer.py b/frappe/core/doctype/data_import/importer.py index 9a801cfc19..f5baa84352 100644 --- a/frappe/core/doctype/data_import/importer.py +++ b/frappe/core/doctype/data_import/importer.py @@ -11,7 +11,6 @@ import frappe from frappe import _ from frappe.core.doctype.version.version import get_diff from frappe.model import no_value_fields -from frappe.model import table_fields as table_fieldtypes from frappe.utils import cint, cstr, duration_to_seconds, flt, update_progress_bar from frappe.utils.csvutils import get_csv_content_from_google_sheets, read_csv_content from frappe.utils.xlsxutils import ( diff --git a/frappe/core/doctype/deleted_document/test_deleted_document.py b/frappe/core/doctype/deleted_document/test_deleted_document.py index 0c8e88a32f..8985298498 100644 --- a/frappe/core/doctype/deleted_document/test_deleted_document.py +++ b/frappe/core/doctype/deleted_document/test_deleted_document.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Deleted Document') diff --git a/frappe/core/doctype/docperm/docperm.py b/frappe/core/doctype/docperm/docperm.py index 68ef21e770..87d6457c3c 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 # License: MIT. See LICENSE -import frappe from frappe.model.document import Document diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py index 4e21f3bcb4..047c48e9d5 100644 --- a/frappe/core/doctype/doctype/doctype.py +++ b/frappe/core/doctype/doctype/doctype.py @@ -32,7 +32,7 @@ from frappe.model.meta import Meta from frappe.modules import get_doc_path, make_boilerplate from frappe.modules.import_file import get_file_path from frappe.query_builder.functions import Concat -from frappe.utils import cint, now +from frappe.utils import cint from frappe.website.utils import clear_cache diff --git a/frappe/core/doctype/domain/test_domain.py b/frappe/core/doctype/domain/test_domain.py index 85f613a6bd..623d80a280 100644 --- a/frappe/core/doctype/domain/test_domain.py +++ b/frappe/core/doctype/domain/test_domain.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - class TestDomain(unittest.TestCase): pass diff --git a/frappe/core/doctype/error_snapshot/test_error_snapshot.py b/frappe/core/doctype/error_snapshot/test_error_snapshot.py index 40596b3d22..121fe8a6f9 100644 --- a/frappe/core/doctype/error_snapshot/test_error_snapshot.py +++ b/frappe/core/doctype/error_snapshot/test_error_snapshot.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Error Snapshot') diff --git a/frappe/core/doctype/file/file.py b/frappe/core/doctype/file/file.py index 8ca0b9ea10..3352123146 100755 --- a/frappe/core/doctype/file/file.py +++ b/frappe/core/doctype/file/file.py @@ -41,7 +41,6 @@ from frappe.utils.file_manager import safe_b64decode from frappe.utils.image import optimize_image, strip_exif_data if TYPE_CHECKING: - from PIL.ImageFile import ImageFile from requests.models import Response diff --git a/frappe/core/doctype/has_domain/has_domain.py b/frappe/core/doctype/has_domain/has_domain.py index 15dc596365..8ef69ef0c4 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 # License: MIT. See LICENSE -import frappe 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 7262cf444e..305515c191 100644 --- a/frappe/core/doctype/language/test_language.py +++ b/frappe/core/doctype/language/test_language.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Language') diff --git a/frappe/core/doctype/module_def/test_module_def.py b/frappe/core/doctype/module_def/test_module_def.py index 3d269e4734..3a6da6d854 100644 --- a/frappe/core/doctype/module_def/test_module_def.py +++ b/frappe/core/doctype/module_def/test_module_def.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Module Def') diff --git a/frappe/core/doctype/patch_log/patch_log.py b/frappe/core/doctype/patch_log/patch_log.py index dbedbebdeb..eee57af4c2 100644 --- a/frappe/core/doctype/patch_log/patch_log.py +++ b/frappe/core/doctype/patch_log/patch_log.py @@ -3,7 +3,6 @@ # License: MIT. See LICENSE -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 521eaf5e41..54cdc6416a 100644 --- a/frappe/core/doctype/patch_log/test_patch_log.py +++ b/frappe/core/doctype/patch_log/test_patch_log.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Patch Log') diff --git a/frappe/core/doctype/payment_gateway/payment_gateway.py b/frappe/core/doctype/payment_gateway/payment_gateway.py index c48fd340cd..7eb4c5481d 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 # License: MIT. See LICENSE -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 d40c7bbece..71766561b3 100644 --- a/frappe/core/doctype/payment_gateway/test_payment_gateway.py +++ b/frappe/core/doctype/payment_gateway/test_payment_gateway.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Payment Gateway') diff --git a/frappe/core/doctype/sms_parameter/sms_parameter.py b/frappe/core/doctype/sms_parameter/sms_parameter.py index d67e905234..d2c5be6c50 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) 2021, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE -import frappe from frappe.model.document import Document diff --git a/frappe/core/doctype/sms_settings/test_sms_settings.py b/frappe/core/doctype/sms_settings/test_sms_settings.py index a7ec761b82..da1b807594 100644 --- a/frappe/core/doctype/sms_settings/test_sms_settings.py +++ b/frappe/core/doctype/sms_settings/test_sms_settings.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - class TestSMSSettings(unittest.TestCase): pass diff --git a/frappe/core/doctype/system_settings/test_system_settings.py b/frappe/core/doctype/system_settings/test_system_settings.py index 955f4193f0..410762b4e7 100644 --- a/frappe/core/doctype/system_settings/test_system_settings.py +++ b/frappe/core/doctype/system_settings/test_system_settings.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - class TestSystemSettings(unittest.TestCase): pass diff --git a/frappe/core/doctype/transaction_log/transaction_log.py b/frappe/core/doctype/transaction_log/transaction_log.py index d0c0342f6f..efe9bbddc2 100644 --- a/frappe/core/doctype/transaction_log/transaction_log.py +++ b/frappe/core/doctype/transaction_log/transaction_log.py @@ -4,7 +4,6 @@ import hashlib import frappe -from frappe import _ from frappe.model.document import Document from frappe.query_builder import DocType from frappe.utils import cint, now_datetime diff --git a/frappe/core/doctype/user_email/user_email.py b/frappe/core/doctype/user_email/user_email.py index 4e125f5308..21167ad25d 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 # License: MIT. See LICENSE -import frappe from frappe.model.document import Document diff --git a/frappe/core/doctype/user_permission/user_permission.py b/frappe/core/doctype/user_permission/user_permission.py index e43a288744..2dfd7863b1 100644 --- a/frappe/core/doctype/user_permission/user_permission.py +++ b/frappe/core/doctype/user_permission/user_permission.py @@ -8,7 +8,6 @@ from frappe import _ from frappe.core.utils import find from frappe.desk.form.linked_with import get_linked_doctypes from frappe.model.document import Document -from frappe.permissions import get_valid_perms, update_permission_property from frappe.utils import cstr diff --git a/frappe/core/doctype/view_log/view_log.py b/frappe/core/doctype/view_log/view_log.py index 4a3ba0e83c..6156fb74df 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 # License: MIT. See LICENSE -import frappe from frappe.model.document import Document diff --git a/frappe/core/notifications.py b/frappe/core/notifications.py index a10f8ec5ae..9a127e567e 100644 --- a/frappe/core/notifications.py +++ b/frappe/core/notifications.py @@ -2,8 +2,6 @@ # License: MIT. See LICENSE import frappe -from frappe.query_builder import DocType, Interval -from frappe.query_builder.functions import Now def get_notification_config(): diff --git a/frappe/core/page/background_jobs/background_jobs.py b/frappe/core/page/background_jobs/background_jobs.py index 09213d64c3..8c3c8ff41e 100644 --- a/frappe/core/page/background_jobs/background_jobs.py +++ b/frappe/core/page/background_jobs/background_jobs.py @@ -1,13 +1,9 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE -import json from typing import TYPE_CHECKING, Dict, List -from rq import Worker - import frappe -from frappe import _ from frappe.utils import convert_utc_to_user_timezone from frappe.utils.background_jobs import get_queues, get_workers from frappe.utils.scheduler import is_scheduler_inactive 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 32d8bbe18f..6d7f394beb 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 @@ -3,7 +3,6 @@ import frappe import frappe.utils.user -from frappe import _, throw from frappe.model import data_fieldtypes from frappe.permissions import check_admin_or_system_manager, rights diff --git a/frappe/core/web_form/edit_profile/edit_profile.py b/frappe/core/web_form/edit_profile/edit_profile.py index 80b7b87352..02e3e93333 100644 --- a/frappe/core/web_form/edit_profile/edit_profile.py +++ b/frappe/core/web_form/edit_profile/edit_profile.py @@ -1,6 +1,3 @@ -import frappe - - def get_context(context): # do your magic here pass diff --git a/frappe/custom/doctype/client_script/client_script.py b/frappe/custom/doctype/client_script/client_script.py index b60f5708d1..e18ad4be5d 100644 --- a/frappe/custom/doctype/client_script/client_script.py +++ b/frappe/custom/doctype/client_script/client_script.py @@ -1,7 +1,6 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe -from frappe import _ from frappe.model.document import Document diff --git a/frappe/custom/doctype/client_script/test_client_script.py b/frappe/custom/doctype/client_script/test_client_script.py index 2538fdf515..7497ab7780 100644 --- a/frappe/custom/doctype/client_script/test_client_script.py +++ b/frappe/custom/doctype/client_script/test_client_script.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Client Script') 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 0e030ce812..468496ca7a 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 # License: MIT. See LICENSE -import frappe from frappe.model.document import Document diff --git a/frappe/custom/doctype/property_setter/test_property_setter.py b/frappe/custom/doctype/property_setter/test_property_setter.py index 5b877ab18c..a1bbc69235 100644 --- a/frappe/custom/doctype/property_setter/test_property_setter.py +++ b/frappe/custom/doctype/property_setter/test_property_setter.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Property Setter') 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 29c1b6ee7d..155a71a9b4 100644 --- a/frappe/desk/doctype/dashboard_chart_source/dashboard_chart_source.py +++ b/frappe/desk/doctype/dashboard_chart_source/dashboard_chart_source.py @@ -5,7 +5,6 @@ import os import frappe -from frappe import _ from frappe.model.document import Document from frappe.modules import get_module_path, scrub from frappe.modules.export_file import export_to_files diff --git a/frappe/desk/doctype/event/event.py b/frappe/desk/doctype/event/event.py index 531cc69c57..6fdc95d3d0 100644 --- a/frappe/desk/doctype/event/event.py +++ b/frappe/desk/doctype/event/event.py @@ -18,7 +18,6 @@ from frappe.utils import ( cstr, date_diff, format_datetime, - get_datetime, get_datetime_str, getdate, now_datetime, diff --git a/frappe/desk/doctype/kanban_board/test_kanban_board.py b/frappe/desk/doctype/kanban_board/test_kanban_board.py index 179e6c71e5..d4504bf9d8 100644 --- a/frappe/desk/doctype/kanban_board/test_kanban_board.py +++ b/frappe/desk/doctype/kanban_board/test_kanban_board.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Kanban Board') 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 8a1f839c98..d905369a0b 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 # License: MIT. See LICENSE -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 ac434a760a..a5ba12df6a 100644 --- a/frappe/desk/doctype/list_filter/list_filter.py +++ b/frappe/desk/doctype/list_filter/list_filter.py @@ -2,9 +2,6 @@ # Copyright (c) 2018, Frappe Technologies and contributors # License: MIT. See LICENSE -import json - -import frappe from frappe.model.document import Document 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 7b87cf13b2..7dde133e6d 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 # License: MIT. See LICENSE -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 9e7ed7d9fe..c4a082ff11 100644 --- a/frappe/desk/doctype/notification_log/notification_log.py +++ b/frappe/desk/doctype/notification_log/notification_log.py @@ -7,7 +7,6 @@ from frappe import _ from frappe.desk.doctype.notification_settings.notification_settings import ( is_email_notifications_enabled_for_type, is_notifications_enabled, - set_seen_value, ) from frappe.model.document import Document diff --git a/frappe/desk/form/load.py b/frappe/desk/form/load.py index 75cd403aac..5a6004652e 100644 --- a/frappe/desk/form/load.py +++ b/frappe/desk/form/load.py @@ -2,7 +2,7 @@ # License: MIT. See LICENSE import json -from typing import Dict, List, Union +from typing import List, Union from urllib.parse import quote import frappe diff --git a/frappe/desk/link_preview.py b/frappe/desk/link_preview.py index 374a151505..7778d9e373 100644 --- a/frappe/desk/link_preview.py +++ b/frappe/desk/link_preview.py @@ -1,5 +1,3 @@ -import json - import frappe from frappe.model import no_value_fields, table_fields diff --git a/frappe/desk/page/setup_wizard/install_fixtures.py b/frappe/desk/page/setup_wizard/install_fixtures.py index 18a519f87f..91ea386948 100644 --- a/frappe/desk/page/setup_wizard/install_fixtures.py +++ b/frappe/desk/page/setup_wizard/install_fixtures.py @@ -2,7 +2,6 @@ # License: MIT. See LICENSE import frappe -from frappe import _ from frappe.desk.doctype.global_search_settings.global_search_settings import ( update_global_search_doctypes, ) 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 1b29d2f9d8..b7ca48faf0 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 # License: MIT. See LICENSE -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 f52aeb61fa..11571da7d9 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 @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Email Flag Queue') diff --git a/frappe/email/doctype/email_group/test_email_group.py b/frappe/email/doctype/email_group/test_email_group.py index 4013c17d93..96032d35cc 100644 --- a/frappe/email/doctype/email_group/test_email_group.py +++ b/frappe/email/doctype/email_group/test_email_group.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Email Group') 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 562b0327f2..ae608a4e15 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 @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Email Group Member') diff --git a/frappe/email/doctype/email_queue/test_email_queue.py b/frappe/email/doctype/email_queue/test_email_queue.py index b90390916a..b3c5467085 100644 --- a/frappe/email/doctype/email_queue/test_email_queue.py +++ b/frappe/email/doctype/email_queue/test_email_queue.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Email Queue') diff --git a/frappe/email/doctype/email_rule/email_rule.py b/frappe/email/doctype/email_rule/email_rule.py index f603aed77e..5075024b73 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 # License: MIT. See LICENSE -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 2cea421bd6..7b7a9a5c23 100644 --- a/frappe/email/doctype/email_rule/test_email_rule.py +++ b/frappe/email/doctype/email_rule/test_email_rule.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - class TestEmailRule(unittest.TestCase): pass diff --git a/frappe/email/doctype/email_unsubscribe/test_email_unsubscribe.py b/frappe/email/doctype/email_unsubscribe/test_email_unsubscribe.py index 7f9173d0b0..0133c6c4b5 100644 --- a/frappe/email/doctype/email_unsubscribe/test_email_unsubscribe.py +++ b/frappe/email/doctype/email_unsubscribe/test_email_unsubscribe.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Email Unsubscribe') diff --git a/frappe/email/doctype/newsletter/test_newsletter.py b/frappe/email/doctype/newsletter/test_newsletter.py index 81702f3a09..9ec61194ef 100644 --- a/frappe/email/doctype/newsletter/test_newsletter.py +++ b/frappe/email/doctype/newsletter/test_newsletter.py @@ -7,7 +7,6 @@ from typing import Union from unittest.mock import MagicMock, PropertyMock, patch import frappe -from frappe.desk.form.load import run_onload from frappe.email.doctype.newsletter.exceptions import ( NewsletterAlreadySentError, NoRecipientFoundError, 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 b7a00ac7d2..9fe1364d11 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 # License: MIT. See LICENSE -import frappe from frappe.model.document import Document diff --git a/frappe/email/doctype/notification_recipient/notification_recipient.py b/frappe/email/doctype/notification_recipient/notification_recipient.py index 9de15f46c0..1785590e93 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 # License: MIT. See LICENSE -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 694b3e03a6..1485f3bbaa 100644 --- a/frappe/email/doctype/unhandled_email/test_unhandled_email.py +++ b/frappe/email/doctype/unhandled_email/test_unhandled_email.py @@ -3,8 +3,6 @@ # License: MIT. See LICENSE import unittest -import frappe - # test_records = frappe.get_test_records('Unhandled Emails') diff --git a/frappe/email/smtp.py b/frappe/email/smtp.py index 1c91356506..d621fd2bba 100644 --- a/frappe/email/smtp.py +++ b/frappe/email/smtp.py @@ -1,15 +1,13 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE -import email.utils import smtplib -import sys import _socket import frappe from frappe import _ -from frappe.utils import cint, cstr, parse_addr +from frappe.utils import cint, cstr CONNECTION_FAILED = _("Could not connect to outgoing email server") AUTH_ERROR_TITLE = _("Invalid Credentials") diff --git a/frappe/geo/doctype/country/country.py b/frappe/geo/doctype/country/country.py index b3ba1b7127..c6edb38e94 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: MIT. See LICENSE -import frappe from frappe.model.document import Document diff --git a/frappe/geo/doctype/currency/currency.py b/frappe/geo/doctype/currency/currency.py index dd5df57bab..93bcc063f8 100644 --- a/frappe/geo/doctype/currency/currency.py +++ b/frappe/geo/doctype/currency/currency.py @@ -2,7 +2,6 @@ # License: MIT. See LICENSE import frappe -from frappe import _, throw from frappe.model.document import Document diff --git a/frappe/tests/test_commands.py b/frappe/tests/test_commands.py index 89bfd26912..be968511a8 100644 --- a/frappe/tests/test_commands.py +++ b/frappe/tests/test_commands.py @@ -7,7 +7,6 @@ import importlib import json import os import shlex -import shutil import subprocess import unittest from contextlib import contextmanager diff --git a/frappe/tests/test_scheduler.py b/frappe/tests/test_scheduler.py index 82bea12720..5161e1e80f 100644 --- a/frappe/tests/test_scheduler.py +++ b/frappe/tests/test_scheduler.py @@ -1,12 +1,10 @@ import time from unittest import TestCase -from dateutil.relativedelta import relativedelta - import frappe from frappe.core.doctype.scheduled_job_type.scheduled_job_type import sync_jobs from frappe.utils import add_days, get_datetime -from frappe.utils.background_jobs import enqueue, get_jobs +from frappe.utils.background_jobs import enqueue from frappe.utils.doctor import purge_pending_jobs from frappe.utils.scheduler import enqueue_events, is_dormant, schedule_jobs_based_on_activity diff --git a/frappe/utils/dashboard.py b/frappe/utils/dashboard.py index 9a53b93de2..ad1f391831 100644 --- a/frappe/utils/dashboard.py +++ b/frappe/utils/dashboard.py @@ -7,7 +7,7 @@ from os.path import join import frappe from frappe import _ from frappe.modules.import_file import import_file_by_path -from frappe.utils import add_to_date, cint, get_link_to_form +from frappe.utils import cint, get_link_to_form def cache_source(function): diff --git a/frappe/utils/doctor.py b/frappe/utils/doctor.py index 5ad16edee0..a474ffc612 100644 --- a/frappe/utils/doctor.py +++ b/frappe/utils/doctor.py @@ -20,8 +20,8 @@ def purge_pending_jobs(event=None, site=None, queue=None): mintues and would any leave daily, hourly and weekly tasks """ purged_task_count = 0 - for queue in get_queue_list(queue): - q = get_queue(queue) + for _queue in get_queue_list(queue): + q = get_queue(_queue) for job in q.jobs: if site and event: if job.kwargs["site"] == site and job.kwargs["event"] == event: diff --git a/frappe/utils/file_manager.py b/frappe/utils/file_manager.py index 67c51864d3..ca5589c906 100644 --- a/frappe/utils/file_manager.py +++ b/frappe/utils/file_manager.py @@ -7,23 +7,13 @@ import io import json import mimetypes import os -import re from copy import copy from urllib.parse import unquote import frappe from frappe import _, conf from frappe.query_builder.utils import DocType -from frappe.utils import ( - call_hook_method, - cint, - cstr, - encode, - get_files_path, - get_hook_method, - random_string, -) -from frappe.utils.image import optimize_image +from frappe.utils import call_hook_method, cint, cstr, encode, get_files_path, get_hook_method class MaxFileSizeReachedError(frappe.ValidationError): diff --git a/frappe/utils/identicon.py b/frappe/utils/identicon.py index 28df486d03..982219df2a 100644 --- a/frappe/utils/identicon.py +++ b/frappe/utils/identicon.py @@ -100,8 +100,6 @@ class Identicon(object): if format.upper() not in Image.SAVE: Image.init() save_handler = Image.SAVE[format.upper()] - try: - save_handler(self.image, fp, "") - finally: - fp.seek(0) - return "data:image/png;base64,{0}".format(base64.b64encode(fp.read())) + save_handler(self.image, fp, "") + fp.seek(0) + return "data:image/png;base64,{0}".format(base64.b64encode(fp.read())) diff --git a/frappe/utils/nestedset.py b/frappe/utils/nestedset.py index 193901e5d2..d3067973ef 100644 --- a/frappe/utils/nestedset.py +++ b/frappe/utils/nestedset.py @@ -15,7 +15,7 @@ from typing import Iterator import frappe from frappe import _ from frappe.model.document import Document -from frappe.query_builder import DocType, Order +from frappe.query_builder import Order from frappe.query_builder.functions import Coalesce, Max from frappe.query_builder.utils import DocType diff --git a/frappe/utils/print_format.py b/frappe/utils/print_format.py index b6d0cb8f8e..13989490a5 100644 --- a/frappe/utils/print_format.py +++ b/frappe/utils/print_format.py @@ -5,7 +5,7 @@ from PyPDF2 import PdfFileWriter import frappe from frappe import _ from frappe.core.doctype.access_log.access_log import make_access_log -from frappe.utils.pdf import cleanup, get_pdf +from frappe.utils.pdf import get_pdf no_cache = 1 diff --git a/frappe/workflow/doctype/workflow_action/workflow_action.py b/frappe/workflow/doctype/workflow_action/workflow_action.py index 7b54df2d51..038a3021d2 100644 --- a/frappe/workflow/doctype/workflow_action/workflow_action.py +++ b/frappe/workflow/doctype/workflow_action/workflow_action.py @@ -197,7 +197,7 @@ def update_completed_workflow_actions(doc, user=None, workflow=None, workflow_st if not allowed_roles: return if workflow_action := get_workflow_action_by_role(doc, allowed_roles): - update_completed_workflow_actions_using_role(doc, user, allowed_roles, workflow_action) + update_completed_workflow_actions_using_role(user, workflow_action) else: # backwards compatibility # for workflow actions saved using user @@ -238,9 +238,7 @@ def get_workflow_action_by_role(doc, allowed_roles): ).run(as_dict=True) -def update_completed_workflow_actions_using_role( - doc, user=None, allowed_roles=set(), workflow_action=None -): +def update_completed_workflow_actions_using_role(user=None, workflow_action=None): user = user if user else frappe.session.user WorkflowAction = DocType("Workflow Action") diff --git a/frappe/www/login.py b/frappe/www/login.py index c2eb5d2a6b..fbb34e43e7 100644 --- a/frappe/www/login.py +++ b/frappe/www/login.py @@ -1,8 +1,6 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE -import json - import frappe import frappe.utils from frappe import _ @@ -11,9 +9,13 @@ from frappe.integrations.doctype.ldap_settings.ldap_settings import LDAPSettings from frappe.integrations.oauth2_logins import decoder_compat from frappe.utils.html_utils import get_icon_html from frappe.utils.jinja import guess_is_path -from frappe.utils.oauth import get_oauth2_authorize_url, get_oauth_keys -from frappe.utils.oauth import login_oauth_user as _login_oauth_user -from frappe.utils.oauth import login_via_oauth2, login_via_oauth2_id_token, redirect_post_login +from frappe.utils.oauth import ( + get_oauth2_authorize_url, + get_oauth_keys, + login_via_oauth2, + login_via_oauth2_id_token, + redirect_post_login, +) from frappe.utils.password import get_decrypted_password from frappe.website.utils import get_home_page