<commit_before>from zope.interface import (
    implementer,
    Interface,
)
from zope.component import (
    adapter,
    getAdapter,
    getAdapters,
)
from zope.event import notify
from .interfaces import (
    IPayment,
    IPaymentEvent,
    IPaymentSuccessEvent,
    IPaymentFailedEvent,
)


@implementer(IPaymentEvent)
class PaymentEvent(object):
    
    def __init__(self, context, request, payment, order_uid, data):
        self.context = context
        self.request = request
        self.payment = payment
        self.order_uid = order_uid
        self.data = data


@implementer(IPaymentSuccessEvent)
class PaymentSuccessEvent(PaymentEvent): pass


@implementer(IPaymentFailedEvent)
class PaymentFailedEvent(PaymentEvent): pass


class Payments(object):
    
    def __init__(self, context):
        self.context = context
    
    def get(self, name):
        return getAdapter(self.context, IPayment, name=name)
    
    @property
    def payments(self):
        adapters = getAdapters((self.context,), IPayment)
        return [_[1] for _ in adapters]
    
    @property
    def vocab(self):
        adapters = getAdapters((self.context,), IPayment)
        return [(_[0], _[1].label) for _ in adapters]
    
    @property
    def default(self):
        adapters = getAdapters((self.context,), IPayment)<commit_msg>check for available in vocab<commit_after>from zope.interface import (
    implementer,
    Interface,
)
from zope.component import (
    adapter,
    getAdapter,
    getAdapters,
)
from zope.event import notify
from .interfaces import (
    IPayment,
    IPaymentEvent,
    IPaymentSuccessEvent,
    IPaymentFailedEvent,
)


@implementer(IPaymentEvent)
class PaymentEvent(object):
    
    def __init__(self, context, request, payment, order_uid, data):
        self.context = context
        self.request = request
        self.payment = payment
        self.order_uid = order_uid
        self.data = data


@implementer(IPaymentSuccessEvent)
class PaymentSuccessEvent(PaymentEvent): pass


@implementer(IPaymentFailedEvent)
class PaymentFailedEvent(PaymentEvent): pass


class Payments(object):
    
    def __init__(self, context):
        self.context = context
    
    def get(self, name):
        return getAdapter(self.context, IPayment, name=name)
    
    @property
    def payments(self):
        adapters = getAdapters((self.context,), IPayment)
        return [_[1] for _ in adapters]
    
    @property
    def vocab(self):
        adapters = getAdapters((self.context,), IPayment)
        return [(_[0], _[1].label) for _ in adapters if _[1].available]
    
    @property
    def default(self):
        adapters = getAdapters((self.context,), IPayment)
{'fraction_non_alphanumeric': 0.09507954125046245, 'fraction_numerical': 0.002589715131335553, 'mean_word_length': 3.0479041916167664, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4020371', 'n_tokens_mistral': 846, 'n_tokens_neox': 824, 'n_words': 191}