Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #534

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
- id: pyupgrade
args: ['--keep-runtime-typing', '--py311-plus']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.1
rev: v0.8.1
hooks:
- id: ruff
args: ['--fix', '--exit-non-zero-on-fix']
Expand Down Expand Up @@ -57,7 +57,7 @@ repos:
- types-setuptools
- typing-extensions
- repo: https://github.com/PyCQA/pylint
rev: v3.3.1
rev: v3.3.2
hooks:
- id: pylint
args: [
Expand All @@ -69,7 +69,7 @@ repos:
additional_dependencies:
- tomli
- repo: https://github.com/PyCQA/bandit
rev: 1.7.10
rev: 1.8.0
hooks:
- id: bandit
language_version: python3
Expand Down
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
Loading