refactor(treewide): formatting and ruff fixes, + manually enabled F401
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index 1eee9ea..7a1db6d 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -64,9 +64,7 @@
variant.flags.ignore_mandatory = True
variant.save()
- if not frappe.db.exists(
- "Item Manufacturer", {"item_code": variant.name, "manufacturer": manufacturer}
- ):
+ if not frappe.db.exists("Item Manufacturer", {"item_code": variant.name, "manufacturer": manufacturer}):
manufacturer_doc = frappe.new_doc("Item Manufacturer")
manufacturer_doc.update(
{
@@ -130,9 +128,7 @@
)
-def validate_item_attribute_value(
- attributes_list, attribute, attribute_value, item, from_variant=True
-):
+def validate_item_attribute_value(attributes_list, attribute, attribute_value, item, from_variant=True):
allow_rename_attribute_value = frappe.db.get_single_value(
"Item Variant Settings", "allow_rename_attribute_value"
)
@@ -179,9 +175,7 @@
def find_variant(template, args, variant_item_code=None):
- possible_variants = [
- i for i in get_item_codes_by_attributes(args, template) if i != variant_item_code
- ]
+ possible_variants = [i for i in get_item_codes_by_attributes(args, template) if i != variant_item_code]
for variant in possible_variants:
variant = frappe.get_doc("Item", variant)
@@ -357,7 +351,9 @@
if variant.attributes:
attributes_description = item.description + " "
for d in variant.attributes:
- attributes_description += "<div>" + d.attribute + ": " + cstr(d.attribute_value) + "</div>"
+ attributes_description += (
+ "<div>" + d.attribute + ": " + cstr(d.attribute_value) + "</div>"
+ )
if attributes_description not in variant.description:
variant.description = attributes_description
@@ -391,8 +387,8 @@
abbreviations.append(abbr_or_value)
if abbreviations:
- variant.item_code = "{0}-{1}".format(template_item_code, "-".join(abbreviations))
- variant.item_name = "{0}-{1}".format(template_item_name, "-".join(abbreviations))
+ variant.item_code = "{}-{}".format(template_item_code, "-".join(abbreviations))
+ variant.item_name = "{}-{}".format(template_item_name, "-".join(abbreviations))
@frappe.whitelist()