<commit_before>import operator
import os
from datetime import date, timedelta
from functools import reduce
from io import BytesIO

from django.conf import settings
from django.contrib import messages
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.http import HttpResponse, HttpResponseForbidden
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.translation import gettext as _
from pdfdocument.document import PDFDocument, cm, mm
from pdfdocument.elements import create_stationery_fn
from pdfdocument.utils import pdf_response
from PyPDF2 import PdfFileReader, PdfFileWriter
from reportlab.lib import colors

from zivinetz.models import Assignment, AssignmentChange, ExpenseReport, JobReference


class AssignmentPDFStationery:
    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)

    markers = {
        "standard": (54, 94),
        "trial": (81.5, 94),
        "long_assignment": (114, 94),
        # 'working_time_fixed': (112, 60),
        # 'working_time_nightshift': (151, 59),
        # 'working_time_flexible': (112, 55),
        # 'working_time_weekend': (151, 55),
        # "vegetarianism": (113.5, 40),
        # "no_vegetarianism": (155, 40),
        # "pocket_money": (31, 167),
        # 'accomodation_working_compensated': (56, 230),
        # 'accomodation_working_provided': (85, 230),
        # 'accomodation_free_compensated': (113.5, 230),
        # 'accomodation_free_provided': (143, 230),
        # 'accomodation_used': (75, 251),
        # 'accomodation_notused': (113.5, 251),
        #
        "breakfast_working_at_company": (93, 161),
        "breakfast_working_at_home": (110, 161),
        "breakfast_working_external": (110, 161),
        #
        "breakfast_free_at_company": (147.5, 161),
        "breakfast_free_at_home": (165, 161),
        "breakfast_free_external": (165, 161),
        #
        "lunch_working_at_company": (93, 157),
        "lunch_working_at_home": (110, 157),
        "lunch_working_external": (110, 157),
        #
        "lunch_free_at_company": (147.5, 157),
        "lunch_free_at_home": (165, 157),
        "lunch_free_external": (165, 157),
        #
        "supper_working_at_company": (93, 153),
        "supper_working_at_home": (110, 153),
        "supper_working_external": (110, 153),
        #
        "supper_free_at_company": (147.5, 153),
        "supper_free_at_home": (165, 153),
        "supper_free_external": (165, 153),
        #
        "accomodation_throughout": (31, 258),
        "accomodation_not_throughout": (100, 258),
        #
        "food_throughout": (31.5, 184),
        "food_not_throughout": (31.5, 180),
        #
        "drudge_uses_accomodation": (36, 253),
        "drudge_renounce_accomodation_1": (36, 244),
        # "drudge_renounce_accomodation_2": (186, 250),
        #
        "public_transports": (31.5, 207),
        "private_transport": (31.5, 202.5),
        #
        "special_tickets_yes": (39, 249),
        # "special_tickets_no": (186, 137),
        "clothing_provided": (31, 126),
        "clothing_compensated": (31, 121.5),
        #
        # "arrangement_timely": (31, 102),
        # "arrangement_late": (31, 102),
        #
        "legalese_0": (176, 101),
        "legalese_1": (185, 81),
        "legalese_2": (185, 72),
        "legalese_3": (185, 63),
    }

    def draw_marker(self, canvas, key):
        canvas.setFont("Helvetica-Bold", 11)
        canvas.drawString(self.markers[key][0] * mm, self.markers[key][1] * mm, "x")

    def _draw_all_markers(self, canvas):  # pragma: no cover
        canvas.setFillColorRGB(1, 0, 0)
        canvas.setFont("Helvetica-Bold", 11)
        for key, pos in self.markers.items():
            canvas.drawString(pos[0] * mm, pos[1] * mm, f"x {key}")<commit_msg>Bigger markers<commit_after>import operator
import os
from datetime import date, timedelta
from functools import reduce
from io import BytesIO

