Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 2, 2024
1 parent cd6f441 commit 1e454ee
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 21 deletions.
8 changes: 4 additions & 4 deletions boxoffice/forms/discount.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
)

__all__ = [
'DiscountPolicyForm',
'PriceBasedDiscountPolicyForm',
'DiscountPriceForm',
'DiscountCouponForm',
'AutomaticDiscountPolicyForm',
'CouponBasedDiscountPolicyForm',
'DiscountCouponForm',
'DiscountPolicyForm',
'DiscountPriceForm',
'PriceBasedDiscountPolicyForm',
]


Expand Down
2 changes: 1 addition & 1 deletion boxoffice/forms/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from ..data import codes as gst_codes, indian_states_dict

__all__ = ['LineItemForm', 'BuyerForm', 'OrderSessionForm', 'InvoiceForm']
__all__ = ['BuyerForm', 'InvoiceForm', 'LineItemForm', 'OrderSessionForm']


def trim(length: int) -> Callable[[str | None], str]:
Expand Down
2 changes: 1 addition & 1 deletion boxoffice/models/discount_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from .enums import DiscountTypeEnum, LineItemStatus
from .user import Organization, User

__all__ = ['DiscountPolicy', 'DiscountCoupon', 'item_discount_policy']
__all__ = ['DiscountCoupon', 'DiscountPolicy', 'item_discount_policy']


item_discount_policy = sa.Table(
Expand Down
6 changes: 3 additions & 3 deletions boxoffice/models/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
from baseframe import __

__all__ = [
'CurrencyEnum',
'CurrencySymbol',
'DiscountTypeEnum',
'InvoiceStatus',
'LineItemStatus',
'OrderStatus',
'RazorpayPaymentStatus',
'TransactionMethodEnum',
'TransactionTypeEnum',
'CurrencyEnum',
'CurrencySymbol',
'RazorpayPaymentStatus',
]


Expand Down
2 changes: 1 addition & 1 deletion boxoffice/models/line_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from .enums import LineItemStatus
from .user import User

__all__ = ['LineItemTuple', 'LineItem', 'Assignee']
__all__ = ['Assignee', 'LineItem', 'LineItemTuple']


class LineItemTuple(NamedTuple):
Expand Down
10 changes: 7 additions & 3 deletions boxoffice/models/line_item_discounter.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_valid_discounts(
return []

ticket = Ticket.query.get(line_items[0].ticket_id)
if ticket is None or not ticket.is_available and not ticket.is_cancellable():
if ticket is None or (not ticket.is_available and not ticket.is_cancellable()):
# Ticket unavailable, no discounts
return []

Expand Down Expand Up @@ -94,8 +94,12 @@ def apply_discount(
)
if ( # pylint: disable=too-many-boolean-expressions
(
policy_coupon.coupon
and self.is_coupon_usable(policy_coupon.coupon, applied_to_count)
(
policy_coupon.coupon
and self.is_coupon_usable(
policy_coupon.coupon, applied_to_count
)
)
or policy_coupon.policy.is_automatic
)
and discounted_amount > 0
Expand Down
2 changes: 1 addition & 1 deletion boxoffice/models/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from .enums import LineItemStatus
from .user import User

__all__ = ['Ticket', 'Price']
__all__ = ['Price', 'Ticket']


class AvailabilityData(NamedTuple):
Expand Down
2 changes: 1 addition & 1 deletion boxoffice/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from . import DynamicMapped, Mapped, Model, Query, db, relationship, sa
from .utils import HeadersAndDataTuple

__all__ = ['User', 'Organization']
__all__ = ['Organization', 'User']


class User(UserBase2, Model):
Expand Down
2 changes: 1 addition & 1 deletion boxoffice/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from . import sa

__all__ = ['HeadersAndDataTuple', 'naive_to_utc', 'get_fiscal_year']
__all__ = ['HeadersAndDataTuple', 'get_fiscal_year', 'naive_to_utc']


class HeadersAndDataTuple(NamedTuple):
Expand Down
8 changes: 3 additions & 5 deletions boxoffice/views/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,9 @@ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> BaseResponse:
referrer = request.referrer
origin = basepath(referrer) if referrer else 'null'

if (
request.method == 'POST'
and not origin
or origin not in app.config['ALLOWED_ORIGINS']
):
if (request.method == 'POST' and not origin) or origin not in app.config[
'ALLOWED_ORIGINS'
]:
abort(403)

if request.method == 'OPTIONS':
Expand Down

0 comments on commit 1e454ee

Please sign in to comment.