<commit_before>from django.views.generic import ListView, CreateView
from django.utils.timezone import now
from timer.models import Timer, Location, Station, Moon, System
from timer.forms import TimerForm


class TimerCreateView(CreateView):
    model = Timer
    form_class = TimerForm


class TimerListView(ListView):
    model = Timer
    template_name = 'timer/timer_list.html'

    def get_queryset(self):
        qs = super(TimerListView, self).get_queryset().select_related('location', 'station', 'moon', 'system')

        if int(self.request.GET.get('all', 0)) == 0:
            qs = qs.filter(expiration__gt=now())

        type = int(self.request.GET.get('type', 0))
        if type == 1:
            qs = [m for m in qs if m.location.get_type == 'Station']
        if type == 2:
            qs = [m for m in qs if m.location.get_type == 'System']
        if type == 3:
            qs = [m for m in qs if m.location.get_type == 'Moon']
        return qs


    def get_context_data(self, **kwargs):
        ctx = super(TimerListView, self).get_context_data(**kwargs)
        ctx.update({
            'list_all': int(self.request.GET.get('all', 0)),
            'list_type': int(self.request.GET.get('type', 0)),
        })
        return ctx<commit_msg>Fix bad usage of a reserved word<commit_after>from django.views.generic import ListView, CreateView
from django.utils.timezone import now
from timer.models import Timer, Location, Station, Moon, System
from timer.forms import TimerForm


class TimerCreateView(CreateView):
    model = Timer
    form_class = TimerForm


class TimerListView(ListView):
    model = Timer
    template_name = 'timer/timer_list.html'

    def get_queryset(self):
        qs = super(TimerListView, self).get_queryset().select_related('location', 'station', 'moon', 'system')

        if int(self.request.GET.get('all', 0)) == 0:
            qs = qs.filter(expiration__gt=now())

        typ = int(self.request.GET.get('type', 0))
        if typ == 1:
            qs = [m for m in qs if m.location.get_type == 'Station']
        if typ == 2:
            qs = [m for m in qs if m.location.get_type == 'System']
        if typ == 3:
            qs = [m for m in qs if m.location.get_type == 'Moon']
        return qs


    def get_context_data(self, **kwargs):
        ctx = super(TimerListView, self).get_context_data(**kwargs)
        ctx.update({
            'list_all': int(self.request.GET.get('all', 0)),
            'list_type': int(self.request.GET.get('type', 0)),
        })
        return ctx
{'fraction_non_alphanumeric': 0.1314443132624951, 'fraction_numerical': 0.006296733569460842, 'mean_word_length': 2.6470588235294117, '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': '6914930', 'n_tokens_mistral': 839, 'n_tokens_neox': 774, 'n_words': 211}