<commit_before># coding=utf-8

import os

from django.contrib.admin.views.decorators import staff_member_required

from pdfdocument.document import PDFDocument, cm, mm
from pdfdocument.elements import create_stationery_fn
from pdfdocument.utils import pdf_response


class AssignmentPDFStationery(object):
    def __init__(self, assignment):
        self.assignment = assignment

    def __call__(self, canvas, pdfdocument):
        #canvas.saveState()
        #canvas.restoreState()

        if pdfdocument.doc.page == 1:
            self.page_1(canvas, pdfdocument)
        elif pdfdocument.doc.page == 2:
            self.page_2(canvas, pdfdocument)

    def background(self, canvas, image):
        canvas.drawImage(
            os.path.join(os.path.dirname(os.path.abspath(__file__)),
                'data', image),
            0, 0, 21*cm, 29.4*cm)

    markers = {
        'trial': (75, 71),<commit_msg>Fix assignment PDF generation<commit_after># coding=utf-8

import os

from django.contrib.admin.views.decorators import staff_member_required
from django.shortcuts import get_object_or_404

from zivinetz.models import Assignment, CompanyHoliday

from pdfdocument.document import PDFDocument, cm, mm
from pdfdocument.elements import create_stationery_fn
from pdfdocument.utils import pdf_response


class AssignmentPDFStationery(object):
    def __init__(self, assignment):
        self.assignment = assignment

    def __call__(self, canvas, pdfdocument):
        #canvas.saveState()
        #canvas.restoreState()

        if pdfdocument.doc.page == 1:
            self.page_1(canvas, pdfdocument)
        elif pdfdocument.doc.page == 2:
            self.page_2(canvas, pdfdocument)

    def background(self, canvas, image):
        canvas.drawImage(
            os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
                'data', image),
            0, 0, 21*cm, 29.4*cm)

    markers = {
        'trial': (75, 71),
{'fraction_non_alphanumeric': 0.10061287027579162, 'fraction_numerical': 0.01787538304392237, 'mean_word_length': 3.014344262295082, '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': '3904563', 'n_tokens_mistral': 606, 'n_tokens_neox': 570, 'n_words': 133}