<commit_before>class Resource(object):
    def __init__(self, ctx, name, capacity=1):
        self.ctx = ctx
        self.name = name
        self.capacity = capacity
        self.waiters = []

    def request(self):
        if self.capacity > 0:
            self.capacity -= 1
            return self.ctx.resume(self.ctx.process)
        else:
            self.waiters.append(self.ctx.process)

    def release(self):
        self.capacity += 1
        while self.capacity > 0 and self.waiters:
            self.capacity -= 1
            self.ctx.resume(self.waiters.pop(0), None)<commit_msg>Even more simplification thanks to stefan.<commit_after>class Resource(object):
    def __init__(self, ctx, name, capacity=1):
        self.ctx = ctx
        self.name = name
        self.capacity = capacity
        self.waiters = []

    def request(self):
        if self.capacity > 0:
            self.capacity -= 1
            return self.ctx.resume(self.ctx.process)
        else:
            self.waiters.append(self.ctx.process)

    def release(self):
        if self.waiters:
            self.ctx.resume(self.waiters.pop(0), None)
        else:
            self.capacity += 1
{'fraction_non_alphanumeric': 0.11129991503823279, 'fraction_numerical': 0.010195412064570943, 'mean_word_length': 1.8317307692307692, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '3662923', 'n_tokens_mistral': 350, 'n_tokens_neox': 340, 'n_words': 76}