From 7833ad502a27b6f5c92453a99f3088e5f9284d49 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 13:52:21 -0500 Subject: [PATCH 01/29] fix: fix 'wildcard-import' and 'unused-wildcard-import' for pylint --- .pylintrc | 2 -- src/sideshow/enum.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.pylintrc b/.pylintrc index 55fbabc..8a3395e 100644 --- a/.pylintrc +++ b/.pylintrc @@ -33,5 +33,3 @@ disable=fixme, unused-argument, unused-import, unused-variable, - unused-wildcard-import, - wildcard-import, diff --git a/src/sideshow/enum.py b/src/sideshow/enum.py index e9abd8a..34d953c 100644 --- a/src/sideshow/enum.py +++ b/src/sideshow/enum.py @@ -27,7 +27,7 @@ Enum Values from enum import Enum from collections import OrderedDict -from wuttjamaican.enum import * +from wuttjamaican.enum import * # pylint: disable=wildcard-import,unused-wildcard-import ORDER_UOM_CASE = "CS" From 2d61d6aecf2e4ec30ce0c664467e130c54590964 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 13:58:12 -0500 Subject: [PATCH 02/29] fix: fix 'unused-variable' for pylint --- .pylintrc | 1 - src/sideshow/batch/neworder.py | 2 -- src/sideshow/web/app.py | 4 ++-- src/sideshow/web/views/batch/neworder.py | 1 - src/sideshow/web/views/customers.py | 7 +++---- src/sideshow/web/views/orders.py | 4 ---- src/sideshow/web/views/products.py | 2 -- 7 files changed, 5 insertions(+), 16 deletions(-) diff --git a/.pylintrc b/.pylintrc index 8a3395e..3bda06f 100644 --- a/.pylintrc +++ b/.pylintrc @@ -32,4 +32,3 @@ disable=fixme, unnecessary-lambda-assignment, unused-argument, unused-import, - unused-variable, diff --git a/src/sideshow/batch/neworder.py b/src/sideshow/batch/neworder.py index fd0a05e..11dac0b 100644 --- a/src/sideshow/batch/neworder.py +++ b/src/sideshow/batch/neworder.py @@ -597,7 +597,6 @@ class NewOrderBatchHandler(BatchHandler): :returns: List of product info dicts. """ - model = self.app.model session = self.app.get_session(batch) use_local = self.use_local_products() user = user or batch.created_by @@ -1205,7 +1204,6 @@ class NewOrderBatchHandler(BatchHandler): :returns: :class:`~sideshow.db.model.orders.Order` instance. """ model = self.app.model - enum = self.app.enum session = self.app.get_session(batch) batch_fields = [ diff --git a/src/sideshow/web/app.py b/src/sideshow/web/app.py index 8d10424..1b1e448 100644 --- a/src/sideshow/web/app.py +++ b/src/sideshow/web/app.py @@ -2,7 +2,7 @@ ################################################################################ # # Sideshow -- Case/Special Order Tracker -# Copyright © 2024 Lance Edgar +# Copyright © 2024-2025 Lance Edgar # # This file is part of Sideshow. # @@ -41,7 +41,7 @@ def main(global_config, **settings): ) # make config objects - wutta_config = base.make_wutta_config(settings) + wutta_config = base.make_wutta_config(settings) # pylint: disable=unused-variable pyramid_config = base.make_pyramid_config(settings) # bring in the rest of Sideshow diff --git a/src/sideshow/web/views/batch/neworder.py b/src/sideshow/web/views/batch/neworder.py index d847a14..99ffda5 100644 --- a/src/sideshow/web/views/batch/neworder.py +++ b/src/sideshow/web/views/batch/neworder.py @@ -167,7 +167,6 @@ class NewOrderBatchView(BatchMasterView): def configure_row_grid(self, g): """ """ super().configure_row_grid(g) - enum = self.app.enum # TODO # order_uom diff --git a/src/sideshow/web/views/customers.py b/src/sideshow/web/views/customers.py index eb252c3..eeaf766 100644 --- a/src/sideshow/web/views/customers.py +++ b/src/sideshow/web/views/customers.py @@ -2,7 +2,7 @@ ################################################################################ # # Sideshow -- Case/Special Order Tracker -# Copyright © 2024 Lance Edgar +# Copyright © 2024-2025 Lance Edgar # # This file is part of Sideshow. # @@ -184,7 +184,6 @@ class LocalCustomerView(MasterView): def objectify(self, form): """ """ - enum = self.app.enum customer = super().objectify(form) customer.full_name = self.app.make_full_name( @@ -389,9 +388,9 @@ class PendingCustomerView(MasterView): model_title = self.get_model_title() # avoid deleting if still referenced by order(s) - for order in customer.orders: + if list(customer.orders): self.request.session.flash( - f"Cannot delete {model_title} still attached " "to Order(s)", "warning" + f"Cannot delete {model_title} still attached to Order(s)", "warning" ) raise self.redirect(self.get_action_url("view", customer)) diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index dc5fbd8..2d05d5e 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -224,7 +224,6 @@ class OrderView(MasterView): * :meth:`submit_order()` """ model = self.app.model - enum = self.app.enum session = self.Session() batch = self.get_current_batch() self.creating = True @@ -915,7 +914,6 @@ class OrderView(MasterView): row.unit_price_sale ) if row.sale_ends: - sale_ends = row.sale_ends data["sale_ends"] = str(row.sale_ends) data["sale_ends_display"] = self.app.render_date(row.sale_ends) @@ -1552,10 +1550,8 @@ class OrderItemView(MasterView): View which changes status for an order item. This is POST-only; will redirect back to the item view. """ - model = self.app.model enum = self.app.enum main_item = self.get_instance() - session = self.Session() redirect = self.redirect(self.get_action_url("view", main_item)) extra_note = self.request.POST.get("note") diff --git a/src/sideshow/web/views/products.py b/src/sideshow/web/views/products.py index a205977..b0d52f0 100644 --- a/src/sideshow/web/views/products.py +++ b/src/sideshow/web/views/products.py @@ -108,7 +108,6 @@ class LocalProductView(MasterView): def configure_form(self, f): """ """ super().configure_form(f) - enum = self.app.enum product = f.model_instance # external_id @@ -322,7 +321,6 @@ class PendingProductView(MasterView): def configure_form(self, f): """ """ super().configure_form(f) - enum = self.app.enum product = f.model_instance # product_id From 4194d20988c9091eb41cfba78714eae7c4896e77 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 13:59:49 -0500 Subject: [PATCH 03/29] fix: fix 'unused-import' for pylint --- .pylintrc | 1 - src/sideshow/web/views/orders.py | 10 +--------- src/sideshow/web/views/products.py | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.pylintrc b/.pylintrc index 3bda06f..5476de1 100644 --- a/.pylintrc +++ b/.pylintrc @@ -31,4 +31,3 @@ disable=fixme, too-many-public-methods, unnecessary-lambda-assignment, unused-argument, - unused-import, diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 2d05d5e..5dc72c4 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -29,24 +29,16 @@ import json import logging import re -import colander import sqlalchemy as sa from sqlalchemy import orm from webhelpers2.html import tags, HTML from wuttaweb.views import MasterView -from wuttaweb.forms.schema import ( - UserRef, - WuttaMoney, - WuttaQuantity, - WuttaEnum, - WuttaDictEnum, -) +from wuttaweb.forms.schema import UserRef, WuttaMoney, WuttaQuantity, WuttaDictEnum from wuttaweb.util import make_json_safe from sideshow.db.model import Order, OrderItem -from sideshow.batch.neworder import NewOrderBatchHandler from sideshow.web.forms.schema import ( OrderRef, LocalCustomerRef, diff --git a/src/sideshow/web/views/products.py b/src/sideshow/web/views/products.py index b0d52f0..ef7fc2d 100644 --- a/src/sideshow/web/views/products.py +++ b/src/sideshow/web/views/products.py @@ -25,7 +25,7 @@ Views for Products """ from wuttaweb.views import MasterView -from wuttaweb.forms.schema import UserRef, WuttaEnum, WuttaMoney, WuttaQuantity +from wuttaweb.forms.schema import UserRef, WuttaMoney, WuttaQuantity from sideshow.enum import PendingProductStatus from sideshow.db.model import LocalProduct, PendingProduct From 2e248adb827acd335a75f9b3d1d3538b3f1643f1 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:07:38 -0500 Subject: [PATCH 04/29] fix: fix 'unused-argument' for pylint --- .pylintrc | 1 - src/sideshow/app.py | 4 ++-- src/sideshow/batch/neworder.py | 18 ++++++++++++------ src/sideshow/web/app.py | 2 +- src/sideshow/web/menus.py | 14 +++++++------- src/sideshow/web/views/orders.py | 20 ++++++++++---------- src/sideshow/web/views/products.py | 2 +- src/sideshow/web/views/stores.py | 2 +- 8 files changed, 34 insertions(+), 29 deletions(-) diff --git a/.pylintrc b/.pylintrc index 5476de1..79bcb87 100644 --- a/.pylintrc +++ b/.pylintrc @@ -30,4 +30,3 @@ disable=fixme, too-many-positional-arguments, too-many-public-methods, unnecessary-lambda-assignment, - unused-argument, diff --git a/src/sideshow/app.py b/src/sideshow/app.py index ec2f85a..bbe24a6 100644 --- a/src/sideshow/app.py +++ b/src/sideshow/app.py @@ -2,7 +2,7 @@ ################################################################################ # # Sideshow -- Case/Special Order Tracker -# Copyright © 2024 Lance Edgar +# Copyright © 2024-2025 Lance Edgar # # This file is part of Sideshow. # @@ -35,7 +35,7 @@ class SideshowAppProvider(base.AppProvider): handler`. """ - def get_order_handler(self, **kwargs): + def get_order_handler(self): """ Get the configured :term:`order handler` for the app. diff --git a/src/sideshow/batch/neworder.py b/src/sideshow/batch/neworder.py index 11dac0b..292dc8e 100644 --- a/src/sideshow/batch/neworder.py +++ b/src/sideshow/batch/neworder.py @@ -137,7 +137,9 @@ class NewOrderBatchHandler(BatchHandler): """ raise NotImplementedError - def autocomplete_customers_local(self, session, term, user=None): + def autocomplete_customers_local( # pylint: disable=unused-argument + self, session, term, user=None + ): """ Return autocomplete search results for :class:`~sideshow.db.model.customers.LocalCustomer` records. @@ -343,7 +345,9 @@ class NewOrderBatchHandler(BatchHandler): """ raise NotImplementedError - def autocomplete_products_local(self, session, term, user=None): + def autocomplete_products_local( # pylint: disable=unused-argument + self, session, term, user=None + ): """ Return autocomplete search results for :class:`~sideshow.db.model.products.LocalProduct` records. @@ -468,7 +472,9 @@ class NewOrderBatchHandler(BatchHandler): """ raise NotImplementedError - def get_product_info_local(self, session, uuid, user=None): + def get_product_info_local( # pylint: disable=unused-argument + self, session, uuid, user=None + ): """ Returns basic info for a :term:`local product` as pertains to ordering. @@ -1187,7 +1193,7 @@ class NewOrderBatchHandler(BatchHandler): session.flush() - def make_new_order(self, batch, rows, user=None, progress=None, **kwargs): + def make_new_order(self, batch, rows, user=None, progress=None): """ Create a new :term:`order` from the batch data. @@ -1252,7 +1258,7 @@ class NewOrderBatchHandler(BatchHandler): session.add(order) session.flush() - def convert(row, i): + def convert(row, i): # pylint: disable=unused-argument # make order item kw = dict([(field, getattr(row, field)) for field in row_fields]) @@ -1268,7 +1274,7 @@ class NewOrderBatchHandler(BatchHandler): session.flush() return order - def set_initial_item_status(self, item, user, **kwargs): + def set_initial_item_status(self, item, user): """ Set the initial status and attach event(s) for the given item. diff --git a/src/sideshow/web/app.py b/src/sideshow/web/app.py index 1b1e448..11e29db 100644 --- a/src/sideshow/web/app.py +++ b/src/sideshow/web/app.py @@ -27,7 +27,7 @@ Sideshow web app from wuttaweb import app as base -def main(global_config, **settings): +def main(global_config, **settings): # pylint: disable=unused-argument """ Make and return the WSGI app (Paste entry point). """ diff --git a/src/sideshow/web/menus.py b/src/sideshow/web/menus.py index 14fb027..0ef3d70 100644 --- a/src/sideshow/web/menus.py +++ b/src/sideshow/web/menus.py @@ -2,7 +2,7 @@ ################################################################################ # # Sideshow -- Case/Special Order Tracker -# Copyright © 2024 Lance Edgar +# Copyright © 2024-2025 Lance Edgar # # This file is part of Sideshow. # @@ -32,7 +32,7 @@ class SideshowMenuHandler(base.MenuHandler): Sideshow menu handler """ - def make_menus(self, request, **kwargs): + def make_menus(self, request): """ """ return [ self.make_orders_menu(request), @@ -43,7 +43,7 @@ class SideshowMenuHandler(base.MenuHandler): self.make_admin_menu(request), ] - def make_orders_menu(self, request, **kwargs): + def make_orders_menu(self, request): # pylint: disable=unused-argument """ Generate the Orders menu. """ @@ -91,7 +91,7 @@ class SideshowMenuHandler(base.MenuHandler): ], } - def make_customers_menu(self, request, **kwargs): + def make_customers_menu(self, request): # pylint: disable=unused-argument """ Generate the Customers menu. """ @@ -112,7 +112,7 @@ class SideshowMenuHandler(base.MenuHandler): ], } - def make_products_menu(self, request, **kwargs): + def make_products_menu(self, request): # pylint: disable=unused-argument """ Generate the Products menu. """ @@ -133,7 +133,7 @@ class SideshowMenuHandler(base.MenuHandler): ], } - def make_batch_menu(self, request, **kwargs): + def make_batch_menu(self, request): # pylint: disable=unused-argument """ Generate the Batch menu. """ @@ -149,7 +149,7 @@ class SideshowMenuHandler(base.MenuHandler): ], } - def make_other_menu(self, request, **kwargs): + def make_other_menu(self, request): # pylint: disable=unused-argument """ Generate the "Other" menu. """ diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 5dc72c4..2f64e77 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -590,7 +590,7 @@ class OrderView(MasterView): self.batch_handler.set_customer(batch, customer_id) return self.get_context_customer(batch) - def unassign_customer(self, batch, data): + def unassign_customer(self, batch, data): # pylint: disable=unused-argument """ Clear the customer info for a batch. @@ -624,7 +624,7 @@ class OrderView(MasterView): self.batch_handler.set_customer(batch, data, user=self.request.user) return self.get_context_customer(batch) - def get_product_info(self, batch, data): + def get_product_info(self, batch, data): # pylint: disable=unused-argument """ Fetch data for a specific product. @@ -698,7 +698,7 @@ class OrderView(MasterView): return data - def get_past_products(self, batch, data): + def get_past_products(self, batch, data): # pylint: disable=unused-argument """ Fetch past products for convenient re-ordering. @@ -793,7 +793,7 @@ class OrderView(MasterView): self.batch_handler.do_remove_row(row) return {"batch": self.normalize_batch(batch)} - def submit_order(self, batch, data): + def submit_order(self, batch, data): # pylint: disable=unused-argument """ This submits the user's current new order batch, hence executing the batch and creating the true order. @@ -1041,13 +1041,13 @@ class OrderView(MasterView): # TODO: upstream should set this automatically g.row_class = self.row_grid_row_class - def row_grid_row_class(self, item, data, i): + def row_grid_row_class(self, item, data, i): # pylint: disable=unused-argument """ """ variant = self.order_handler.item_status_to_variant(item.status_code) if variant: return f"has-background-{variant}" - def render_status_code(self, item, key, value): + def render_status_code(self, item, key, value): # pylint: disable=unused-argument """ """ enum = self.app.enum return enum.ORDER_ITEM_STATUS[value] @@ -1381,17 +1381,17 @@ class OrderItemView(MasterView): # status_code g.set_renderer("status_code", self.render_status_code) - def render_order_attr(self, item, key, value): + def render_order_attr(self, item, key, value): # pylint: disable=unused-argument """ """ order = item.order return getattr(order, key) - def render_status_code(self, item, key, value): + def render_status_code(self, item, key, value): # pylint: disable=unused-argument """ """ enum = self.app.enum return enum.ORDER_ITEM_STATUS[value] - def grid_row_class(self, item, data, i): + def grid_row_class(self, item, data, i): # pylint: disable=unused-argument """ """ variant = self.order_handler.item_status_to_variant(item.status_code) if variant: @@ -1495,7 +1495,7 @@ class OrderItemView(MasterView): return context - def render_event_note(self, event, key, value): + def render_event_note(self, event, key, value): # pylint: disable=unused-argument """ """ enum = self.app.enum if event.type_code == enum.ORDER_ITEM_EVENT_NOTE_ADDED: diff --git a/src/sideshow/web/views/products.py b/src/sideshow/web/views/products.py index ef7fc2d..1d1ee76 100644 --- a/src/sideshow/web/views/products.py +++ b/src/sideshow/web/views/products.py @@ -312,7 +312,7 @@ class PendingProductView(MasterView): g.set_link("description") g.set_link("size") - def grid_row_class(self, product, data, i): + def grid_row_class(self, product, data, i): # pylint: disable=unused-argument """ """ enum = self.app.enum if product.status == enum.PendingProductStatus.IGNORED: diff --git a/src/sideshow/web/views/stores.py b/src/sideshow/web/views/stores.py index 13282c9..4c3c1df 100644 --- a/src/sideshow/web/views/stores.py +++ b/src/sideshow/web/views/stores.py @@ -64,7 +64,7 @@ class StoreView(MasterView): g.set_link("store_id") g.set_link("name") - def grid_row_class(self, store, data, i): + def grid_row_class(self, store, data, i): # pylint: disable=unused-argument """ """ if store.archived: return "has-background-warning" From 625a22c83ba048874e2a13e597ae0f234f28a1f3 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:13:02 -0500 Subject: [PATCH 05/29] fix: fix 'unnecessary-lambda-assignment' for pylint --- .pylintrc | 1 - src/sideshow/web/views/customers.py | 36 ++++++++++++++++------------- src/sideshow/web/views/products.py | 36 ++++++++++++++++------------- tests/web/views/test_customers.py | 20 ++++++++++++++++ tests/web/views/test_products.py | 20 ++++++++++++++++ 5 files changed, 80 insertions(+), 33 deletions(-) diff --git a/.pylintrc b/.pylintrc index 79bcb87..a0f7d85 100644 --- a/.pylintrc +++ b/.pylintrc @@ -29,4 +29,3 @@ disable=fixme, too-many-locals, too-many-positional-arguments, too-many-public-methods, - unnecessary-lambda-assignment, diff --git a/src/sideshow/web/views/customers.py b/src/sideshow/web/views/customers.py index eeaf766..4076ab5 100644 --- a/src/sideshow/web/views/customers.py +++ b/src/sideshow/web/views/customers.py @@ -138,10 +138,11 @@ class LocalCustomerView(MasterView): grid.set_renderer("total_price", grid.render_currency) if self.request.has_perm("orders.view"): - url = lambda order, i: self.request.route_url( - "orders.view", uuid=order.uuid - ) - grid.add_action("view", icon="eye", url=url) + + def view_url(order, i): # pylint: disable=unused-argument + return self.request.route_url("orders.view", uuid=order.uuid) + + grid.add_action("view", icon="eye", url=view_url) grid.set_link("order_id") return grid @@ -174,10 +175,11 @@ class LocalCustomerView(MasterView): ) if self.request.has_perm("neworder_batches.view"): - url = lambda batch, i: self.request.route_url( - "neworder_batches.view", uuid=batch.uuid - ) - grid.add_action("view", icon="eye", url=url) + + def view_url(batch, i): # pylint: disable=unused-argument + return self.request.route_url("neworder_batches.view", uuid=batch.uuid) + + grid.add_action("view", icon="eye", url=view_url) grid.set_link("id") return grid @@ -328,10 +330,11 @@ class PendingCustomerView(MasterView): grid.set_renderer("total_price", grid.render_currency) if self.request.has_perm("orders.view"): - url = lambda order, i: self.request.route_url( - "orders.view", uuid=order.uuid - ) - grid.add_action("view", icon="eye", url=url) + + def view_url(order, i): # pylint: disable=unused-argument + return self.request.route_url("orders.view", uuid=order.uuid) + + grid.add_action("view", icon="eye", url=view_url) grid.set_link("order_id") return grid @@ -364,10 +367,11 @@ class PendingCustomerView(MasterView): ) if self.request.has_perm("neworder_batches.view"): - url = lambda batch, i: self.request.route_url( - "neworder_batches.view", uuid=batch.uuid - ) - grid.add_action("view", icon="eye", url=url) + + def view_url(batch, i): # pylint: disable=unused-argument + return self.request.route_url("neworder_batches.view", uuid=batch.uuid) + + grid.add_action("view", icon="eye", url=view_url) grid.set_link("id") return grid diff --git a/src/sideshow/web/views/products.py b/src/sideshow/web/views/products.py index 1d1ee76..9127d89 100644 --- a/src/sideshow/web/views/products.py +++ b/src/sideshow/web/views/products.py @@ -176,10 +176,11 @@ class LocalProductView(MasterView): ) if self.request.has_perm("orders.view"): - url = lambda order, i: self.request.route_url( - "orders.view", uuid=order.uuid - ) - grid.add_action("view", icon="eye", url=url) + + def view_url(order, i): # pylint: disable=unused-argument + return self.request.route_url("orders.view", uuid=order.uuid) + + grid.add_action("view", icon="eye", url=view_url) grid.set_link("order_id") return grid @@ -215,10 +216,11 @@ class LocalProductView(MasterView): ) if self.request.has_perm("neworder_batches.view"): - url = lambda batch, i: self.request.route_url( - "neworder_batches.view", uuid=batch.uuid - ) - grid.add_action("view", icon="eye", url=url) + + def view_url(batch, i): # pylint: disable=unused-argument + return self.request.route_url("neworder_batches.view", uuid=batch.uuid) + + grid.add_action("view", icon="eye", url=view_url) grid.set_link("id") return grid @@ -389,10 +391,11 @@ class PendingProductView(MasterView): ) if self.request.has_perm("orders.view"): - url = lambda order, i: self.request.route_url( - "orders.view", uuid=order.uuid - ) - grid.add_action("view", icon="eye", url=url) + + def view_url(order, i): # pylint: disable=unused-argument + return self.request.route_url("orders.view", uuid=order.uuid) + + grid.add_action("view", icon="eye", url=view_url) grid.set_link("order_id") return grid @@ -428,10 +431,11 @@ class PendingProductView(MasterView): ) if self.request.has_perm("neworder_batches.view"): - url = lambda batch, i: self.request.route_url( - "neworder_batches.view", uuid=batch.uuid - ) - grid.add_action("view", icon="eye", url=url) + + def view_url(batch, i): # pylint: disable=unused-argument + return self.request.route_url("neworder_batches.view", uuid=batch.uuid) + + grid.add_action("view", icon="eye", url=view_url) grid.set_link("id") return grid diff --git a/tests/web/views/test_customers.py b/tests/web/views/test_customers.py index e5bd05d..a2096d2 100644 --- a/tests/web/views/test_customers.py +++ b/tests/web/views/test_customers.py @@ -58,6 +58,7 @@ class TestLocalCustomerView(WebTestCase): self.assertIn("new_order_batches", form) def test_make_orders_grid(self): + self.pyramid_config.add_route("orders.view", "/orders/{uuid}/view") model = self.app.model view = self.make_view() @@ -79,7 +80,13 @@ class TestLocalCustomerView(WebTestCase): self.assertEqual(len(grid.actions), 1) self.assertEqual(grid.actions[0].key, "view") + # render grid for coverage generating url + grid.render_vue_template() + def test_make_new_order_batches_grid(self): + self.pyramid_config.add_route( + "neworder_batches.view", "/batch/neworder/{uuid}/view" + ) model = self.app.model handler = NewOrderBatchHandler(self.config) view = self.make_view() @@ -104,6 +111,9 @@ class TestLocalCustomerView(WebTestCase): self.assertEqual(len(grid.actions), 1) self.assertEqual(grid.actions[0].key, "view") + # render grid for coverage generating url + grid.render_vue_template() + def test_objectify(self): model = self.app.model view = self.make_view() @@ -178,6 +188,7 @@ class TestPendingCustomerView(WebTestCase): self.assertIn("new_order_batches", form) def test_make_orders_grid(self): + self.pyramid_config.add_route("orders.view", "/orders/{uuid}/view") model = self.app.model enum = self.app.enum view = self.make_view() @@ -202,7 +213,13 @@ class TestPendingCustomerView(WebTestCase): self.assertEqual(len(grid.actions), 1) self.assertEqual(grid.actions[0].key, "view") + # render grid for coverage generating url + grid.render_vue_template() + def test_make_new_order_batches_grid(self): + self.pyramid_config.add_route( + "neworder_batches.view", "/batch/neworder/{uuid}/view" + ) model = self.app.model enum = self.app.enum handler = NewOrderBatchHandler(self.config) @@ -230,6 +247,9 @@ class TestPendingCustomerView(WebTestCase): self.assertEqual(len(grid.actions), 1) self.assertEqual(grid.actions[0].key, "view") + # render grid for coverage generating url + grid.render_vue_template() + def test_objectify(self): model = self.app.model enum = self.app.enum diff --git a/tests/web/views/test_products.py b/tests/web/views/test_products.py index da467ec..de17a8b 100644 --- a/tests/web/views/test_products.py +++ b/tests/web/views/test_products.py @@ -60,6 +60,7 @@ class TestLocalProductView(WebTestCase): self.assertIn("local_products.view.orders", form.grid_vue_context) def test_make_orders_grid(self): + self.pyramid_config.add_route("orders.view", "/orders/{uuid}/view") model = self.app.model enum = self.app.enum view = self.make_view() @@ -89,7 +90,13 @@ class TestLocalProductView(WebTestCase): self.assertEqual(len(grid.actions), 1) self.assertEqual(grid.actions[0].key, "view") + # render grid for coverage generating url + grid.render_vue_template() + def test_make_new_order_batches_grid(self): + self.pyramid_config.add_route( + "neworder_batches.view", "/batch/neworder/{uuid}/view" + ) model = self.app.model enum = self.app.enum handler = NewOrderBatchHandler(self.config) @@ -117,6 +124,9 @@ class TestLocalProductView(WebTestCase): self.assertEqual(len(grid.actions), 1) self.assertEqual(grid.actions[0].key, "view") + # render grid for coverage generating url + grid.render_vue_template() + class TestPendingProductView(WebTestCase): @@ -178,6 +188,7 @@ class TestPendingProductView(WebTestCase): self.assertIn("created_by", form) def test_make_orders_grid(self): + self.pyramid_config.add_route("orders.view", "/orders/{uuid}/view") model = self.app.model enum = self.app.enum view = self.make_view() @@ -209,7 +220,13 @@ class TestPendingProductView(WebTestCase): self.assertEqual(len(grid.actions), 1) self.assertEqual(grid.actions[0].key, "view") + # render grid for coverage generating url + grid.render_vue_template() + def test_make_new_order_batches_grid(self): + self.pyramid_config.add_route( + "neworder_batches.view", "/batch/neworder/{uuid}/view" + ) model = self.app.model enum = self.app.enum handler = NewOrderBatchHandler(self.config) @@ -239,6 +256,9 @@ class TestPendingProductView(WebTestCase): self.assertEqual(len(grid.actions), 1) self.assertEqual(grid.actions[0].key, "view") + # render grid for coverage generating url + grid.render_vue_template() + def test_get_template_context(self): enum = self.app.enum model = self.app.model From fee44b455a2ad6a8edb5f6be73bdebb303ca7459 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:14:29 -0500 Subject: [PATCH 06/29] fix: fix 'too-many-public-methods' for pylint --- .pylintrc | 1 - src/sideshow/batch/neworder.py | 2 +- src/sideshow/web/views/orders.py | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.pylintrc b/.pylintrc index a0f7d85..7349811 100644 --- a/.pylintrc +++ b/.pylintrc @@ -28,4 +28,3 @@ disable=fixme, too-many-lines, too-many-locals, too-many-positional-arguments, - too-many-public-methods, diff --git a/src/sideshow/batch/neworder.py b/src/sideshow/batch/neworder.py index 292dc8e..0c6cb8c 100644 --- a/src/sideshow/batch/neworder.py +++ b/src/sideshow/batch/neworder.py @@ -35,7 +35,7 @@ from wuttjamaican.batch import BatchHandler from sideshow.db.model import NewOrderBatch -class NewOrderBatchHandler(BatchHandler): +class NewOrderBatchHandler(BatchHandler): # pylint: disable=too-many-public-methods """ The :term:`batch handler` for :term:`new order batches `. diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 2f64e77..7e2bba3 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -51,7 +51,7 @@ from sideshow.web.forms.schema import ( log = logging.getLogger(__name__) -class OrderView(MasterView): +class OrderView(MasterView): # pylint: disable=too-many-public-methods """ Master view for :class:`~sideshow.db.model.orders.Order`; route prefix is ``orders``. From 93855e79d1b9d1305beae6fb578f23363fe023c9 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:16:37 -0500 Subject: [PATCH 07/29] fix: fix 'too-many-arguments' for pylint --- .pylintrc | 2 -- src/sideshow/batch/neworder.py | 4 ++-- src/sideshow/orders.py | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.pylintrc b/.pylintrc index 7349811..dc27f05 100644 --- a/.pylintrc +++ b/.pylintrc @@ -23,8 +23,6 @@ disable=fixme, redefined-outer-name, singleton-comparison, too-few-public-methods, - too-many-arguments, too-many-branches, too-many-lines, too-many-locals, - too-many-positional-arguments, diff --git a/src/sideshow/batch/neworder.py b/src/sideshow/batch/neworder.py index 0c6cb8c..e6b2e07 100644 --- a/src/sideshow/batch/neworder.py +++ b/src/sideshow/batch/neworder.py @@ -655,7 +655,7 @@ class NewOrderBatchHandler(BatchHandler): # pylint: disable=too-many-public-met return products - def add_item( + def add_item( # pylint: disable=too-many-arguments,too-many-positional-arguments self, batch, product_info, @@ -766,7 +766,7 @@ class NewOrderBatchHandler(BatchHandler): # pylint: disable=too-many-public-met session.flush() return row - def update_item( + def update_item( # pylint: disable=too-many-arguments,too-many-positional-arguments self, row, product_info, order_qty, order_uom, discount_percent=None, user=None ): """ diff --git a/src/sideshow/orders.py b/src/sideshow/orders.py index b0e639e..42ed77d 100644 --- a/src/sideshow/orders.py +++ b/src/sideshow/orders.py @@ -183,7 +183,7 @@ class OrderHandler(GenericHandler): if note: item.add_event(enum.ORDER_ITEM_EVENT_NOTE_ADDED, user, note=note) - def process_placement( + def process_placement( # pylint: disable=too-many-arguments,too-many-positional-arguments self, items, user, vendor_name=None, po_number=None, note=None ): """ @@ -226,7 +226,7 @@ class OrderHandler(GenericHandler): item.add_event(enum.ORDER_ITEM_EVENT_NOTE_ADDED, user, note=note) item.status_code = enum.ORDER_ITEM_STATUS_PLACED - def process_receiving( + def process_receiving( # pylint: disable=too-many-arguments,too-many-positional-arguments self, items, user, From e5dbc4a98cecb6bd8ff159a7646e85067188d55d Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:17:23 -0500 Subject: [PATCH 08/29] fix: fix 'too-many-locals' for pylint --- .pylintrc | 1 - src/sideshow/batch/neworder.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.pylintrc b/.pylintrc index dc27f05..b244e0f 100644 --- a/.pylintrc +++ b/.pylintrc @@ -25,4 +25,3 @@ disable=fixme, too-few-public-methods, too-many-branches, too-many-lines, - too-many-locals, diff --git a/src/sideshow/batch/neworder.py b/src/sideshow/batch/neworder.py index e6b2e07..4b484ae 100644 --- a/src/sideshow/batch/neworder.py +++ b/src/sideshow/batch/neworder.py @@ -655,7 +655,7 @@ class NewOrderBatchHandler(BatchHandler): # pylint: disable=too-many-public-met return products - def add_item( # pylint: disable=too-many-arguments,too-many-positional-arguments + def add_item( # pylint: disable=too-many-arguments,too-many-positional-arguments,too-many-locals self, batch, product_info, From becf4fa822be89d05562b91c2bf480460b8a56b1 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:18:21 -0500 Subject: [PATCH 09/29] fix: fix 'too-many-lines' for pylint --- .pylintrc | 1 - src/sideshow/batch/neworder.py | 1 + src/sideshow/web/views/orders.py | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index b244e0f..941e807 100644 --- a/.pylintrc +++ b/.pylintrc @@ -24,4 +24,3 @@ disable=fixme, singleton-comparison, too-few-public-methods, too-many-branches, - too-many-lines, diff --git a/src/sideshow/batch/neworder.py b/src/sideshow/batch/neworder.py index 4b484ae..38d07b9 100644 --- a/src/sideshow/batch/neworder.py +++ b/src/sideshow/batch/neworder.py @@ -23,6 +23,7 @@ """ New Order Batch Handler """ +# pylint: disable=too-many-lines import datetime import decimal diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 7e2bba3..6f41034 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -23,6 +23,7 @@ """ Views for Orders """ +# pylint: disable=too-many-lines import decimal import json From a4c9e3070c9b617edfa021380d9d826669587535 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:20:09 -0500 Subject: [PATCH 10/29] fix: fix 'too-many-branches' for pylint --- .pylintrc | 1 - src/sideshow/batch/neworder.py | 2 +- src/sideshow/web/views/orders.py | 4 +++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.pylintrc b/.pylintrc index 941e807..2388fdc 100644 --- a/.pylintrc +++ b/.pylintrc @@ -23,4 +23,3 @@ disable=fixme, redefined-outer-name, singleton-comparison, too-few-public-methods, - too-many-branches, diff --git a/src/sideshow/batch/neworder.py b/src/sideshow/batch/neworder.py index 38d07b9..f445f4f 100644 --- a/src/sideshow/batch/neworder.py +++ b/src/sideshow/batch/neworder.py @@ -871,7 +871,7 @@ class NewOrderBatchHandler(BatchHandler): # pylint: disable=too-many-public-met # refresh per new info self.refresh_row(row) - def refresh_row(self, row): + def refresh_row(self, row): # pylint: disable=too-many-branches """ Refresh data for the row. This is called when adding a new row to the batch, or anytime the row is updated (e.g. when diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 6f41034..ebdba40 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -625,7 +625,9 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods self.batch_handler.set_customer(batch, data, user=self.request.user) return self.get_context_customer(batch) - def get_product_info(self, batch, data): # pylint: disable=unused-argument + def get_product_info( # pylint: disable=unused-argument,too-many-branches + self, batch, data + ): """ Fetch data for a specific product. From e8842637791231d33da6ea0b1e94085a4440c30c Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:22:26 -0500 Subject: [PATCH 11/29] fix: fix 'too-few-public-methods' for pylint --- .pylintrc | 1 - src/sideshow/db/model/customers.py | 12 ++++++++---- src/sideshow/db/model/orders.py | 4 ++-- src/sideshow/db/model/products.py | 8 +++++--- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.pylintrc b/.pylintrc index 2388fdc..ca9a1b2 100644 --- a/.pylintrc +++ b/.pylintrc @@ -22,4 +22,3 @@ disable=fixme, no-self-argument, redefined-outer-name, singleton-comparison, - too-few-public-methods, diff --git a/src/sideshow/db/model/customers.py b/src/sideshow/db/model/customers.py index b106a13..deb081c 100644 --- a/src/sideshow/db/model/customers.py +++ b/src/sideshow/db/model/customers.py @@ -2,7 +2,7 @@ ################################################################################ # # Sideshow -- Case/Special Order Tracker -# Copyright © 2024 Lance Edgar +# Copyright © 2024-2025 Lance Edgar # # This file is part of Sideshow. # @@ -34,7 +34,7 @@ from wuttjamaican.db import model from sideshow.enum import PendingCustomerStatus -class CustomerMixin: +class CustomerMixin: # pylint: disable=too-few-public-methods """ Base class for customer tables. This has shared columns, used by e.g.: @@ -86,7 +86,9 @@ class CustomerMixin: return self.full_name or "" -class LocalCustomer(CustomerMixin, model.Base): +class LocalCustomer( # pylint: disable=too-few-public-methods + CustomerMixin, model.Base +): """ This table contains the :term:`local customer` records. @@ -136,7 +138,9 @@ class LocalCustomer(CustomerMixin, model.Base): ) -class PendingCustomer(CustomerMixin, model.Base): +class PendingCustomer( # pylint: disable=too-few-public-methods + CustomerMixin, model.Base +): """ This table contains the :term:`pending customer` records, used when creating an :term:`order` for new/unknown customer. diff --git a/src/sideshow/db/model/orders.py b/src/sideshow/db/model/orders.py index c5c9218..bab70dc 100644 --- a/src/sideshow/db/model/orders.py +++ b/src/sideshow/db/model/orders.py @@ -33,7 +33,7 @@ from sqlalchemy.ext.orderinglist import ordering_list from wuttjamaican.db import model -class Order(model.Base): +class Order(model.Base): # pylint: disable=too-few-public-methods """ Represents an :term:`order` for a customer. Each order has one or more :attr:`items`. @@ -542,7 +542,7 @@ class OrderItem(model.Base): self.events.append(OrderItemEvent(**kwargs)) -class OrderItemEvent(model.Base): +class OrderItemEvent(model.Base): # pylint: disable=too-few-public-methods """ An event in the life of an :term:`order item`. """ diff --git a/src/sideshow/db/model/products.py b/src/sideshow/db/model/products.py index 6842104..1a90b69 100644 --- a/src/sideshow/db/model/products.py +++ b/src/sideshow/db/model/products.py @@ -2,7 +2,7 @@ ################################################################################ # # Sideshow -- Case/Special Order Tracker -# Copyright © 2024 Lance Edgar +# Copyright © 2024-2025 Lance Edgar # # This file is part of Sideshow. # @@ -179,7 +179,7 @@ class ProductMixin: return self.full_description -class LocalProduct(ProductMixin, model.Base): +class LocalProduct(ProductMixin, model.Base): # pylint: disable=too-few-public-methods """ This table contains the :term:`local product` records. @@ -228,7 +228,9 @@ class LocalProduct(ProductMixin, model.Base): ) -class PendingProduct(ProductMixin, model.Base): +class PendingProduct( # pylint: disable=too-few-public-methods + ProductMixin, model.Base +): """ This table contains the :term:`pending product` records, used when creating an :term:`order` for new/unknown product(s). From d2b5dce8e34237294402315d3bc0a4fc467635b0 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:32:22 -0500 Subject: [PATCH 12/29] fix: fix 'singleton-comparison' for pylint --- .pylintrc | 1 - src/sideshow/orders.py | 5 ++++- src/sideshow/web/views/orders.py | 10 ++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.pylintrc b/.pylintrc index ca9a1b2..e0085ba 100644 --- a/.pylintrc +++ b/.pylintrc @@ -21,4 +21,3 @@ disable=fixme, no-member, no-self-argument, redefined-outer-name, - singleton-comparison, diff --git a/src/sideshow/orders.py b/src/sideshow/orders.py index 42ed77d..7ff701a 100644 --- a/src/sideshow/orders.py +++ b/src/sideshow/orders.py @@ -159,7 +159,10 @@ class OrderHandler(GenericHandler): items = ( session.query(model.OrderItem) .filter(model.OrderItem.pending_product == pending_product) - .filter(model.OrderItem.product_id == None) + .filter( + model.OrderItem.product_id # pylint: disable=singleton-comparison + == None + ) .all() ) diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index ebdba40..c1676db 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -284,7 +284,10 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods if context["expose_store_id"]: stores = ( session.query(model.Store) - .filter(model.Store.archived == False) + .filter( + model.Store.archived # pylint: disable=singleton-comparison + == False + ) .order_by(model.Store.store_id) .all() ) @@ -338,7 +341,10 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods batch = ( session.query(model.NewOrderBatch) .filter(model.NewOrderBatch.created_by == user) - .filter(model.NewOrderBatch.executed == None) + .filter( + model.NewOrderBatch.executed # pylint: disable=singleton-comparison + == None + ) .one() ) From 5a0d59ee3658853262d51a44aa3c76c40d960156 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:35:58 -0500 Subject: [PATCH 13/29] fix: fix 'redefined-outer-name' for pylint --- .pylintrc | 1 - src/sideshow/cli/install.py | 6 +++--- src/sideshow/web/views/batch/neworder.py | 4 +++- src/sideshow/web/views/customers.py | 8 ++++++-- src/sideshow/web/views/orders.py | 24 ++++++++++++++++++------ src/sideshow/web/views/products.py | 8 ++++++-- src/sideshow/web/views/stores.py | 4 +++- 7 files changed, 39 insertions(+), 16 deletions(-) diff --git a/.pylintrc b/.pylintrc index e0085ba..aaecedd 100644 --- a/.pylintrc +++ b/.pylintrc @@ -20,4 +20,3 @@ disable=fixme, no-else-return, no-member, no-self-argument, - redefined-outer-name, diff --git a/src/sideshow/cli/install.py b/src/sideshow/cli/install.py index 06231f6..38ebc25 100644 --- a/src/sideshow/cli/install.py +++ b/src/sideshow/cli/install.py @@ -2,7 +2,7 @@ ################################################################################ # # Sideshow -- Case/Special Order Tracker -# Copyright © 2024 Lance Edgar +# Copyright © 2024-2025 Lance Edgar # # This file is part of Sideshow. # @@ -38,10 +38,10 @@ def install( """ config = ctx.parent.wutta_config app = config.get_app() - install = app.get_install_handler( + handler = app.get_install_handler( pkg_name="sideshow", app_title="Sideshow", pypi_name="Sideshow", egg_name="Sideshow", ) - install.run() + handler.run() diff --git a/src/sideshow/web/views/batch/neworder.py b/src/sideshow/web/views/batch/neworder.py index 99ffda5..05fe99f 100644 --- a/src/sideshow/web/views/batch/neworder.py +++ b/src/sideshow/web/views/batch/neworder.py @@ -217,7 +217,9 @@ class NewOrderBatchView(BatchMasterView): def defaults(config, **kwargs): base = globals() - NewOrderBatchView = kwargs.get("NewOrderBatchView", base["NewOrderBatchView"]) + NewOrderBatchView = kwargs.get( # pylint: disable=redefined-outer-name + "NewOrderBatchView", base["NewOrderBatchView"] + ) NewOrderBatchView.defaults(config) diff --git a/src/sideshow/web/views/customers.py b/src/sideshow/web/views/customers.py index 4076ab5..0631be4 100644 --- a/src/sideshow/web/views/customers.py +++ b/src/sideshow/web/views/customers.py @@ -415,10 +415,14 @@ class PendingCustomerView(MasterView): def defaults(config, **kwargs): base = globals() - LocalCustomerView = kwargs.get("LocalCustomerView", base["LocalCustomerView"]) + LocalCustomerView = kwargs.get( # pylint: disable=redefined-outer-name + "LocalCustomerView", base["LocalCustomerView"] + ) LocalCustomerView.defaults(config) - PendingCustomerView = kwargs.get("PendingCustomerView", base["PendingCustomerView"]) + PendingCustomerView = kwargs.get( # pylint: disable=redefined-outer-name + "PendingCustomerView", base["PendingCustomerView"] + ) PendingCustomerView.defaults(config) diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index c1676db..1df30a1 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -2372,22 +2372,34 @@ class DeliveryView(OrderItemView): def defaults(config, **kwargs): base = globals() - OrderView = kwargs.get("OrderView", base["OrderView"]) + OrderView = kwargs.get( # pylint: disable=redefined-outer-name + "OrderView", base["OrderView"] + ) OrderView.defaults(config) - OrderItemView = kwargs.get("OrderItemView", base["OrderItemView"]) + OrderItemView = kwargs.get( # pylint: disable=redefined-outer-name + "OrderItemView", base["OrderItemView"] + ) OrderItemView.defaults(config) - PlacementView = kwargs.get("PlacementView", base["PlacementView"]) + PlacementView = kwargs.get( # pylint: disable=redefined-outer-name + "PlacementView", base["PlacementView"] + ) PlacementView.defaults(config) - ReceivingView = kwargs.get("ReceivingView", base["ReceivingView"]) + ReceivingView = kwargs.get( # pylint: disable=redefined-outer-name + "ReceivingView", base["ReceivingView"] + ) ReceivingView.defaults(config) - ContactView = kwargs.get("ContactView", base["ContactView"]) + ContactView = kwargs.get( # pylint: disable=redefined-outer-name + "ContactView", base["ContactView"] + ) ContactView.defaults(config) - DeliveryView = kwargs.get("DeliveryView", base["DeliveryView"]) + DeliveryView = kwargs.get( # pylint: disable=redefined-outer-name + "DeliveryView", base["DeliveryView"] + ) DeliveryView.defaults(config) diff --git a/src/sideshow/web/views/products.py b/src/sideshow/web/views/products.py index 9127d89..2da8225 100644 --- a/src/sideshow/web/views/products.py +++ b/src/sideshow/web/views/products.py @@ -581,10 +581,14 @@ class PendingProductView(MasterView): def defaults(config, **kwargs): base = globals() - LocalProductView = kwargs.get("LocalProductView", base["LocalProductView"]) + LocalProductView = kwargs.get( # pylint: disable=redefined-outer-name + "LocalProductView", base["LocalProductView"] + ) LocalProductView.defaults(config) - PendingProductView = kwargs.get("PendingProductView", base["PendingProductView"]) + PendingProductView = kwargs.get( # pylint: disable=redefined-outer-name + "PendingProductView", base["PendingProductView"] + ) PendingProductView.defaults(config) diff --git a/src/sideshow/web/views/stores.py b/src/sideshow/web/views/stores.py index 4c3c1df..1b07ff7 100644 --- a/src/sideshow/web/views/stores.py +++ b/src/sideshow/web/views/stores.py @@ -111,7 +111,9 @@ class StoreView(MasterView): def defaults(config, **kwargs): base = globals() - StoreView = kwargs.get("StoreView", base["StoreView"]) + StoreView = kwargs.get( # pylint: disable=redefined-outer-name + "StoreView", base["StoreView"] + ) StoreView.defaults(config) From c439bacf4f937dd710abdb2af404be32237f0c8e Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:43:56 -0500 Subject: [PATCH 14/29] fix: fix 'no-self-argument' for pylint --- .pylintrc | 1 - src/sideshow/db/model/batch/neworder.py | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.pylintrc b/.pylintrc index aaecedd..0c97462 100644 --- a/.pylintrc +++ b/.pylintrc @@ -19,4 +19,3 @@ disable=fixme, missing-function-docstring, no-else-return, no-member, - no-self-argument, diff --git a/src/sideshow/db/model/batch/neworder.py b/src/sideshow/db/model/batch/neworder.py index bae0a79..b300a8d 100644 --- a/src/sideshow/db/model/batch/neworder.py +++ b/src/sideshow/db/model/batch/neworder.py @@ -57,7 +57,7 @@ class NewOrderBatch(model.BatchMixin, model.Base): """ @declared_attr - def __table_args__(cls): + def __table_args__(cls): # pylint: disable=no-self-argument return cls.__default_table_args__() + ( sa.ForeignKeyConstraint( ["local_customer_uuid"], ["sideshow_customer_local.uuid"] @@ -95,7 +95,7 @@ class NewOrderBatch(model.BatchMixin, model.Base): local_customer_uuid = sa.Column(model.UUID(), nullable=True) @declared_attr - def local_customer(cls): + def local_customer(cls): # pylint: disable=no-self-argument return orm.relationship( "LocalCustomer", back_populates="new_order_batches", @@ -111,7 +111,7 @@ class NewOrderBatch(model.BatchMixin, model.Base): pending_customer_uuid = sa.Column(model.UUID(), nullable=True) @declared_attr - def pending_customer(cls): + def pending_customer(cls): # pylint: disable=no-self-argument return orm.relationship( "PendingCustomer", back_populates="new_order_batches", @@ -170,7 +170,7 @@ class NewOrderBatchRow(model.BatchRowMixin, model.Base): __batch_class__ = NewOrderBatch @declared_attr - def __table_args__(cls): + def __table_args__(cls): # pylint: disable=no-self-argument return cls.__default_table_args__() + ( sa.ForeignKeyConstraint( ["local_product_uuid"], ["sideshow_product_local.uuid"] @@ -222,7 +222,7 @@ class NewOrderBatchRow(model.BatchRowMixin, model.Base): local_product_uuid = sa.Column(model.UUID(), nullable=True) @declared_attr - def local_product(cls): + def local_product(cls): # pylint: disable=no-self-argument return orm.relationship( "LocalProduct", back_populates="new_order_batch_rows", @@ -238,7 +238,7 @@ class NewOrderBatchRow(model.BatchRowMixin, model.Base): pending_product_uuid = sa.Column(model.UUID(), nullable=True) @declared_attr - def pending_product(cls): + def pending_product(cls): # pylint: disable=no-self-argument return orm.relationship( "PendingProduct", back_populates="new_order_batch_rows", From 258a1ed2874e5e99b6bd45397a80dd211c084074 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:45:16 -0500 Subject: [PATCH 15/29] fix: fix 'no-member' for pylint --- .pylintrc | 1 - src/sideshow/web/views/orders.py | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.pylintrc b/.pylintrc index 0c97462..7c02813 100644 --- a/.pylintrc +++ b/.pylintrc @@ -18,4 +18,3 @@ disable=fixme, missing-class-docstring, missing-function-docstring, no-else-return, - no-member, diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 1df30a1..7bbf231 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -486,9 +486,11 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods * :meth:`cancel_order()` * :meth:`submit_order()` """ + session = self.Session() + # drop current batch self.batch_handler.do_delete(batch, self.request.user) - self.Session.flush() + session.flush() # send back to "create order" which makes new batch route_prefix = self.get_route_prefix() @@ -506,8 +508,10 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods * :meth:`start_over()` * :meth:`submit_order()` """ + session = self.Session() + self.batch_handler.do_delete(batch, self.request.user) - self.Session.flush() + session.flush() # set flash msg just to be more obvious self.request.session.flash("New order has been deleted.") From 1374910d6518fe774b42ebcd0a699752021e98f0 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:46:06 -0500 Subject: [PATCH 16/29] fix: fix 'no-else-return' for pylint --- .pylintrc | 1 - src/sideshow/web/views/orders.py | 14 ++++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.pylintrc b/.pylintrc index 7c02813..ad12f89 100644 --- a/.pylintrc +++ b/.pylintrc @@ -17,4 +17,3 @@ disable=fixme, invalid-name, missing-class-docstring, missing-function-docstring, - no-else-return, diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 7bbf231..55da5cb 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -379,10 +379,9 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods return handler.autocomplete_customers_local( session, term, user=self.request.user ) - else: - return handler.autocomplete_customers_external( - session, term, user=self.request.user - ) + return handler.autocomplete_customers_external( + session, term, user=self.request.user + ) def product_autocomplete(self): """ @@ -407,10 +406,9 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods return handler.autocomplete_products_local( session, term, user=self.request.user ) - else: - return handler.autocomplete_products_external( - session, term, user=self.request.user - ) + return handler.autocomplete_products_external( + session, term, user=self.request.user + ) def get_pending_product_required_fields(self): """ """ From b2beeb4df387c903e210c43d54eb0cc558cc9af2 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:51:13 -0500 Subject: [PATCH 17/29] fix: fix 'missing-class-docstring' and 'missing-function-docstring' for pylint --- .pylintrc | 2 -- src/sideshow/db/model/batch/neworder.py | 18 +++++++++++++----- src/sideshow/testing.py | 4 ++++ src/sideshow/web/__init__.py | 4 ++-- src/sideshow/web/static/__init__.py | 4 ++-- src/sideshow/web/views/__init__.py | 2 +- src/sideshow/web/views/batch/neworder.py | 4 ++-- src/sideshow/web/views/common.py | 2 +- src/sideshow/web/views/customers.py | 4 ++-- src/sideshow/web/views/orders.py | 4 ++-- src/sideshow/web/views/products.py | 4 ++-- src/sideshow/web/views/stores.py | 4 ++-- 12 files changed, 33 insertions(+), 23 deletions(-) diff --git a/.pylintrc b/.pylintrc index ad12f89..a9e1cd7 100644 --- a/.pylintrc +++ b/.pylintrc @@ -15,5 +15,3 @@ disable=fixme, implicit-str-concat, inconsistent-return-statements, invalid-name, - missing-class-docstring, - missing-function-docstring, diff --git a/src/sideshow/db/model/batch/neworder.py b/src/sideshow/db/model/batch/neworder.py index b300a8d..c5dfb94 100644 --- a/src/sideshow/db/model/batch/neworder.py +++ b/src/sideshow/db/model/batch/neworder.py @@ -2,7 +2,7 @@ ################################################################################ # # Sideshow -- Case/Special Order Tracker -# Copyright © 2024 Lance Edgar +# Copyright © 2024-2025 Lance Edgar # # This file is part of Sideshow. # @@ -95,7 +95,9 @@ class NewOrderBatch(model.BatchMixin, model.Base): local_customer_uuid = sa.Column(model.UUID(), nullable=True) @declared_attr - def local_customer(cls): # pylint: disable=no-self-argument + def local_customer( # pylint: disable=no-self-argument,missing-function-docstring + cls, + ): return orm.relationship( "LocalCustomer", back_populates="new_order_batches", @@ -111,7 +113,9 @@ class NewOrderBatch(model.BatchMixin, model.Base): pending_customer_uuid = sa.Column(model.UUID(), nullable=True) @declared_attr - def pending_customer(cls): # pylint: disable=no-self-argument + def pending_customer( # pylint: disable=no-self-argument,missing-function-docstring + cls, + ): return orm.relationship( "PendingCustomer", back_populates="new_order_batches", @@ -222,7 +226,9 @@ class NewOrderBatchRow(model.BatchRowMixin, model.Base): local_product_uuid = sa.Column(model.UUID(), nullable=True) @declared_attr - def local_product(cls): # pylint: disable=no-self-argument + def local_product( # pylint: disable=no-self-argument,missing-function-docstring + cls, + ): return orm.relationship( "LocalProduct", back_populates="new_order_batch_rows", @@ -238,7 +244,9 @@ class NewOrderBatchRow(model.BatchRowMixin, model.Base): pending_product_uuid = sa.Column(model.UUID(), nullable=True) @declared_attr - def pending_product(cls): # pylint: disable=no-self-argument + def pending_product( # pylint: disable=no-self-argument,missing-function-docstring + cls, + ): return orm.relationship( "PendingProduct", back_populates="new_order_batch_rows", diff --git a/src/sideshow/testing.py b/src/sideshow/testing.py index f1fccfd..667df18 100644 --- a/src/sideshow/testing.py +++ b/src/sideshow/testing.py @@ -28,6 +28,10 @@ from wuttaweb import testing as base class WebTestCase(base.WebTestCase): + """ + Custom class for web tests; it configures defaults specific to + Sideshow. + """ def make_config(self, **kwargs): config = super().make_config(**kwargs) diff --git a/src/sideshow/web/__init__.py b/src/sideshow/web/__init__.py index 34f0b6f..61135e5 100644 --- a/src/sideshow/web/__init__.py +++ b/src/sideshow/web/__init__.py @@ -2,7 +2,7 @@ ################################################################################ # # Sideshow -- Case/Special Order Tracker -# Copyright © 2024 Lance Edgar +# Copyright © 2024-2025 Lance Edgar # # This file is part of Sideshow. # @@ -25,7 +25,7 @@ Sideshow web app """ -def includeme(config): +def includeme(config): # pylint: disable=missing-function-docstring config.include("sideshow.web.static") config.include("wuttaweb.subscribers") config.include("sideshow.web.views") diff --git a/src/sideshow/web/static/__init__.py b/src/sideshow/web/static/__init__.py index 43d30aa..651042c 100644 --- a/src/sideshow/web/static/__init__.py +++ b/src/sideshow/web/static/__init__.py @@ -2,7 +2,7 @@ ################################################################################ # # Sideshow -- Case/Special Order Tracker -# Copyright © 2024 Lance Edgar +# Copyright © 2024-2025 Lance Edgar # # This file is part of Sideshow. # @@ -43,6 +43,6 @@ fontawesome_js = Resource(libcache, "fontawesome-5.3.1-all.min.js") # bb_vue_fontawesome_js = Resource(libcache, 'vue-fontawesome-3.0.6.index.es.js') -def includeme(config): +def includeme(config): # pylint: disable=missing-function-docstring config.include("wuttaweb.static") config.add_static_view("sideshow", "sideshow.web:static", cache_max_age=3600) diff --git a/src/sideshow/web/views/__init__.py b/src/sideshow/web/views/__init__.py index 3879f8c..f4550ef 100644 --- a/src/sideshow/web/views/__init__.py +++ b/src/sideshow/web/views/__init__.py @@ -27,7 +27,7 @@ Sideshow Views from wuttaweb.views import essential -def includeme(config): +def includeme(config): # pylint: disable=missing-function-docstring # core views for wuttaweb essential.defaults( diff --git a/src/sideshow/web/views/batch/neworder.py b/src/sideshow/web/views/batch/neworder.py index 05fe99f..115239d 100644 --- a/src/sideshow/web/views/batch/neworder.py +++ b/src/sideshow/web/views/batch/neworder.py @@ -214,7 +214,7 @@ class NewOrderBatchView(BatchMasterView): return buttons -def defaults(config, **kwargs): +def defaults(config, **kwargs): # pylint: disable=missing-function-docstring base = globals() NewOrderBatchView = kwargs.get( # pylint: disable=redefined-outer-name @@ -223,5 +223,5 @@ def defaults(config, **kwargs): NewOrderBatchView.defaults(config) -def includeme(config): +def includeme(config): # pylint: disable=missing-function-docstring defaults(config) diff --git a/src/sideshow/web/views/common.py b/src/sideshow/web/views/common.py index c0debb0..a5da3bd 100644 --- a/src/sideshow/web/views/common.py +++ b/src/sideshow/web/views/common.py @@ -101,5 +101,5 @@ class CommonView(base.CommonView): auth.grant_permission(admin, perm) -def includeme(config): +def includeme(config): # pylint: disable=missing-function-docstring base.defaults(config, **{"CommonView": CommonView}) diff --git a/src/sideshow/web/views/customers.py b/src/sideshow/web/views/customers.py index 0631be4..52bc36b 100644 --- a/src/sideshow/web/views/customers.py +++ b/src/sideshow/web/views/customers.py @@ -412,7 +412,7 @@ class PendingCustomerView(MasterView): super().delete_instance(customer) -def defaults(config, **kwargs): +def defaults(config, **kwargs): # pylint: disable=missing-function-docstring base = globals() LocalCustomerView = kwargs.get( # pylint: disable=redefined-outer-name @@ -426,5 +426,5 @@ def defaults(config, **kwargs): PendingCustomerView.defaults(config) -def includeme(config): +def includeme(config): # pylint: disable=missing-function-docstring defaults(config) diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 55da5cb..b1914ac 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -2371,7 +2371,7 @@ class DeliveryView(OrderItemView): ) -def defaults(config, **kwargs): +def defaults(config, **kwargs): # pylint: disable=missing-function-docstring base = globals() OrderView = kwargs.get( # pylint: disable=redefined-outer-name @@ -2405,5 +2405,5 @@ def defaults(config, **kwargs): DeliveryView.defaults(config) -def includeme(config): +def includeme(config): # pylint: disable=missing-function-docstring defaults(config) diff --git a/src/sideshow/web/views/products.py b/src/sideshow/web/views/products.py index 2da8225..6ead48a 100644 --- a/src/sideshow/web/views/products.py +++ b/src/sideshow/web/views/products.py @@ -578,7 +578,7 @@ class PendingProductView(MasterView): ) -def defaults(config, **kwargs): +def defaults(config, **kwargs): # pylint: disable=missing-function-docstring base = globals() LocalProductView = kwargs.get( # pylint: disable=redefined-outer-name @@ -592,5 +592,5 @@ def defaults(config, **kwargs): PendingProductView.defaults(config) -def includeme(config): +def includeme(config): # pylint: disable=missing-function-docstring defaults(config) diff --git a/src/sideshow/web/views/stores.py b/src/sideshow/web/views/stores.py index 1b07ff7..06c749f 100644 --- a/src/sideshow/web/views/stores.py +++ b/src/sideshow/web/views/stores.py @@ -108,7 +108,7 @@ class StoreView(MasterView): node.raise_invalid("Name must be unique") -def defaults(config, **kwargs): +def defaults(config, **kwargs): # pylint: disable=missing-function-docstring base = globals() StoreView = kwargs.get( # pylint: disable=redefined-outer-name @@ -117,5 +117,5 @@ def defaults(config, **kwargs): StoreView.defaults(config) -def includeme(config): +def includeme(config): # pylint: disable=missing-function-docstring defaults(config) From 281d654e321c4aff5548afa8e7eac70b6d5f5134 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:54:59 -0500 Subject: [PATCH 18/29] fix: fix 'invalid-name' for pylint --- .pylintrc | 1 - src/sideshow/orders.py | 6 +++--- src/sideshow/web/views/batch/neworder.py | 2 +- src/sideshow/web/views/customers.py | 6 +++--- src/sideshow/web/views/orders.py | 12 ++++++------ src/sideshow/web/views/products.py | 6 +++--- src/sideshow/web/views/stores.py | 2 +- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.pylintrc b/.pylintrc index a9e1cd7..ecb5a50 100644 --- a/.pylintrc +++ b/.pylintrc @@ -14,4 +14,3 @@ disable=fixme, empty-docstring, implicit-str-concat, inconsistent-return-statements, - invalid-name, diff --git a/src/sideshow/orders.py b/src/sideshow/orders.py index 7ff701a..7d5cb53 100644 --- a/src/sideshow/orders.py +++ b/src/sideshow/orders.py @@ -72,15 +72,15 @@ class OrderHandler(GenericHandler): else: case_qty = self.app.render_quantity(case_size) unit_qty = self.app.render_quantity(order_qty * case_size) - CS = enum.ORDER_UOM[enum.ORDER_UOM_CASE] - EA = enum.ORDER_UOM[enum.ORDER_UOM_UNIT] + CS = enum.ORDER_UOM[enum.ORDER_UOM_CASE] # pylint: disable=invalid-name + EA = enum.ORDER_UOM[enum.ORDER_UOM_UNIT] # pylint: disable=invalid-name order_qty = self.app.render_quantity(order_qty) times = "×" if html else "x" return f"{order_qty} {CS} ({times} {case_qty} = {unit_qty} {EA})" # units unit_qty = self.app.render_quantity(order_qty) - EA = enum.ORDER_UOM[enum.ORDER_UOM_UNIT] + EA = enum.ORDER_UOM[enum.ORDER_UOM_UNIT] # pylint: disable=invalid-name return f"{unit_qty} {EA}" def item_status_to_variant(self, status_code): diff --git a/src/sideshow/web/views/batch/neworder.py b/src/sideshow/web/views/batch/neworder.py index 115239d..202478c 100644 --- a/src/sideshow/web/views/batch/neworder.py +++ b/src/sideshow/web/views/batch/neworder.py @@ -217,7 +217,7 @@ class NewOrderBatchView(BatchMasterView): def defaults(config, **kwargs): # pylint: disable=missing-function-docstring base = globals() - NewOrderBatchView = kwargs.get( # pylint: disable=redefined-outer-name + NewOrderBatchView = kwargs.get( # pylint: disable=redefined-outer-name,invalid-name "NewOrderBatchView", base["NewOrderBatchView"] ) NewOrderBatchView.defaults(config) diff --git a/src/sideshow/web/views/customers.py b/src/sideshow/web/views/customers.py index 52bc36b..c989af5 100644 --- a/src/sideshow/web/views/customers.py +++ b/src/sideshow/web/views/customers.py @@ -415,13 +415,13 @@ class PendingCustomerView(MasterView): def defaults(config, **kwargs): # pylint: disable=missing-function-docstring base = globals() - LocalCustomerView = kwargs.get( # pylint: disable=redefined-outer-name + LocalCustomerView = kwargs.get( # pylint: disable=redefined-outer-name,invalid-name "LocalCustomerView", base["LocalCustomerView"] ) LocalCustomerView.defaults(config) - PendingCustomerView = kwargs.get( # pylint: disable=redefined-outer-name - "PendingCustomerView", base["PendingCustomerView"] + PendingCustomerView = ( # pylint: disable=redefined-outer-name,invalid-name + kwargs.get("PendingCustomerView", base["PendingCustomerView"]) ) PendingCustomerView.defaults(config) diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index b1914ac..22101a7 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -2374,32 +2374,32 @@ class DeliveryView(OrderItemView): def defaults(config, **kwargs): # pylint: disable=missing-function-docstring base = globals() - OrderView = kwargs.get( # pylint: disable=redefined-outer-name + OrderView = kwargs.get( # pylint: disable=redefined-outer-name,invalid-name "OrderView", base["OrderView"] ) OrderView.defaults(config) - OrderItemView = kwargs.get( # pylint: disable=redefined-outer-name + OrderItemView = kwargs.get( # pylint: disable=redefined-outer-name,invalid-name "OrderItemView", base["OrderItemView"] ) OrderItemView.defaults(config) - PlacementView = kwargs.get( # pylint: disable=redefined-outer-name + PlacementView = kwargs.get( # pylint: disable=redefined-outer-name,invalid-name "PlacementView", base["PlacementView"] ) PlacementView.defaults(config) - ReceivingView = kwargs.get( # pylint: disable=redefined-outer-name + ReceivingView = kwargs.get( # pylint: disable=redefined-outer-name,invalid-name "ReceivingView", base["ReceivingView"] ) ReceivingView.defaults(config) - ContactView = kwargs.get( # pylint: disable=redefined-outer-name + ContactView = kwargs.get( # pylint: disable=redefined-outer-name,invalid-name "ContactView", base["ContactView"] ) ContactView.defaults(config) - DeliveryView = kwargs.get( # pylint: disable=redefined-outer-name + DeliveryView = kwargs.get( # pylint: disable=redefined-outer-name,invalid-name "DeliveryView", base["DeliveryView"] ) DeliveryView.defaults(config) diff --git a/src/sideshow/web/views/products.py b/src/sideshow/web/views/products.py index 6ead48a..2086403 100644 --- a/src/sideshow/web/views/products.py +++ b/src/sideshow/web/views/products.py @@ -581,13 +581,13 @@ class PendingProductView(MasterView): def defaults(config, **kwargs): # pylint: disable=missing-function-docstring base = globals() - LocalProductView = kwargs.get( # pylint: disable=redefined-outer-name + LocalProductView = kwargs.get( # pylint: disable=redefined-outer-name,invalid-name "LocalProductView", base["LocalProductView"] ) LocalProductView.defaults(config) - PendingProductView = kwargs.get( # pylint: disable=redefined-outer-name - "PendingProductView", base["PendingProductView"] + PendingProductView = ( # pylint: disable=redefined-outer-name,invalid-name + kwargs.get("PendingProductView", base["PendingProductView"]) ) PendingProductView.defaults(config) diff --git a/src/sideshow/web/views/stores.py b/src/sideshow/web/views/stores.py index 06c749f..9784ab4 100644 --- a/src/sideshow/web/views/stores.py +++ b/src/sideshow/web/views/stores.py @@ -111,7 +111,7 @@ class StoreView(MasterView): def defaults(config, **kwargs): # pylint: disable=missing-function-docstring base = globals() - StoreView = kwargs.get( # pylint: disable=redefined-outer-name + StoreView = kwargs.get( # pylint: disable=redefined-outer-name,invalid-name "StoreView", base["StoreView"] ) StoreView.defaults(config) From c01f9395f0708da4ba720f4122110effdf6f9e46 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:56:35 -0500 Subject: [PATCH 19/29] fix: fix 'inconsistent-return-statements' for pylint --- .pylintrc | 1 - src/sideshow/batch/neworder.py | 3 +++ src/sideshow/orders.py | 1 + src/sideshow/web/views/orders.py | 2 ++ src/sideshow/web/views/products.py | 1 + src/sideshow/web/views/stores.py | 1 + 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index ecb5a50..e6d4cca 100644 --- a/.pylintrc +++ b/.pylintrc @@ -13,4 +13,3 @@ disable=fixme, consider-using-set-comprehension, empty-docstring, implicit-str-concat, - inconsistent-return-statements, diff --git a/src/sideshow/batch/neworder.py b/src/sideshow/batch/neworder.py index f445f4f..09c07cf 100644 --- a/src/sideshow/batch/neworder.py +++ b/src/sideshow/batch/neworder.py @@ -117,6 +117,7 @@ class NewOrderBatchHandler(BatchHandler): # pylint: disable=too-many-public-met discount = self.config.get("sideshow.orders.default_item_discount") if discount: return decimal.Decimal(discount) + return None def autocomplete_customers_external(self, session, term, user=None): """ @@ -1074,6 +1075,8 @@ class NewOrderBatchHandler(BatchHandler): # pylint: disable=too-many-public-met if not rows: return "Must add at least one valid item" + return None + def get_effective_rows(self, batch): """ Only rows with diff --git a/src/sideshow/orders.py b/src/sideshow/orders.py index 7d5cb53..0222f30 100644 --- a/src/sideshow/orders.py +++ b/src/sideshow/orders.py @@ -105,6 +105,7 @@ class OrderHandler(GenericHandler): enum.ORDER_ITEM_STATUS_INACTIVE, ): return "warning" + return None def resolve_pending_product(self, pending_product, product_info, user, note=None): """ diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 22101a7..44dddf3 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -1057,6 +1057,7 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods variant = self.order_handler.item_status_to_variant(item.status_code) if variant: return f"has-background-{variant}" + return None def render_status_code(self, item, key, value): # pylint: disable=unused-argument """ """ @@ -1407,6 +1408,7 @@ class OrderItemView(MasterView): variant = self.order_handler.item_status_to_variant(item.status_code) if variant: return f"has-background-{variant}" + return None def configure_form(self, f): """ """ diff --git a/src/sideshow/web/views/products.py b/src/sideshow/web/views/products.py index 2086403..4dd58b1 100644 --- a/src/sideshow/web/views/products.py +++ b/src/sideshow/web/views/products.py @@ -319,6 +319,7 @@ class PendingProductView(MasterView): enum = self.app.enum if product.status == enum.PendingProductStatus.IGNORED: return "has-background-warning" + return None def configure_form(self, f): """ """ diff --git a/src/sideshow/web/views/stores.py b/src/sideshow/web/views/stores.py index 9784ab4..247d1c8 100644 --- a/src/sideshow/web/views/stores.py +++ b/src/sideshow/web/views/stores.py @@ -68,6 +68,7 @@ class StoreView(MasterView): """ """ if store.archived: return "has-background-warning" + return None def configure_form(self, f): """ """ From 54602f605deabd166db81d4616f22ab565eb463d Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 14:57:23 -0500 Subject: [PATCH 20/29] fix: fix 'implicit-str-concat' for pylint --- .pylintrc | 1 - src/sideshow/web/views/common.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.pylintrc b/.pylintrc index e6d4cca..56aaac9 100644 --- a/.pylintrc +++ b/.pylintrc @@ -12,4 +12,3 @@ disable=fixme, consider-using-f-string, consider-using-set-comprehension, empty-docstring, - implicit-str-concat, diff --git a/src/sideshow/web/views/common.py b/src/sideshow/web/views/common.py index a5da3bd..ad52738 100644 --- a/src/sideshow/web/views/common.py +++ b/src/sideshow/web/views/common.py @@ -47,7 +47,7 @@ class CommonView(base.CommonView): admin = model.Role(name="Order Admin") admin.notes = ( - "this role was auto-created; " "you can change or remove it as needed." + "this role was auto-created; you can change or remove it as needed." ) session.add(admin) From 8d8f2767934177bcdeeb68db66abc35ca1f6768b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 15:08:09 -0500 Subject: [PATCH 21/29] fix: fix 'empty-docstring' for pylint --- .pylintrc | 1 - src/sideshow/config.py | 4 +- src/sideshow/db/model/orders.py | 2 +- src/sideshow/db/model/products.py | 2 +- src/sideshow/web/forms/schema.py | 32 ++++----- src/sideshow/web/menus.py | 4 +- src/sideshow/web/views/batch/neworder.py | 8 +-- src/sideshow/web/views/customers.py | 14 ++-- src/sideshow/web/views/orders.py | 86 ++++++++++++++---------- src/sideshow/web/views/products.py | 18 ++--- src/sideshow/web/views/stores.py | 12 ++-- 11 files changed, 100 insertions(+), 83 deletions(-) diff --git a/.pylintrc b/.pylintrc index 56aaac9..0f12b83 100644 --- a/.pylintrc +++ b/.pylintrc @@ -11,4 +11,3 @@ disable=fixme, consider-using-dict-comprehension, consider-using-f-string, consider-using-set-comprehension, - empty-docstring, diff --git a/src/sideshow/config.py b/src/sideshow/config.py index e58c368..eb97479 100644 --- a/src/sideshow/config.py +++ b/src/sideshow/config.py @@ -2,7 +2,7 @@ ################################################################################ # # Sideshow -- Case/Special Order Tracker -# Copyright © 2024 Lance Edgar +# Copyright © 2024-2025 Lance Edgar # # This file is part of Sideshow. # @@ -36,7 +36,7 @@ class SideshowConfig(WuttaConfigExtension): key = "sideshow" - def configure(self, config): + def configure(self, config): # pylint: disable=empty-docstring """ """ # app info diff --git a/src/sideshow/db/model/orders.py b/src/sideshow/db/model/orders.py index bab70dc..b0d7f08 100644 --- a/src/sideshow/db/model/orders.py +++ b/src/sideshow/db/model/orders.py @@ -519,7 +519,7 @@ class OrderItem(model.Base): ) @property - def full_description(self): + def full_description(self): # pylint: disable=empty-docstring """ """ fields = [ self.product_brand or "", diff --git a/src/sideshow/db/model/products.py b/src/sideshow/db/model/products.py index 1a90b69..0b11308 100644 --- a/src/sideshow/db/model/products.py +++ b/src/sideshow/db/model/products.py @@ -169,7 +169,7 @@ class ProductMixin: ) @property - def full_description(self): + def full_description(self): # pylint: disable=empty-docstring """ """ fields = [self.brand_name or "", self.description or "", self.size or ""] fields = [f.strip() for f in fields if f.strip()] diff --git a/src/sideshow/web/forms/schema.py b/src/sideshow/web/forms/schema.py index c990523..dbebfc1 100644 --- a/src/sideshow/web/forms/schema.py +++ b/src/sideshow/web/forms/schema.py @@ -2,7 +2,7 @@ ################################################################################ # # Sideshow -- Case/Special Order Tracker -# Copyright © 2024 Lance Edgar +# Copyright © 2024-2025 Lance Edgar # # This file is part of Sideshow. # @@ -37,16 +37,16 @@ class OrderRef(ObjectRef): """ @property - def model_class(self): + def model_class(self): # pylint: disable=empty-docstring """ """ model = self.app.model return model.Order - def sort_query(self, query): + def sort_query(self, query): # pylint: disable=empty-docstring """ """ return query.order_by(self.model_class.order_id) - def get_object_url(self, order): + def get_object_url(self, order): # pylint: disable=empty-docstring """ """ return self.request.route_url("orders.view", uuid=order.uuid) @@ -62,16 +62,16 @@ class LocalCustomerRef(ObjectRef): """ @property - def model_class(self): + def model_class(self): # pylint: disable=empty-docstring """ """ model = self.app.model return model.LocalCustomer - def sort_query(self, query): + def sort_query(self, query): # pylint: disable=empty-docstring """ """ return query.order_by(self.model_class.full_name) - def get_object_url(self, customer): + def get_object_url(self, customer): # pylint: disable=empty-docstring """ """ return self.request.route_url("local_customers.view", uuid=customer.uuid) @@ -87,16 +87,16 @@ class PendingCustomerRef(ObjectRef): """ @property - def model_class(self): + def model_class(self): # pylint: disable=empty-docstring """ """ model = self.app.model return model.PendingCustomer - def sort_query(self, query): + def sort_query(self, query): # pylint: disable=empty-docstring """ """ return query.order_by(self.model_class.full_name) - def get_object_url(self, customer): + def get_object_url(self, customer): # pylint: disable=empty-docstring """ """ return self.request.route_url("pending_customers.view", uuid=customer.uuid) @@ -111,16 +111,16 @@ class LocalProductRef(ObjectRef): """ @property - def model_class(self): + def model_class(self): # pylint: disable=empty-docstring """ """ model = self.app.model return model.LocalProduct - def sort_query(self, query): + def sort_query(self, query): # pylint: disable=empty-docstring """ """ return query.order_by(self.model_class.scancode) - def get_object_url(self, product): + def get_object_url(self, product): # pylint: disable=empty-docstring """ """ return self.request.route_url("local_products.view", uuid=product.uuid) @@ -136,15 +136,15 @@ class PendingProductRef(ObjectRef): """ @property - def model_class(self): + def model_class(self): # pylint: disable=empty-docstring """ """ model = self.app.model return model.PendingProduct - def sort_query(self, query): + def sort_query(self, query): # pylint: disable=empty-docstring """ """ return query.order_by(self.model_class.scancode) - def get_object_url(self, product): + def get_object_url(self, product): # pylint: disable=empty-docstring """ """ return self.request.route_url("pending_products.view", uuid=product.uuid) diff --git a/src/sideshow/web/menus.py b/src/sideshow/web/menus.py index 0ef3d70..18598d4 100644 --- a/src/sideshow/web/menus.py +++ b/src/sideshow/web/menus.py @@ -32,7 +32,7 @@ class SideshowMenuHandler(base.MenuHandler): Sideshow menu handler """ - def make_menus(self, request): + def make_menus(self, request): # pylint: disable=empty-docstring """ """ return [ self.make_orders_menu(request), @@ -159,7 +159,7 @@ class SideshowMenuHandler(base.MenuHandler): "items": [], } - def make_admin_menu(self, request, **kwargs): + def make_admin_menu(self, request, **kwargs): # pylint: disable=empty-docstring """ """ kwargs["include_people"] = True menu = super().make_admin_menu(request, **kwargs) diff --git a/src/sideshow/web/views/batch/neworder.py b/src/sideshow/web/views/batch/neworder.py index 202478c..b46ec20 100644 --- a/src/sideshow/web/views/batch/neworder.py +++ b/src/sideshow/web/views/batch/neworder.py @@ -131,12 +131,12 @@ class NewOrderBatchView(BatchMasterView): super().__init__(request, context=context) self.order_handler = self.app.get_order_handler() - def get_batch_handler(self): + def get_batch_handler(self): # pylint: disable=empty-docstring """ """ # TODO: call self.app.get_batch_handler() return NewOrderBatchHandler(self.config) - def configure_grid(self, g): + def configure_grid(self, g): # pylint: disable=empty-docstring """ """ super().configure_grid(g) @@ -147,7 +147,7 @@ class NewOrderBatchView(BatchMasterView): # total_price g.set_renderer("total_price", "currency") - def configure_form(self, f): + def configure_form(self, f): # pylint: disable=empty-docstring """ """ super().configure_form(f) @@ -164,7 +164,7 @@ class NewOrderBatchView(BatchMasterView): # total_price f.set_node("total_price", WuttaMoney(self.request)) - def configure_row_grid(self, g): + def configure_row_grid(self, g): # pylint: disable=empty-docstring """ """ super().configure_row_grid(g) diff --git a/src/sideshow/web/views/customers.py b/src/sideshow/web/views/customers.py index c989af5..eab6600 100644 --- a/src/sideshow/web/views/customers.py +++ b/src/sideshow/web/views/customers.py @@ -76,7 +76,7 @@ class LocalCustomerView(MasterView): "new_order_batches", ] - def configure_grid(self, g): + def configure_grid(self, g): # pylint: disable=empty-docstring """ """ super().configure_grid(g) @@ -87,7 +87,7 @@ class LocalCustomerView(MasterView): g.set_link("phone_number") g.set_link("email_address") - def configure_form(self, f): + def configure_form(self, f): # pylint: disable=empty-docstring """ """ super().configure_form(f) customer = f.model_instance @@ -184,7 +184,7 @@ class LocalCustomerView(MasterView): return grid - def objectify(self, form): + def objectify(self, form): # pylint: disable=empty-docstring """ """ customer = super().objectify(form) @@ -247,7 +247,7 @@ class PendingCustomerView(MasterView): "new_order_batches", ] - def configure_grid(self, g): + def configure_grid(self, g): # pylint: disable=empty-docstring """ """ super().configure_grid(g) enum = self.app.enum @@ -262,7 +262,7 @@ class PendingCustomerView(MasterView): g.set_link("phone_number") g.set_link("email_address") - def configure_form(self, f): + def configure_form(self, f): # pylint: disable=empty-docstring """ """ super().configure_form(f) enum = self.app.enum @@ -376,7 +376,7 @@ class PendingCustomerView(MasterView): return grid - def objectify(self, form): + def objectify(self, form): # pylint: disable=empty-docstring """ """ enum = self.app.enum customer = super().objectify(form) @@ -387,7 +387,7 @@ class PendingCustomerView(MasterView): return customer - def delete_instance(self, customer): + def delete_instance(self, customer): # pylint: disable=empty-docstring """ """ model_title = self.get_model_title() diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 44dddf3..02eed4e 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -165,7 +165,7 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods self.order_handler = self.app.get_order_handler() self.batch_handler = self.app.get_batch_handler("neworder") - def configure_grid(self, g): + def configure_grid(self, g): # pylint: disable=empty-docstring """ """ super().configure_grid(g) @@ -410,7 +410,7 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods session, term, user=self.request.user ) - def get_pending_product_required_fields(self): + def get_pending_product_required_fields(self): # pylint: disable=empty-docstring """ """ required = [] for field in self.PENDING_PRODUCT_ENTRY_FIELDS: @@ -534,7 +534,7 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods batch.store_id = store_id return self.get_context_customer(batch) - def get_context_customer(self, batch): + def get_context_customer(self, batch): # pylint: disable=empty-docstring """ """ context = { "store_id": batch.store_id, @@ -830,7 +830,7 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods "next_url": self.get_action_url("view", order), } - def normalize_batch(self, batch): + def normalize_batch(self, batch): # pylint: disable=empty-docstring """ """ return { "uuid": batch.uuid.hex, @@ -840,7 +840,7 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods "status_text": batch.status_text, } - def normalize_row(self, row): + def normalize_row(self, row): # pylint: disable=empty-docstring """ """ data = { "uuid": row.uuid.hex, @@ -954,11 +954,11 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods return data - def get_instance_title(self, order): + def get_instance_title(self, order): # pylint: disable=empty-docstring """ """ return f"#{order.order_id} for {order.customer_name}" - def configure_form(self, f): + def configure_form(self, f): # pylint: disable=empty-docstring """ """ super().configure_form(f) order = f.model_instance @@ -986,7 +986,7 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods f.set_node("created_by", UserRef(self.request)) f.set_readonly("created_by") - def get_xref_buttons(self, order): + def get_xref_buttons(self, order): # pylint: disable=empty-docstring """ """ buttons = super().get_xref_buttons(order) model = self.app.model @@ -1008,13 +1008,13 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods return buttons - def get_row_grid_data(self, order): + def get_row_grid_data(self, order): # pylint: disable=empty-docstring """ """ model = self.app.model session = self.Session() return session.query(model.OrderItem).filter(model.OrderItem.order == order) - def configure_row_grid(self, g): + def configure_row_grid(self, g): # pylint: disable=empty-docstring """ """ super().configure_row_grid(g) # enum = self.app.enum @@ -1052,23 +1052,27 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods # TODO: upstream should set this automatically g.row_class = self.row_grid_row_class - def row_grid_row_class(self, item, data, i): # pylint: disable=unused-argument + def row_grid_row_class( # pylint: disable=unused-argument,empty-docstring + self, item, data, i + ): """ """ variant = self.order_handler.item_status_to_variant(item.status_code) if variant: return f"has-background-{variant}" return None - def render_status_code(self, item, key, value): # pylint: disable=unused-argument + def render_status_code( # pylint: disable=unused-argument,empty-docstring + self, item, key, value + ): """ """ enum = self.app.enum return enum.ORDER_ITEM_STATUS[value] - def get_row_action_url_view(self, item, i): + def get_row_action_url_view(self, item, i): # pylint: disable=empty-docstring """ """ return self.request.route_url("order_items.view", uuid=item.uuid) - def configure_get_simple_settings(self): + def configure_get_simple_settings(self): # pylint: disable=empty-docstring """ """ settings = [ # stores @@ -1113,7 +1117,7 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods return settings - def configure_get_context(self, **kwargs): + def configure_get_context(self, **kwargs): # pylint: disable=empty-docstring """ """ context = super().configure_get_context(**kwargs) @@ -1127,7 +1131,9 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods return context - def configure_gather_settings(self, data, simple_settings=None): + def configure_gather_settings( + self, data, simple_settings=None + ): # pylint: disable=empty-docstring """ """ settings = super().configure_gather_settings( data, simple_settings=simple_settings @@ -1150,7 +1156,7 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods return settings - def configure_remove_settings(self, **kwargs): + def configure_remove_settings(self, **kwargs): # pylint: disable=empty-docstring """ """ model = self.app.model session = self.Session() @@ -1331,19 +1337,19 @@ class OrderItemView(MasterView): super().__init__(request, context=context) self.order_handler = self.app.get_order_handler() - def get_fallback_templates(self, template): + def get_fallback_templates(self, template): # pylint: disable=empty-docstring """ """ templates = super().get_fallback_templates(template) templates.insert(0, f"/order-items/{template}.mako") return templates - def get_query(self, session=None): + def get_query(self, session=None): # pylint: disable=empty-docstring """ """ query = super().get_query(session=session) model = self.app.model return query.join(model.Order) - def configure_grid(self, g): + def configure_grid(self, g): # pylint: disable=empty-docstring """ """ super().configure_grid(g) model = self.app.model @@ -1393,24 +1399,30 @@ class OrderItemView(MasterView): # status_code g.set_renderer("status_code", self.render_status_code) - def render_order_attr(self, item, key, value): # pylint: disable=unused-argument + def render_order_attr( # pylint: disable=unused-argument,empty-docstring + self, item, key, value + ): """ """ order = item.order return getattr(order, key) - def render_status_code(self, item, key, value): # pylint: disable=unused-argument + def render_status_code( # pylint: disable=unused-argument,empty-docstring + self, item, key, value + ): """ """ enum = self.app.enum return enum.ORDER_ITEM_STATUS[value] - def grid_row_class(self, item, data, i): # pylint: disable=unused-argument + def grid_row_class( # pylint: disable=unused-argument,empty-docstring + self, item, data, i + ): """ """ variant = self.order_handler.item_status_to_variant(item.status_code) if variant: return f"has-background-{variant}" return None - def configure_form(self, f): + def configure_form(self, f): # pylint: disable=empty-docstring """ """ super().configure_form(f) enum = self.app.enum @@ -1458,7 +1470,7 @@ class OrderItemView(MasterView): # paid_amount f.set_node("paid_amount", WuttaMoney(self.request)) - def get_template_context(self, context): + def get_template_context(self, context): # pylint: disable=empty-docstring """ """ if self.viewing: model = self.app.model @@ -1508,7 +1520,9 @@ class OrderItemView(MasterView): return context - def render_event_note(self, event, key, value): # pylint: disable=unused-argument + def render_event_note( # pylint: disable=unused-argument,empty-docstring + self, event, key, value + ): """ """ enum = self.app.enum if event.type_code == enum.ORDER_ITEM_EVENT_NOTE_ADDED: @@ -1520,7 +1534,7 @@ class OrderItemView(MasterView): ) return value - def get_xref_buttons(self, item): + def get_xref_buttons(self, item): # pylint: disable=empty-docstring """ """ buttons = super().get_xref_buttons(item) @@ -1645,7 +1659,7 @@ class OrderItemView(MasterView): return items @classmethod - def defaults(cls, config): + def defaults(cls, config): # pylint: disable=empty-docstring """ """ cls._order_item_defaults(config) cls._defaults(config) @@ -1745,14 +1759,14 @@ class PlacementView(OrderItemView): "vendor_name": {"active": True}, } - def get_query(self, session=None): + def get_query(self, session=None): # pylint: disable=empty-docstring """ """ query = super().get_query(session=session) model = self.app.model enum = self.app.enum return query.filter(model.OrderItem.status_code == enum.ORDER_ITEM_STATUS_READY) - def configure_grid(self, g): + def configure_grid(self, g): # pylint: disable=empty-docstring """ """ super().configure_grid(g) @@ -1883,7 +1897,7 @@ class ReceivingView(OrderItemView): "vendor_name": {"active": True}, } - def get_query(self, session=None): + def get_query(self, session=None): # pylint: disable=empty-docstring """ """ query = super().get_query(session=session) model = self.app.model @@ -1892,7 +1906,7 @@ class ReceivingView(OrderItemView): model.OrderItem.status_code == enum.ORDER_ITEM_STATUS_PLACED ) - def configure_grid(self, g): + def configure_grid(self, g): # pylint: disable=empty-docstring """ """ super().configure_grid(g) @@ -2064,7 +2078,7 @@ class ContactView(OrderItemView): route_prefix = "order_items_contact" url_prefix = "/contact" - def get_query(self, session=None): + def get_query(self, session=None): # pylint: disable=empty-docstring """ """ query = super().get_query(session=session) model = self.app.model @@ -2075,7 +2089,7 @@ class ContactView(OrderItemView): ) ) - def configure_grid(self, g): + def configure_grid(self, g): # pylint: disable=empty-docstring """ """ super().configure_grid(g) @@ -2231,7 +2245,7 @@ class DeliveryView(OrderItemView): route_prefix = "order_items_delivery" url_prefix = "/delivery" - def get_query(self, session=None): + def get_query(self, session=None): # pylint: disable=empty-docstring """ """ query = super().get_query(session=session) model = self.app.model @@ -2242,7 +2256,7 @@ class DeliveryView(OrderItemView): ) ) - def configure_grid(self, g): + def configure_grid(self, g): # pylint: disable=empty-docstring """ """ super().configure_grid(g) diff --git a/src/sideshow/web/views/products.py b/src/sideshow/web/views/products.py index 4dd58b1..4825646 100644 --- a/src/sideshow/web/views/products.py +++ b/src/sideshow/web/views/products.py @@ -88,7 +88,7 @@ class LocalProductView(MasterView): "new_order_batches", ] - def configure_grid(self, g): + def configure_grid(self, g): # pylint: disable=empty-docstring """ """ super().configure_grid(g) @@ -105,7 +105,7 @@ class LocalProductView(MasterView): g.set_link("description") g.set_link("size") - def configure_form(self, f): + def configure_form(self, f): # pylint: disable=empty-docstring """ """ super().configure_form(f) product = f.model_instance @@ -293,7 +293,7 @@ class PendingProductView(MasterView): "new_order_batches", ] - def configure_grid(self, g): + def configure_grid(self, g): # pylint: disable=empty-docstring """ """ super().configure_grid(g) enum = self.app.enum @@ -314,14 +314,16 @@ class PendingProductView(MasterView): g.set_link("description") g.set_link("size") - def grid_row_class(self, product, data, i): # pylint: disable=unused-argument + def grid_row_class( # pylint: disable=unused-argument,empty-docstring + self, product, data, i + ): """ """ enum = self.app.enum if product.status == enum.PendingProductStatus.IGNORED: return "has-background-warning" return None - def configure_form(self, f): + def configure_form(self, f): # pylint: disable=empty-docstring """ """ super().configure_form(f) product = f.model_instance @@ -441,7 +443,7 @@ class PendingProductView(MasterView): return grid - def get_template_context(self, context): + def get_template_context(self, context): # pylint: disable=empty-docstring """ """ enum = self.app.enum @@ -455,7 +457,7 @@ class PendingProductView(MasterView): return context - def delete_instance(self, product): + def delete_instance(self, product): # pylint: disable=empty-docstring """ """ # avoid deleting if still referenced by new order batch(es) @@ -534,7 +536,7 @@ class PendingProductView(MasterView): return self.redirect(self.get_action_url("view", product)) @classmethod - def defaults(cls, config): + def defaults(cls, config): # pylint: disable=empty-docstring """ """ cls._defaults(config) cls._pending_product_defaults(config) diff --git a/src/sideshow/web/views/stores.py b/src/sideshow/web/views/stores.py index 247d1c8..0a6c170 100644 --- a/src/sideshow/web/views/stores.py +++ b/src/sideshow/web/views/stores.py @@ -56,7 +56,7 @@ class StoreView(MasterView): sort_defaults = "store_id" - def configure_grid(self, g): + def configure_grid(self, g): # pylint: disable=empty-docstring """ """ super().configure_grid(g) @@ -64,13 +64,15 @@ class StoreView(MasterView): g.set_link("store_id") g.set_link("name") - def grid_row_class(self, store, data, i): # pylint: disable=unused-argument + def grid_row_class( # pylint: disable=unused-argument,empty-docstring + self, store, data, i + ): """ """ if store.archived: return "has-background-warning" return None - def configure_form(self, f): + def configure_form(self, f): # pylint: disable=empty-docstring """ """ super().configure_form(f) @@ -80,7 +82,7 @@ class StoreView(MasterView): # name f.set_validator("name", self.unique_name) - def unique_store_id(self, node, value): + def unique_store_id(self, node, value): # pylint: disable=empty-docstring """ """ model = self.app.model session = self.Session() @@ -94,7 +96,7 @@ class StoreView(MasterView): if query.count(): node.raise_invalid("Store ID must be unique") - def unique_name(self, node, value): + def unique_name(self, node, value): # pylint: disable=empty-docstring """ """ model = self.app.model session = self.Session() From efa13362e11543985c4c837431a5bf51e27b6524 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 15:10:28 -0500 Subject: [PATCH 22/29] fix: fix 'consider-using-set-comprehension' for pylint --- .pylintrc | 1 - src/sideshow/web/views/products.py | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.pylintrc b/.pylintrc index 0f12b83..e7bb1cb 100644 --- a/.pylintrc +++ b/.pylintrc @@ -10,4 +10,3 @@ disable=fixme, broad-exception-caught, consider-using-dict-comprehension, consider-using-f-string, - consider-using-set-comprehension, diff --git a/src/sideshow/web/views/products.py b/src/sideshow/web/views/products.py index 4825646..00ff962 100644 --- a/src/sideshow/web/views/products.py +++ b/src/sideshow/web/views/products.py @@ -154,7 +154,7 @@ class LocalProductView(MasterView): model = self.app.model route_prefix = self.get_route_prefix() - orders = set([item.order for item in product.order_items]) + orders = {item.order for item in product.order_items} orders = sorted(orders, key=lambda order: order.order_id) grid = self.make_grid( @@ -192,7 +192,7 @@ class LocalProductView(MasterView): model = self.app.model route_prefix = self.get_route_prefix() - batches = set([row.batch for row in product.new_order_batch_rows]) + batches = {row.batch for row in product.new_order_batch_rows} batches = sorted(batches, key=lambda batch: batch.id) grid = self.make_grid( @@ -372,7 +372,7 @@ class PendingProductView(MasterView): model = self.app.model route_prefix = self.get_route_prefix() - orders = set([item.order for item in product.order_items]) + orders = {item.order for item in product.order_items} orders = sorted(orders, key=lambda order: order.order_id) grid = self.make_grid( @@ -410,7 +410,7 @@ class PendingProductView(MasterView): model = self.app.model route_prefix = self.get_route_prefix() - batches = set([row.batch for row in product.new_order_batch_rows]) + batches = {row.batch for row in product.new_order_batch_rows} batches = sorted(batches, key=lambda batch: batch.id) grid = self.make_grid( From 3ba57e36408a800653baf778342fbd699e0bf6d2 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 15:12:05 -0500 Subject: [PATCH 23/29] fix: fix 'consider-using-f-string' for pylint --- .pylintrc | 1 - src/sideshow/web/views/orders.py | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pylintrc b/.pylintrc index e7bb1cb..9d51cdd 100644 --- a/.pylintrc +++ b/.pylintrc @@ -9,4 +9,3 @@ disable=fixme, attribute-defined-outside-init, broad-exception-caught, consider-using-dict-comprehension, - consider-using-f-string, diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 02eed4e..c01bffb 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -1596,8 +1596,9 @@ class OrderItemView(MasterView): if item.status_code != new_status_code: # event: change status - note = 'status changed from "{}" to "{}"'.format( - enum.ORDER_ITEM_STATUS[item.status_code], new_status_text + note = ( + f'status changed from "{enum.ORDER_ITEM_STATUS[item.status_code]}" ' + f'to "{new_status_text}"' ) item.add_event( enum.ORDER_ITEM_EVENT_STATUS_CHANGE, self.request.user, note=note From c3e262804c6e46eead63a67d42c11575bf077b9a Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 15:13:59 -0500 Subject: [PATCH 24/29] fix: fix 'consider-using-dict-comprehension' for pylint --- .pylintrc | 1 - src/sideshow/batch/neworder.py | 4 ++-- src/sideshow/web/views/orders.py | 10 ++++------ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.pylintrc b/.pylintrc index 9d51cdd..0fb067a 100644 --- a/.pylintrc +++ b/.pylintrc @@ -8,4 +8,3 @@ disable=fixme, arguments-renamed, attribute-defined-outside-init, broad-exception-caught, - consider-using-dict-comprehension, diff --git a/src/sideshow/batch/neworder.py b/src/sideshow/batch/neworder.py index 09c07cf..9f78da7 100644 --- a/src/sideshow/batch/neworder.py +++ b/src/sideshow/batch/neworder.py @@ -1255,7 +1255,7 @@ class NewOrderBatchHandler(BatchHandler): # pylint: disable=too-many-public-met ] # make order - kw = dict([(field, getattr(batch, field)) for field in batch_fields]) + kw = {field: getattr(batch, field) for field in batch_fields} kw["order_id"] = batch.id kw["created_by"] = user order = model.Order(**kw) @@ -1265,7 +1265,7 @@ class NewOrderBatchHandler(BatchHandler): # pylint: disable=too-many-public-met def convert(row, i): # pylint: disable=unused-argument # make order item - kw = dict([(field, getattr(row, field)) for field in row_fields]) + kw = {field: getattr(row, field) for field in row_fields} item = model.OrderItem(**kw) order.items.append(item) diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index c01bffb..500fe4c 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -308,12 +308,10 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods context["default_item_discount"] = self.app.render_quantity( self.batch_handler.get_default_item_discount() ) - context["dept_item_discounts"] = dict( - [ - (d["department_id"], d["default_item_discount"]) - for d in self.get_dept_item_discounts() - ] - ) + context["dept_item_discounts"] = { + d["department_id"]: d["default_item_discount"] + for d in self.get_dept_item_discounts() + } return self.render_to_response("create", context) From a56f6e9b91198c76d884a16796c9ede0a04c1106 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 15:15:22 -0500 Subject: [PATCH 25/29] fix: fix 'broad-exception-caught' for pylint --- .pylintrc | 1 - src/sideshow/web/views/orders.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.pylintrc b/.pylintrc index 0fb067a..8b580d2 100644 --- a/.pylintrc +++ b/.pylintrc @@ -7,4 +7,3 @@ disable=fixme, arguments-differ, arguments-renamed, attribute-defined-outside-init, - broad-exception-caught, diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 500fe4c..7903e2b 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -256,7 +256,7 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods if action in json_actions: try: result = getattr(self, action)(batch, data) - except Exception as error: + except Exception as error: # pylint: disable=broad-exception-caught log.warning("error calling json action for order", exc_info=True) result = {"error": self.app.render_error(error)} return self.json_response(result) @@ -820,7 +820,7 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods try: order = self.batch_handler.do_execute(batch, user) - except Exception as error: + except Exception as error: # pylint: disable=broad-exception-caught log.warning("failed to execute new order batch: %s", batch, exc_info=True) return {"error": self.app.render_error(error)} From 8008b0edad2acea7faddc0461c100f6b97ffce56 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 15:17:18 -0500 Subject: [PATCH 26/29] fix: fix 'attribute-defined-outside-init' for pylint --- .pylintrc | 1 - src/sideshow/app.py | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.pylintrc b/.pylintrc index 8b580d2..e0ea1b2 100644 --- a/.pylintrc +++ b/.pylintrc @@ -6,4 +6,3 @@ disable=fixme, abstract-method, arguments-differ, arguments-renamed, - attribute-defined-outside-init, diff --git a/src/sideshow/app.py b/src/sideshow/app.py index bbe24a6..02363ec 100644 --- a/src/sideshow/app.py +++ b/src/sideshow/app.py @@ -49,9 +49,9 @@ class SideshowAppProvider(base.AppProvider): :returns: Instance of :class:`~sideshow.orders.OrderHandler`. """ - if "order_handler" not in self.__dict__: + if "orders" not in self.app.handlers: spec = self.config.get( "sideshow.orders.handler_spec", default="sideshow.orders:OrderHandler" ) - self.order_handler = self.app.load_object(spec)(self.config) - return self.order_handler + self.app.handlers["orders"] = self.app.load_object(spec)(self.config) + return self.app.handlers["orders"] From e0a58dc524c555eba92888cb57a084bd5975ee3d Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 15:27:27 -0500 Subject: [PATCH 27/29] fix: fix 'arguments-differ' for pylint --- .pylintrc | 2 - src/sideshow/batch/neworder.py | 4 +- src/sideshow/web/forms/schema.py | 15 ++++--- src/sideshow/web/views/batch/neworder.py | 12 ++++-- src/sideshow/web/views/customers.py | 15 ++++--- src/sideshow/web/views/orders.py | 50 ++++++++++++++++-------- src/sideshow/web/views/products.py | 15 ++++--- src/sideshow/web/views/stores.py | 6 ++- 8 files changed, 78 insertions(+), 41 deletions(-) diff --git a/.pylintrc b/.pylintrc index e0ea1b2..7fb4fa9 100644 --- a/.pylintrc +++ b/.pylintrc @@ -4,5 +4,3 @@ disable=fixme, duplicate-code, abstract-method, - arguments-differ, - arguments-renamed, diff --git a/src/sideshow/batch/neworder.py b/src/sideshow/batch/neworder.py index 9f78da7..599ad73 100644 --- a/src/sideshow/batch/neworder.py +++ b/src/sideshow/batch/neworder.py @@ -1030,7 +1030,7 @@ class NewOrderBatchHandler(BatchHandler): # pylint: disable=too-many-public-met super().remove_row(row) - def do_delete(self, batch, user, **kwargs): + def do_delete(self, batch, user, **kwargs): # pylint: disable=arguments-differ """ Delete a batch completely. @@ -1054,7 +1054,7 @@ class NewOrderBatchHandler(BatchHandler): # pylint: disable=too-many-public-met # continue with normal deletion super().do_delete(batch, user, **kwargs) - def why_not_execute(self, batch, **kwargs): + def why_not_execute(self, batch, **kwargs): # pylint: disable=arguments-differ """ By default this checks to ensure the batch has a customer with phone number, and at least one item. It also may check to diff --git a/src/sideshow/web/forms/schema.py b/src/sideshow/web/forms/schema.py index dbebfc1..b1b0a0c 100644 --- a/src/sideshow/web/forms/schema.py +++ b/src/sideshow/web/forms/schema.py @@ -46,8 +46,9 @@ class OrderRef(ObjectRef): """ """ return query.order_by(self.model_class.order_id) - def get_object_url(self, order): # pylint: disable=empty-docstring + def get_object_url(self, obj): # pylint: disable=empty-docstring """ """ + order = obj return self.request.route_url("orders.view", uuid=order.uuid) @@ -71,8 +72,9 @@ class LocalCustomerRef(ObjectRef): """ """ return query.order_by(self.model_class.full_name) - def get_object_url(self, customer): # pylint: disable=empty-docstring + def get_object_url(self, obj): # pylint: disable=empty-docstring """ """ + customer = obj return self.request.route_url("local_customers.view", uuid=customer.uuid) @@ -96,8 +98,9 @@ class PendingCustomerRef(ObjectRef): """ """ return query.order_by(self.model_class.full_name) - def get_object_url(self, customer): # pylint: disable=empty-docstring + def get_object_url(self, obj): # pylint: disable=empty-docstring """ """ + customer = obj return self.request.route_url("pending_customers.view", uuid=customer.uuid) @@ -120,8 +123,9 @@ class LocalProductRef(ObjectRef): """ """ return query.order_by(self.model_class.scancode) - def get_object_url(self, product): # pylint: disable=empty-docstring + def get_object_url(self, obj): # pylint: disable=empty-docstring """ """ + product = obj return self.request.route_url("local_products.view", uuid=product.uuid) @@ -145,6 +149,7 @@ class PendingProductRef(ObjectRef): """ """ return query.order_by(self.model_class.scancode) - def get_object_url(self, product): # pylint: disable=empty-docstring + def get_object_url(self, obj): # pylint: disable=empty-docstring """ """ + product = obj return self.request.route_url("pending_products.view", uuid=product.uuid) diff --git a/src/sideshow/web/views/batch/neworder.py b/src/sideshow/web/views/batch/neworder.py index b46ec20..330c49b 100644 --- a/src/sideshow/web/views/batch/neworder.py +++ b/src/sideshow/web/views/batch/neworder.py @@ -136,8 +136,9 @@ class NewOrderBatchView(BatchMasterView): # TODO: call self.app.get_batch_handler() return NewOrderBatchHandler(self.config) - def configure_grid(self, g): # pylint: disable=empty-docstring + def configure_grid(self, grid): # pylint: disable=empty-docstring """ """ + g = grid super().configure_grid(g) # store_id @@ -147,8 +148,9 @@ class NewOrderBatchView(BatchMasterView): # total_price g.set_renderer("total_price", "currency") - def configure_form(self, f): # pylint: disable=empty-docstring + def configure_form(self, form): # pylint: disable=empty-docstring """ """ + f = form super().configure_form(f) # store_id @@ -164,8 +166,9 @@ class NewOrderBatchView(BatchMasterView): # total_price f.set_node("total_price", WuttaMoney(self.request)) - def configure_row_grid(self, g): # pylint: disable=empty-docstring + def configure_row_grid(self, grid): # pylint: disable=empty-docstring """ """ + g = grid super().configure_row_grid(g) # TODO @@ -187,12 +190,13 @@ class NewOrderBatchView(BatchMasterView): # total_price g.set_renderer("total_price", "currency") - def get_xref_buttons(self, batch): + def get_xref_buttons(self, obj): """ Adds "View this Order" button, if batch has been executed and a corresponding :class:`~sideshow.db.model.orders.Order` can be located. """ + batch = obj buttons = super().get_xref_buttons(batch) model = self.app.model session = self.Session() diff --git a/src/sideshow/web/views/customers.py b/src/sideshow/web/views/customers.py index eab6600..0fdd585 100644 --- a/src/sideshow/web/views/customers.py +++ b/src/sideshow/web/views/customers.py @@ -76,8 +76,9 @@ class LocalCustomerView(MasterView): "new_order_batches", ] - def configure_grid(self, g): # pylint: disable=empty-docstring + def configure_grid(self, grid): # pylint: disable=empty-docstring """ """ + g = grid super().configure_grid(g) # links @@ -87,8 +88,9 @@ class LocalCustomerView(MasterView): g.set_link("phone_number") g.set_link("email_address") - def configure_form(self, f): # pylint: disable=empty-docstring + def configure_form(self, form): # pylint: disable=empty-docstring """ """ + f = form super().configure_form(f) customer = f.model_instance @@ -247,8 +249,9 @@ class PendingCustomerView(MasterView): "new_order_batches", ] - def configure_grid(self, g): # pylint: disable=empty-docstring + def configure_grid(self, grid): # pylint: disable=empty-docstring """ """ + g = grid super().configure_grid(g) enum = self.app.enum @@ -262,8 +265,9 @@ class PendingCustomerView(MasterView): g.set_link("phone_number") g.set_link("email_address") - def configure_form(self, f): # pylint: disable=empty-docstring + def configure_form(self, form): # pylint: disable=empty-docstring """ """ + f = form super().configure_form(f) enum = self.app.enum customer = f.model_instance @@ -387,8 +391,9 @@ class PendingCustomerView(MasterView): return customer - def delete_instance(self, customer): # pylint: disable=empty-docstring + def delete_instance(self, obj): # pylint: disable=empty-docstring """ """ + customer = obj model_title = self.get_model_title() # avoid deleting if still referenced by order(s) diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 7903e2b..5830750 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -165,8 +165,9 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods self.order_handler = self.app.get_order_handler() self.batch_handler = self.app.get_batch_handler("neworder") - def configure_grid(self, g): # pylint: disable=empty-docstring + def configure_grid(self, grid): # pylint: disable=empty-docstring """ """ + g = grid super().configure_grid(g) # store_id @@ -952,12 +953,14 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods return data - def get_instance_title(self, order): # pylint: disable=empty-docstring + def get_instance_title(self, instance): # pylint: disable=empty-docstring """ """ + order = instance return f"#{order.order_id} for {order.customer_name}" - def configure_form(self, f): # pylint: disable=empty-docstring + def configure_form(self, form): # pylint: disable=empty-docstring """ """ + f = form super().configure_form(f) order = f.model_instance @@ -984,8 +987,9 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods f.set_node("created_by", UserRef(self.request)) f.set_readonly("created_by") - def get_xref_buttons(self, order): # pylint: disable=empty-docstring + def get_xref_buttons(self, obj): # pylint: disable=empty-docstring """ """ + order = obj buttons = super().get_xref_buttons(order) model = self.app.model session = self.Session() @@ -1006,14 +1010,16 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods return buttons - def get_row_grid_data(self, order): # pylint: disable=empty-docstring + def get_row_grid_data(self, obj): # pylint: disable=empty-docstring """ """ + order = obj model = self.app.model session = self.Session() return session.query(model.OrderItem).filter(model.OrderItem.order == order) - def configure_row_grid(self, g): # pylint: disable=empty-docstring + def configure_row_grid(self, grid): # pylint: disable=empty-docstring """ """ + g = grid super().configure_row_grid(g) # enum = self.app.enum @@ -1066,8 +1072,9 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods enum = self.app.enum return enum.ORDER_ITEM_STATUS[value] - def get_row_action_url_view(self, item, i): # pylint: disable=empty-docstring + def get_row_action_url_view(self, row, i): # pylint: disable=empty-docstring """ """ + item = row return self.request.route_url("order_items.view", uuid=item.uuid) def configure_get_simple_settings(self): # pylint: disable=empty-docstring @@ -1115,7 +1122,9 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods return settings - def configure_get_context(self, **kwargs): # pylint: disable=empty-docstring + def configure_get_context( # pylint: disable=empty-docstring,arguments-differ + self, **kwargs + ): """ """ context = super().configure_get_context(**kwargs) @@ -1154,7 +1163,9 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods return settings - def configure_remove_settings(self, **kwargs): # pylint: disable=empty-docstring + def configure_remove_settings( # pylint: disable=empty-docstring,arguments-differ + self, **kwargs + ): """ """ model = self.app.model session = self.Session() @@ -1347,8 +1358,9 @@ class OrderItemView(MasterView): model = self.app.model return query.join(model.Order) - def configure_grid(self, g): # pylint: disable=empty-docstring + def configure_grid(self, grid): # pylint: disable=empty-docstring """ """ + g = grid super().configure_grid(g) model = self.app.model # enum = self.app.enum @@ -1420,8 +1432,9 @@ class OrderItemView(MasterView): return f"has-background-{variant}" return None - def configure_form(self, f): # pylint: disable=empty-docstring + def configure_form(self, form): # pylint: disable=empty-docstring """ """ + f = form super().configure_form(f) enum = self.app.enum item = f.model_instance @@ -1532,8 +1545,9 @@ class OrderItemView(MasterView): ) return value - def get_xref_buttons(self, item): # pylint: disable=empty-docstring + def get_xref_buttons(self, obj): # pylint: disable=empty-docstring """ """ + item = obj buttons = super().get_xref_buttons(item) if self.request.has_perm("orders.view"): @@ -1765,8 +1779,9 @@ class PlacementView(OrderItemView): enum = self.app.enum return query.filter(model.OrderItem.status_code == enum.ORDER_ITEM_STATUS_READY) - def configure_grid(self, g): # pylint: disable=empty-docstring + def configure_grid(self, grid): # pylint: disable=empty-docstring """ """ + g = grid super().configure_grid(g) # checkable @@ -1905,8 +1920,9 @@ class ReceivingView(OrderItemView): model.OrderItem.status_code == enum.ORDER_ITEM_STATUS_PLACED ) - def configure_grid(self, g): # pylint: disable=empty-docstring + def configure_grid(self, grid): # pylint: disable=empty-docstring """ """ + g = grid super().configure_grid(g) # checkable @@ -2088,8 +2104,9 @@ class ContactView(OrderItemView): ) ) - def configure_grid(self, g): # pylint: disable=empty-docstring + def configure_grid(self, grid): # pylint: disable=empty-docstring """ """ + g = grid super().configure_grid(g) # checkable @@ -2255,8 +2272,9 @@ class DeliveryView(OrderItemView): ) ) - def configure_grid(self, g): # pylint: disable=empty-docstring + def configure_grid(self, grid): # pylint: disable=empty-docstring """ """ + g = grid super().configure_grid(g) # checkable diff --git a/src/sideshow/web/views/products.py b/src/sideshow/web/views/products.py index 00ff962..2cbfc7d 100644 --- a/src/sideshow/web/views/products.py +++ b/src/sideshow/web/views/products.py @@ -88,8 +88,9 @@ class LocalProductView(MasterView): "new_order_batches", ] - def configure_grid(self, g): # pylint: disable=empty-docstring + def configure_grid(self, grid): # pylint: disable=empty-docstring """ """ + g = grid super().configure_grid(g) # unit_cost @@ -105,8 +106,9 @@ class LocalProductView(MasterView): g.set_link("description") g.set_link("size") - def configure_form(self, f): # pylint: disable=empty-docstring + def configure_form(self, form): # pylint: disable=empty-docstring """ """ + f = form super().configure_form(f) product = f.model_instance @@ -293,8 +295,9 @@ class PendingProductView(MasterView): "new_order_batches", ] - def configure_grid(self, g): # pylint: disable=empty-docstring + def configure_grid(self, grid): # pylint: disable=empty-docstring """ """ + g = grid super().configure_grid(g) enum = self.app.enum @@ -323,8 +326,9 @@ class PendingProductView(MasterView): return "has-background-warning" return None - def configure_form(self, f): # pylint: disable=empty-docstring + def configure_form(self, form): # pylint: disable=empty-docstring """ """ + f = form super().configure_form(f) product = f.model_instance @@ -457,8 +461,9 @@ class PendingProductView(MasterView): return context - def delete_instance(self, product): # pylint: disable=empty-docstring + def delete_instance(self, obj): # pylint: disable=empty-docstring """ """ + product = obj # avoid deleting if still referenced by new order batch(es) for row in product.new_order_batch_rows: diff --git a/src/sideshow/web/views/stores.py b/src/sideshow/web/views/stores.py index 0a6c170..de22f41 100644 --- a/src/sideshow/web/views/stores.py +++ b/src/sideshow/web/views/stores.py @@ -56,8 +56,9 @@ class StoreView(MasterView): sort_defaults = "store_id" - def configure_grid(self, g): # pylint: disable=empty-docstring + def configure_grid(self, grid): # pylint: disable=empty-docstring """ """ + g = grid super().configure_grid(g) # links @@ -72,8 +73,9 @@ class StoreView(MasterView): return "has-background-warning" return None - def configure_form(self, f): # pylint: disable=empty-docstring + def configure_form(self, form): # pylint: disable=empty-docstring """ """ + f = form super().configure_form(f) # store_id From 45e20926ef2c7ed7ee40169b9ba9d42f25bba137 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 15:29:51 -0500 Subject: [PATCH 28/29] fix: fix 'abstract-method' for pylint --- .pylintrc | 1 - src/sideshow/web/views/batch/neworder.py | 2 +- src/sideshow/web/views/customers.py | 4 ++-- src/sideshow/web/views/orders.py | 10 +++++----- src/sideshow/web/views/products.py | 4 ++-- src/sideshow/web/views/stores.py | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.pylintrc b/.pylintrc index 7fb4fa9..527cc44 100644 --- a/.pylintrc +++ b/.pylintrc @@ -3,4 +3,3 @@ [MESSAGES CONTROL] disable=fixme, duplicate-code, - abstract-method, diff --git a/src/sideshow/web/views/batch/neworder.py b/src/sideshow/web/views/batch/neworder.py index 330c49b..6b0ba60 100644 --- a/src/sideshow/web/views/batch/neworder.py +++ b/src/sideshow/web/views/batch/neworder.py @@ -32,7 +32,7 @@ from sideshow.batch.neworder import NewOrderBatchHandler from sideshow.web.forms.schema import LocalCustomerRef, PendingCustomerRef -class NewOrderBatchView(BatchMasterView): +class NewOrderBatchView(BatchMasterView): # pylint: disable=abstract-method """ Master view for :class:`~sideshow.db.model.batch.neworder.NewOrderBatch`. diff --git a/src/sideshow/web/views/customers.py b/src/sideshow/web/views/customers.py index 0fdd585..f3999bd 100644 --- a/src/sideshow/web/views/customers.py +++ b/src/sideshow/web/views/customers.py @@ -30,7 +30,7 @@ from wuttaweb.forms.schema import UserRef, WuttaEnum from sideshow.db.model import LocalCustomer, PendingCustomer -class LocalCustomerView(MasterView): +class LocalCustomerView(MasterView): # pylint: disable=abstract-method """ Master view for :class:`~sideshow.db.model.customers.LocalCustomer`; route prefix @@ -197,7 +197,7 @@ class LocalCustomerView(MasterView): return customer -class PendingCustomerView(MasterView): +class PendingCustomerView(MasterView): # pylint: disable=abstract-method """ Master view for :class:`~sideshow.db.model.customers.PendingCustomer`; route diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 5830750..14e16dd 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -1241,7 +1241,7 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods ) -class OrderItemView(MasterView): +class OrderItemView(MasterView): # pylint: disable=abstract-method """ Master view for :class:`~sideshow.db.model.orders.OrderItem`; route prefix is ``order_items``. @@ -1730,7 +1730,7 @@ class OrderItemView(MasterView): ) -class PlacementView(OrderItemView): +class PlacementView(OrderItemView): # pylint: disable=abstract-method """ Master view for the "placement" phase of :class:`~sideshow.db.model.orders.OrderItem`; route prefix is @@ -1869,7 +1869,7 @@ class PlacementView(OrderItemView): ) -class ReceivingView(OrderItemView): +class ReceivingView(OrderItemView): # pylint: disable=abstract-method """ Master view for the "receiving" phase of :class:`~sideshow.db.model.orders.OrderItem`; route prefix is @@ -2070,7 +2070,7 @@ class ReceivingView(OrderItemView): ) -class ContactView(OrderItemView): +class ContactView(OrderItemView): # pylint: disable=abstract-method """ Master view for the "contact" phase of :class:`~sideshow.db.model.orders.OrderItem`; route prefix is @@ -2238,7 +2238,7 @@ class ContactView(OrderItemView): ) -class DeliveryView(OrderItemView): +class DeliveryView(OrderItemView): # pylint: disable=abstract-method """ Master view for the "delivery" phase of :class:`~sideshow.db.model.orders.OrderItem`; route prefix is diff --git a/src/sideshow/web/views/products.py b/src/sideshow/web/views/products.py index 2cbfc7d..7829b5d 100644 --- a/src/sideshow/web/views/products.py +++ b/src/sideshow/web/views/products.py @@ -31,7 +31,7 @@ from sideshow.enum import PendingProductStatus from sideshow.db.model import LocalProduct, PendingProduct -class LocalProductView(MasterView): +class LocalProductView(MasterView): # pylint: disable=abstract-method """ Master view for :class:`~sideshow.db.model.products.LocalProduct`; route prefix is ``local_products``. @@ -228,7 +228,7 @@ class LocalProductView(MasterView): return grid -class PendingProductView(MasterView): +class PendingProductView(MasterView): # pylint: disable=abstract-method """ Master view for :class:`~sideshow.db.model.products.PendingProduct`; route diff --git a/src/sideshow/web/views/stores.py b/src/sideshow/web/views/stores.py index de22f41..2543d66 100644 --- a/src/sideshow/web/views/stores.py +++ b/src/sideshow/web/views/stores.py @@ -29,7 +29,7 @@ from wuttaweb.views import MasterView from sideshow.db.model import Store -class StoreView(MasterView): +class StoreView(MasterView): # pylint: disable=abstract-method """ Master view for :class:`~sideshow.db.model.stores.Store`; route prefix From 614189531f3ce279d812da2a9b1347a0e72c0afc Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Sep 2025 15:37:38 -0500 Subject: [PATCH 29/29] docs: add badge for pylint --- docs/index.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index f067448..3bb4efc 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,6 +10,9 @@ project. .. _test coverage: https://buildbot.rattailproject.org/coverage/sideshow/ +.. image:: https://img.shields.io/badge/linting-pylint-yellowgreen + :target: https://github.com/pylint-dev/pylint + .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black