From 49485e2df04fa1db3da533e981e780c07da943a9 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Mon, 23 Mar 2026 22:09:55 +0530 Subject: [PATCH] chore: remove unused imports (#53722) (cherry picked from commit 91da450a31414763da1110765fb774b4966cb3eb) # Conflicts: # erpnext/projects/doctype/project/project.py # erpnext/setup/utils.py # erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py --- .../account_balance_timeline/account_balance_timeline.py | 2 +- .../test_accounting_dimension_filter.py | 3 --- .../test_opening_invoice_creation_tool.py | 1 - erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py | 2 -- .../accounts/doctype/pos_invoice/test_pos_invoice_merge.py | 1 - .../customer_ledger_summary/test_customer_ledger_summary.py | 1 - erpnext/accounts/test/test_utils.py | 1 - .../request_for_quotation/test_request_for_quotation.py | 3 +-- erpnext/buying/doctype/supplier/test_supplier.py | 1 - erpnext/controllers/queries.py | 2 +- .../report/bom_stock_calculated/test_bom_stock_calculated.py | 2 -- erpnext/projects/doctype/project/project.py | 3 +++ erpnext/regional/report/uae_vat_201/test_uae_vat_201.py | 2 -- .../report/vat_audit_report/test_vat_audit_report.py | 2 -- .../sales_person_commission_summary.py | 2 -- erpnext/setup/utils.py | 4 ++++ erpnext/stock/doctype/item_price/test_item_price.py | 1 - .../serial_and_batch_bundle/serial_and_batch_bundle.py | 1 - .../doctype/stock_ledger_entry/test_stock_ledger_entry.py | 2 -- .../doctype/stock_reconciliation/stock_reconciliation.py | 5 +++++ erpnext/stock/reorder_item.py | 1 - erpnext/stock/report/reserved_stock/test_reserved_stock.py | 1 - 22 files changed, 15 insertions(+), 28 deletions(-) diff --git a/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py b/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py index 01e6c48397c..2f85a675a25 100644 --- a/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py +++ b/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py @@ -4,7 +4,7 @@ import frappe from frappe import _ -from frappe.utils import add_to_date, formatdate, get_link_to_form, getdate, nowdate +from frappe.utils import add_to_date, formatdate, getdate, nowdate from frappe.utils.dashboard import cache_source from frappe.utils.dateutils import get_from_date_from_timespan, get_period_ending from frappe.utils.nestedset import get_descendants_of diff --git a/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py b/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py index 9bed10824bb..f6a71cd8b80 100644 --- a/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py +++ b/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py @@ -1,13 +1,10 @@ # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -import unittest - import frappe from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import ( create_dimension, - disable_dimension, ) from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.exceptions import InvalidAccountDimensionError, MandatoryAccountDimensionError diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py index 3d57c781983..35b5eec4f79 100644 --- a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py +++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py @@ -5,7 +5,6 @@ import frappe from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import ( create_dimension, - disable_dimension, ) from erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool import ( get_temporary_opening_account, diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py index 8cf4d0cb90f..008dda585bf 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py @@ -13,8 +13,6 @@ from erpnext.accounts.doctype.pos_invoice.pos_invoice import make_sales_return from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile from erpnext.accounts.doctype.sales_invoice.sales_invoice import PartialPaymentValidationError from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice -from erpnext.stock.doctype.item.test_item import make_item -from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle import ( get_batch_from_bundle, get_serial_nos_from_bundle, diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice_merge.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice_merge.py index 5c490d303be..a944ad71897 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice_merge.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice_merge.py @@ -6,7 +6,6 @@ import frappe from erpnext.accounts.doctype.pos_invoice.test_pos_invoice import POSInvoiceTestMixin, create_pos_invoice from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt -from erpnext.tests.utils import ERPNextTestSuite class TestPOSInvoiceMerging(POSInvoiceTestMixin): diff --git a/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py b/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py index 0b114dd96d2..82425ab13b8 100644 --- a/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py +++ b/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py @@ -1,5 +1,4 @@ import frappe -from frappe import qb from frappe.utils import today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry diff --git a/erpnext/accounts/test/test_utils.py b/erpnext/accounts/test/test_utils.py index eddd30b68b6..a85cd9835a1 100644 --- a/erpnext/accounts/test/test_utils.py +++ b/erpnext/accounts/test/test_utils.py @@ -1,7 +1,6 @@ import unittest import frappe -from frappe.test_runner import make_test_objects from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice diff --git a/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py index 9201f6c4f2d..482b5899ec3 100644 --- a/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py +++ b/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py @@ -9,7 +9,6 @@ from frappe.tests import change_settings from frappe.utils import nowdate from erpnext.buying.doctype.request_for_quotation.request_for_quotation import ( - RequestforQuotation, create_supplier_quotation, get_pdf, make_supplier_quotation_from_rfq, @@ -250,7 +249,7 @@ class TestRequestforQuotation(ERPNextTestSuite): self.assertEqual(sq.items[0].item_code, rfq.items[0].item_code) -def make_request_for_quotation(**args) -> "RequestforQuotation": +def make_request_for_quotation(**args): """ :param supplier_data: List containing supplier data """ diff --git a/erpnext/buying/doctype/supplier/test_supplier.py b/erpnext/buying/doctype/supplier/test_supplier.py index 663a7b48e46..e2a7d5627b5 100644 --- a/erpnext/buying/doctype/supplier/test_supplier.py +++ b/erpnext/buying/doctype/supplier/test_supplier.py @@ -3,7 +3,6 @@ import frappe -from frappe.tests import UnitTestCase from erpnext.accounts.party import get_due_date from erpnext.controllers.website_list_for_contact import get_customers_suppliers diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index b7845bc5698..7e176279ad9 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -11,7 +11,7 @@ from frappe.desk.reportview import get_filters_cond, get_match_cond from frappe.permissions import has_permission from frappe.query_builder import Criterion, CustomFunction from frappe.query_builder.functions import Concat, Locate, Sum -from frappe.utils import cint, nowdate, today, unique +from frappe.utils import nowdate, today, unique from pypika import Order import erpnext diff --git a/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py b/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py index e0105b114c5..499629c2719 100644 --- a/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py +++ b/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py @@ -1,8 +1,6 @@ # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt -import frappe - from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom from erpnext.manufacturing.report.bom_stock_calculated.bom_stock_calculated import ( execute as bom_stock_calculated_report, diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index 0208bf1e9d0..c376ebcbdf4 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -1,7 +1,10 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt +<<<<<<< HEAD +======= +>>>>>>> 91da450a31 (chore: remove unused imports (#53722)) import frappe from email_reply_parser import EmailReplyParser from frappe import _, qb diff --git a/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py b/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py index fd4c69e8f8a..0f2c4906e56 100644 --- a/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py +++ b/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py @@ -1,5 +1,3 @@ -from unittest import TestCase - import frappe import erpnext diff --git a/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py b/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py index ded1bde3133..03f11b949cc 100644 --- a/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py +++ b/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py @@ -2,8 +2,6 @@ # For license information, please see license.txt -from unittest import TestCase - import frappe from frappe.utils import today diff --git a/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.py b/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.py index b0e611589eb..249ca31e7a7 100644 --- a/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.py +++ b/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.py @@ -1,8 +1,6 @@ # Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt - -import frappe from frappe import _, msgprint, qb from frappe.query_builder import Criterion diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py index 03938ebb94e..051dd5fa71d 100644 --- a/erpnext/setup/utils.py +++ b/erpnext/setup/utils.py @@ -4,7 +4,11 @@ import frappe from frappe import _ from frappe.utils import add_days, flt, get_datetime_str, nowdate +<<<<<<< HEAD from frappe.utils.data import getdate, now_datetime +======= +from frappe.utils.data import DateTimeLikeObject +>>>>>>> 91da450a31 (chore: remove unused imports (#53722)) from frappe.utils.nestedset import get_root_of from erpnext import get_default_company diff --git a/erpnext/stock/doctype/item_price/test_item_price.py b/erpnext/stock/doctype/item_price/test_item_price.py index f2f177dd8fe..7a1400863bf 100644 --- a/erpnext/stock/doctype/item_price/test_item_price.py +++ b/erpnext/stock/doctype/item_price/test_item_price.py @@ -3,7 +3,6 @@ import frappe -from frappe.tests.utils import make_test_records_for_doctype from erpnext.stock.doctype.item_price.item_price import ItemPriceDuplicateItem from erpnext.stock.get_item_details import ItemDetailsCtx, get_price_list_rate_for diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py index 45790ed89c4..0afbe084737 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py @@ -2,7 +2,6 @@ # For license information, please see license.txt import collections -import csv import json from collections import Counter, defaultdict diff --git a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py index 8f4b39dd5b8..787ce0a4d34 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py @@ -7,11 +7,9 @@ from uuid import uuid4 import frappe from frappe.core.page.permission_manager.permission_manager import reset -from frappe.custom.doctype.property_setter.property_setter import make_property_setter from frappe.query_builder.functions import Timestamp from frappe.utils import add_days, add_to_date, flt, today -from erpnext.accounts.doctype.gl_entry.gl_entry import rename_gle_sle_docs from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.landed_cost_voucher.test_landed_cost_voucher import ( diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 8d3b574fe50..7d93d0309dc 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -2,6 +2,11 @@ # License: GNU General Public License v3. See license.txt +<<<<<<< HEAD +======= +from datetime import timedelta + +>>>>>>> 91da450a31 (chore: remove unused imports (#53722)) import frappe from frappe import _, bold, json, msgprint from frappe.query_builder.functions import Sum diff --git a/erpnext/stock/reorder_item.py b/erpnext/stock/reorder_item.py index 3b99992df9c..0db78099c2f 100644 --- a/erpnext/stock/reorder_item.py +++ b/erpnext/stock/reorder_item.py @@ -2,7 +2,6 @@ # License: GNU General Public License v3. See license.txt -import json from math import ceil import frappe diff --git a/erpnext/stock/report/reserved_stock/test_reserved_stock.py b/erpnext/stock/report/reserved_stock/test_reserved_stock.py index d7790bfe200..90e58ad8ce3 100644 --- a/erpnext/stock/report/reserved_stock/test_reserved_stock.py +++ b/erpnext/stock/report/reserved_stock/test_reserved_stock.py @@ -6,7 +6,6 @@ from frappe.utils.data import today from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.stock.doctype.stock_reservation_entry.test_stock_reservation_entry import ( - cancel_all_stock_reservation_entries, create_items, create_material_receipt, )