from django.conf import settings
from django.contrib import messages
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.http import HttpResponse, HttpResponseForbidden
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.translation import gettext as _
from pdfdocument.document import PDFDocument, cm, mm
from pdfdocument.elements import create_stationery_fn
from pdfdocument.utils import pdf_response
from PyPDF2 import PdfFileReader, PdfFileWriter
from reportlab.lib import colors

from zivinetz.models import Assignment, AssignmentChange, ExpenseReport, JobReference


class AssignmentPDFStationery:
    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)

    markers = {
        "standard": (53.5, 94),
        "trial": (81, 94),
        "long_assignment": (113.5, 94),
        # 'working_time_fixed': (112, 60),
        # 'working_time_nightshift': (151, 59),
        # 'working_time_flexible': (112, 55),
        # 'working_time_weekend': (151, 55),
        # "vegetarianism": (113.5, 40),
        # "no_vegetarianism": (155, 40),
        # "pocket_money": (31, 167),
        # 'accomodation_working_compensated': (56, 230),
        # 'accomodation_working_provided': (85, 230),
        # 'accomodation_free_compensated': (113.5, 230),
        # 'accomodation_free_provided': (143, 230),
        # 'accomodation_used': (75, 251),
        # 'accomodation_notused': (113.5, 251),
        #
        "breakfast_working_at_company": (93, 161),
        "breakfast_working_at_home": (110, 161),
        "breakfast_working_external": (110, 161),
        #
        "breakfast_free_at_company": (147.5, 161),
        "breakfast_free_at_home": (165, 161),
        "breakfast_free_external": (165, 161),
        #
        "lunch_working_at_company": (93, 157),
        "lunch_working_at_home": (110, 157),
        "lunch_working_external": (110, 157),
        #
        "lunch_free_at_company": (147.5, 157),
        "lunch_free_at_home": (165, 157),
        "lunch_free_external": (165, 157),
        #
        "supper_working_at_company": (93, 153),
        "supper_working_at_home": (110, 153),
        "supper_working_external": (110, 153),
        #
        "supper_free_at_company": (147.5, 153),
        "supper_free_at_home": (165, 153),
        "supper_free_external": (165, 153),
        #
        "accomodation_throughout": (31, 258),
        "accomodation_not_throughout": (100, 258),
        #
        "food_throughout": (31.5, 184),
        "food_not_throughout": (31.5, 180),
        #
        "drudge_uses_accomodation": (35.5, 253),
        "drudge_renounce_accomodation_1": (35.5, 243.5),
        # "drudge_renounce_accomodation_2": (186, 250),
        #
        "public_transports": (31.5, 207),
        "private_transport": (31.5, 202.5),
        #
        "special_tickets_yes": (39, 248.5),
        # "special_tickets_no": (186, 137),
        "clothing_provided": (31, 126),
        "clothing_compensated": (31, 121.5),
        #
        # "arrangement_timely": (31, 102),
        # "arrangement_late": (31, 102),
        #
        "legalese_0": (176, 101),
        "legalese_1": (185, 81),
        "legalese_2": (185, 72),
        "legalese_3": (185, 63),
    }

    def draw_marker(self, canvas, key):
        canvas.setFont("Helvetica-Bold", 14)
        canvas.drawString(self.markers[key][0] * mm, self.markers[key][1] * mm, "x")

    def _draw_all_markers(self, canvas):  # pragma: no cover
        canvas.setFillColorRGB(1, 0, 0)
        canvas.setFont("Helvetica-Bold", 14)
        for key, pos in self.markers.items():
            canvas.drawString(pos[0] * mm, pos[1] * mm, f"x {key}")
{'fraction_non_alphanumeric': 0.13359551900846145, 'fraction_numerical': 0.0775831247765463, 'mean_word_length': 2.897816999535532, 'pattern_counts': {'":': 86, '<': 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': '3684022', 'n_tokens_mistral': 3310, 'n_tokens_neox': 2794, 'n_words': 598}