refactor(treewide): formatting and ruff fixes, + manually enabled F401

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang
2024-03-27 11:37:26 +05:30
parent 8afb7790de
commit 3effaf21ef
574 changed files with 4135 additions and 6276 deletions

View File

@@ -13,9 +13,7 @@ def boot_session(bootinfo):
update_page_info(bootinfo)
bootinfo.sysdefaults.territory = frappe.db.get_single_value("Selling Settings", "territory")
bootinfo.sysdefaults.customer_group = frappe.db.get_single_value(
"Selling Settings", "customer_group"
)
bootinfo.sysdefaults.customer_group = frappe.db.get_single_value("Selling Settings", "customer_group")
bootinfo.sysdefaults.allow_stale = cint(
frappe.db.get_single_value("Accounts Settings", "allow_stale")
)
@@ -28,9 +26,7 @@ def boot_session(bootinfo):
)
bootinfo.sysdefaults.allow_sales_order_creation_for_expired_quotation = cint(
frappe.db.get_single_value(
"Selling Settings", "allow_sales_order_creation_for_expired_quotation"
)
frappe.db.get_single_value("Selling Settings", "allow_sales_order_creation_for_expired_quotation")
)
# if no company, show a dialog box to create a new company
@@ -54,9 +50,7 @@ def boot_session(bootinfo):
update={"doctype": ":Company"},
)
party_account_types = frappe.db.sql(
""" select name, ifnull(account_type, '') from `tabParty Type`"""
)
party_account_types = frappe.db.sql(""" select name, ifnull(account_type, '') from `tabParty Type`""")
bootinfo.party_account_types = frappe._dict(party_account_types)
bootinfo.sysdefaults.demo_company = frappe.db.get_single_value("Global Defaults", "demo_company")

View File

@@ -93,7 +93,7 @@ def get_all_items(date_range, company, field, limit=None):
select_field = "sum(actual_qty)" if field == "available_stock_qty" else "sum(stock_value)"
results = frappe.db.get_all(
"Bin",
fields=["item_code as name", "{0} as value".format(select_field)],
fields=["item_code as name", f"{select_field} as value"],
group_by="item_code",
order_by="value desc",
limit=limit,
@@ -224,9 +224,7 @@ def get_date_condition(date_range, field):
if date_range:
date_range = frappe.parse_json(date_range)
from_date, to_date = date_range
date_condition = "and {0} between {1} and {2}".format(
field, frappe.db.escape(from_date), frappe.db.escape(to_date)
)
date_condition = f"and {field} between {frappe.db.escape(from_date)} and {frappe.db.escape(to_date)}"
return date_condition