Fixes flake8 errors arising from rebase

This commit is contained in:
Christopher Neugebauer 2016-04-29 11:22:56 +10:00
parent 135f2fb47b
commit b40505117f
7 changed files with 6 additions and 23 deletions

View file

@ -17,7 +17,6 @@ from registrasion.models import conditions
from registrasion.models import inventory from registrasion.models import inventory
from .category import CategoryController from .category import CategoryController
from .conditions import ConditionController
from .discount import DiscountController from .discount import DiscountController
from .flag import FlagController from .flag import FlagController
from .product import ProductController from .product import ProductController
@ -65,7 +64,6 @@ class CartController(object):
) )
return cls(existing) return cls(existing)
# Marks the carts that are currently in batches # Marks the carts that are currently in batches
_FOR_USER = {} _FOR_USER = {}
_BATCH_COUNT = collections.defaultdict(int) _BATCH_COUNT = collections.defaultdict(int)
@ -156,7 +154,6 @@ class CartController(object):
''' '''
self.cart.refresh_from_db() self.cart.refresh_from_db()
self._recalculate_discounts() self._recalculate_discounts()
@ -250,8 +247,6 @@ class CartController(object):
# Test each category limit here # Test each category limit here
for category in by_cat: for category in by_cat:
#ctrl = CategoryController(category)
#limit = ctrl.user_quantity_remaining(self.cart.user)
limit = with_remainders[category].remainder limit = with_remainders[category].remainder
# Get the amount so far in the cart # Get the amount so far in the cart

View file

@ -38,7 +38,6 @@ class CategoryController(object):
return set(i.category for i in available) return set(i.category for i in available)
@classmethod @classmethod
def attach_user_remainders(cls, user, categories): def attach_user_remainders(cls, user, categories):
''' '''

View file

@ -1,5 +1,3 @@
import itertools
from django.db.models import Case from django.db.models import Case
from django.db.models import F, Q from django.db.models import F, Q
from django.db.models import Sum from django.db.models import Sum
@ -9,8 +7,6 @@ from django.utils import timezone
from registrasion.models import commerce from registrasion.models import commerce
from registrasion.models import conditions from registrasion.models import conditions
from registrasion.models import inventory
_BIG_QUANTITY = 99999999 # A big quantity _BIG_QUANTITY = 99999999 # A big quantity
@ -134,8 +130,6 @@ class RemainderSetByFilter(object):
if hasattr(self.condition, "remainder"): if hasattr(self.condition, "remainder"):
return self.condition.remainder return self.condition.remainder
# Mark self.condition with a remainder # Mark self.condition with a remainder
qs = type(self.condition).objects.filter(pk=self.condition.id) qs = type(self.condition).objects.filter(pk=self.condition.id)
qs = self.pre_filter(qs, user) qs = self.pre_filter(qs, user)
@ -188,9 +182,9 @@ class ProductConditionController(IsMetByFilter, ConditionController):
class TimeOrStockLimitConditionController( class TimeOrStockLimitConditionController(
RemainderSetByFilter, RemainderSetByFilter,
ConditionController, ConditionController,
): ):
''' Common condition tests for TimeOrStockLimit Flag and ''' Common condition tests for TimeOrStockLimit Flag and
Discount.''' Discount.'''

View file

@ -50,7 +50,6 @@ class DiscountController(object):
categories and products. The discounts also list the available quantity categories and products. The discounts also list the available quantity
for this user, not including products that are pending purchase. ''' for this user, not including products that are pending purchase. '''
filtered_clauses = cls._filtered_discounts(user, categories, products) filtered_clauses = cls._filtered_discounts(user, categories, products)
discounts = [] discounts = []

View file

@ -36,10 +36,10 @@ class ProductController(object):
categories = set(product.category for product in all_products) categories = set(product.category for product in all_products)
r = CategoryController.attach_user_remainders(user, categories) r = CategoryController.attach_user_remainders(user, categories)
cat_quants = dict((c,c) for c in r) cat_quants = dict((c, c) for c in r)
r = ProductController.attach_user_remainders(user, all_products) r = ProductController.attach_user_remainders(user, all_products)
prod_quants = dict((p,p) for p in r) prod_quants = dict((p, p) for p in r)
passed_limits = set( passed_limits = set(
product product
@ -58,7 +58,6 @@ class ProductController(object):
return out return out
@classmethod @classmethod
def attach_user_remainders(cls, user, products): def attach_user_remainders(cls, user, products):
''' '''

View file

@ -103,7 +103,7 @@ def items_purchased(context, category=None):
''' '''
in_cart=( in_cart = (
Q(productitem__cart__user=context.request.user) & Q(productitem__cart__user=context.request.user) &
Q(productitem__cart__status=commerce.Cart.STATUS_PAID) Q(productitem__cart__status=commerce.Cart.STATUS_PAID)
) )

View file

@ -451,9 +451,6 @@ def _set_quantities_from_products_form(products_form, current_cart):
id__in=pks, id__in=pks,
).select_related("category") ).select_related("category")
# TODO: This is fundamentally dumb
product_quantities = [ product_quantities = [
(product, id_to_quantity[product.id]) for product in products (product, id_to_quantity[product.id]) for product in products
] ]