Skip to content

allocation

Unified private venue allocation implementation.

VenueAllocation

Bases: _FilteringMixin, _FallbackMixin, _SpecialCasesMixin, _MatchingMixin, _AllocationMixin, _ReportingMixin

Single internal owner for venue allocation state and behavior.

Source code in may/venue_distributor/_allocation.py
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
class VenueAllocation(
    _FilteringMixin,
    _FallbackMixin,
    _SpecialCasesMixin,
    _MatchingMixin,
    _AllocationMixin,
    _ReportingMixin,
):
    """Single internal owner for venue allocation state and behavior."""

    def __init__(self, owner):
        self.owner = owner
        self.config = owner.config
        self.verbose = owner.verbose
        self.venue_attribute_cache = {}
        self.categorical_index = {}
        self.num_constraints = {}
        self.numerical_match_rules = []
        self.categorical_match_rules = []
        self.attribute_index_built = False
        self.venue_id_to_idx = {}
        eligibility = self.config.get("eligibility", {})
        self.attribute_names = [
            r.get("name") for r in eligibility.get("attributes", [])
        ]
        self.attr_getters = [
            lambda p, attr=name: get_attribute(p, attr)
            for name in self.attribute_names
            if name
        ]