From 2bdbd5c72911959501a99620114049808e3c9aa6 Mon Sep 17 00:00:00 2001 From: Tyler Matteson Date: Fri, 26 Jul 2024 13:37:49 -0400 Subject: [PATCH] chore: black / prettier --- .pre-commit-config.yaml | 4 ---- inventory_tools/customize.py | 8 ++++++-- .../inventory_tools_settings.json | 1 - .../inventory_tools/overrides/production_plan.py | 1 - inventory_tools/inventory_tools/overrides/uom.py | 8 ++++---- inventory_tools/inventory_tools/overrides/workstation.py | 2 +- inventory_tools/tests/setup.py | 4 +++- inventory_tools/tests/test_overproduction.py | 5 ++++- inventory_tools/tests/test_uom.py | 6 ++---- 9 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0413663..ad32f63 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,12 +36,8 @@ repos: - id: flake8 additional_dependencies: ['flake8-bugbear'] - - repo: https://github.com/agritheory/test_utils rev: v0.14.1 - - - repo: https://github.com/agritheory/test_utils - rev: v0.14.0 hooks: - id: update_pre_commit_config - id: mypy diff --git a/inventory_tools/customize.py b/inventory_tools/customize.py index 06a0b32..6d78a51 100644 --- a/inventory_tools/customize.py +++ b/inventory_tools/customize.py @@ -9,8 +9,12 @@ def load_customizations(): customizations_directory = ( - Path().cwd().parent / "apps" / "inventory_tools" / "inventory_tools" / "inventory_tools" / "custom" - + Path().cwd().parent + / "apps" + / "inventory_tools" + / "inventory_tools" + / "inventory_tools" + / "custom" ) files = list(customizations_directory.glob("**/*.json")) for file in files: diff --git a/inventory_tools/inventory_tools/doctype/inventory_tools_settings/inventory_tools_settings.json b/inventory_tools/inventory_tools/doctype/inventory_tools_settings/inventory_tools_settings.json index c714e59..d66e38f 100644 --- a/inventory_tools/inventory_tools/doctype/inventory_tools_settings/inventory_tools_settings.json +++ b/inventory_tools/inventory_tools/doctype/inventory_tools_settings/inventory_tools_settings.json @@ -33,7 +33,6 @@ "faceted_search_tab", "show_on_website", "show_in_listview" - ], "fields": [ { diff --git a/inventory_tools/inventory_tools/overrides/production_plan.py b/inventory_tools/inventory_tools/overrides/production_plan.py index 46472b9..fae8735 100644 --- a/inventory_tools/inventory_tools/overrides/production_plan.py +++ b/inventory_tools/inventory_tools/overrides/production_plan.py @@ -10,7 +10,6 @@ from erpnext.manufacturing.doctype.work_order.work_order import get_default_warehouse - class InventoryToolsProductionPlan(ProductionPlan): @frappe.whitelist() def make_work_order(self): diff --git a/inventory_tools/inventory_tools/overrides/uom.py b/inventory_tools/inventory_tools/overrides/uom.py index 29ed399..21fa22d 100644 --- a/inventory_tools/inventory_tools/overrides/uom.py +++ b/inventory_tools/inventory_tools/overrides/uom.py @@ -8,20 +8,20 @@ @frappe.whitelist() def uom_restricted_query(doctype, txt, searchfield, start, page_len, filters): - if 'company' in filters: - company = filters.pop('company') + if "company" in filters: + company = filters.pop("company") else: company = frappe.defaults.get_defaults().get("company") if frappe.get_cached_value("Inventory Tools Settings", company, "enforce_uoms"): return frappe.get_all( - 'UOM Conversion Detail', + "UOM Conversion Detail", filters=filters, fields=["uom", "conversion_factor"], limit_start=start, limit_page_length=page_len, as_list=True, - ) + ) if "parent" in filters: filters.pop("parent") return execute( diff --git a/inventory_tools/inventory_tools/overrides/workstation.py b/inventory_tools/inventory_tools/overrides/workstation.py index 5e8e8f0..7907ab8 100644 --- a/inventory_tools/inventory_tools/overrides/workstation.py +++ b/inventory_tools/inventory_tools/overrides/workstation.py @@ -124,7 +124,7 @@ def get_alternative_workstations(doctype, txt, searchfield, start, page_len, fil "Workstation", default_workstation_name, searchfields, as_dict=True ) if default_workstation_name not in [row[0] for row in workstation]: - field_values = ','.join([v for k, v in default_workstation_fields[0].items() if k != 'name']) + field_values = ",".join([v for k, v in default_workstation_fields[0].items() if k != "name"]) _default = tuple( [ default_workstation_fields[0].name, diff --git a/inventory_tools/tests/setup.py b/inventory_tools/tests/setup.py index 6b19ce2..c8ebe63 100644 --- a/inventory_tools/tests/setup.py +++ b/inventory_tools/tests/setup.py @@ -199,7 +199,9 @@ def setup_manufacturing_settings(settings): ) frappe.set_value("Inventory Tools Settings", settings.company, "create_purchase_orders", 0) frappe.set_value("Inventory Tools Settings", settings.company, "enforce_uoms", 1) - frappe.set_value("Inventory Tools Settings", settings.company, "allow_alternative_workstations", 1) + frappe.set_value( + "Inventory Tools Settings", settings.company, "allow_alternative_workstations", 1 + ) frappe.set_value("Inventory Tools Settings", settings.company, "create_purchase_orders", 0) frappe.set_value( "Inventory Tools Settings", settings.company, "overproduction_percentage_for_work_order", 50 diff --git a/inventory_tools/tests/test_overproduction.py b/inventory_tools/tests/test_overproduction.py index 41d742b..6a15763 100644 --- a/inventory_tools/tests/test_overproduction.py +++ b/inventory_tools/tests/test_overproduction.py @@ -140,7 +140,10 @@ def test_validate_job_card(): "Job Card", {"work_order": work_order.name, "operation": work_order.operations[0].operation} ) jc.delete() - start_time = frappe.get_value("Job Card Time Log", {"docstatus": 1}, "MAX(to_time) AS to_time") or get_datetime() + start_time = ( + frappe.get_value("Job Card Time Log", {"docstatus": 1}, "MAX(to_time) AS to_time") + or get_datetime() + ) job_card = create_job_card(work_order, work_order.operations[0].as_dict(), auto_create=True) batch_size, total_operation_time = frappe.get_value( "Operation", job_card.operation, ["batch_size", "total_operation_time"] diff --git a/inventory_tools/tests/test_uom.py b/inventory_tools/tests/test_uom.py index 39def60..a400dce 100644 --- a/inventory_tools/tests/test_uom.py +++ b/inventory_tools/tests/test_uom.py @@ -25,13 +25,11 @@ def test_uom_enforcement_validation(): @pytest.mark.order(41) def test_uom_enforcement_query(): inventory_tools_settings = frappe.get_cached_doc( - "Inventory Tools Settings", 'Ambrosia Pie Company' + "Inventory Tools Settings", "Ambrosia Pie Company" ) inventory_tools_settings.enforce_uoms = True inventory_tools_settings.save() - inventory_tools_settings = frappe.get_cached_doc( - "Inventory Tools Settings", 'Chelsea Fruit Co' - ) + inventory_tools_settings = frappe.get_cached_doc("Inventory Tools Settings", "Chelsea Fruit Co") inventory_tools_settings.enforce_uoms = True inventory_tools_settings.save() response = frappe.call(