<commit_before>from django.core.management.base import BaseCommand
from django.conf import settings
from django.db import connections
from datetime import datetime
import redis
from common.helpers import LOCAL_TIMEZONE
from roombookings.models import \
    Room, RoomA, RoomB, \
    Booking, BookingA, BookingB
from timetable.models import \
    Timetable, TimetableA, TimetableB, \
    Weekstructure, WeekstructureA, WeekstructureB, \
    Weekmapnumeric, WeekmapnumericA, WeekmapnumericB, \
    Lecturer, LecturerA, LecturerB, \
    Sites, SitesA, SitesB, \
    Module, ModuleA, ModuleB, \
    Weekmapstring, WeekmapstringA, WeekmapstringB, \
    Students, StudentsA, StudentsB, \
    Depts, DeptsA, DeptsB, \
    Cminstances, CminstancesA, CminstancesB, \
    Stumodules, StumodulesA, StumodulesB, \
    Lock


class Command(BaseCommand):

    help = 'Clones timetable and booking related dbs to speed up queries'

    def handle(self, *args, **options):
        # Table format: (OracleTable, BucketA, BucketB, HasSetID, isBookingsGenCache)
        tables = [
            (Module, ModuleA, ModuleB, True, False),
            (Timetable, TimetableA, TimetableB, True, False),
            (Weekstructure, WeekstructureA, WeekstructureB, True, False),
            (Weekmapnumeric, WeekmapnumericA, WeekmapnumericB, True, False),
            (Weekmapstring, WeekmapstringA, WeekmapstringB, True, False),
            (Lecturer, LecturerA, LecturerB, True, False),
            (Sites, SitesA, SitesB, True, False),
            (Students, StudentsA, StudentsB, True, False),
            (Depts, DeptsA, DeptsB, False, False),
            (Cminstances, CminstancesA, CminstancesB, True, False),
            (Stumodules, StumodulesA, StumodulesB, True, False),
            (Room, RoomA, RoomB, True, True),
            (Booking, BookingA, BookingB, True, True)<commit_msg>Fixes missing import<commit_after>from django.core.management.base import BaseCommand
from django.conf import settings
from django.db import connections
from datetime import datetime
import redis
from common.helpers import LOCAL_TIMEZONE
from roombookings.models import \
    Room, RoomA, RoomB, \
    Booking, BookingA, BookingB
from timetable.models import \
    Timetable, TimetableA, TimetableB, \
    Weekstructure, WeekstructureA, WeekstructureB, \
    Weekmapnumeric, WeekmapnumericA, WeekmapnumericB, \
    Lecturer, LecturerA, LecturerB, \
    Sites, SitesA, SitesB, \
    Module, ModuleA, ModuleB, \
    Weekmapstring, WeekmapstringA, WeekmapstringB, \
    Students, StudentsA, StudentsB, \
    Depts, DeptsA, DeptsB, \
    Cminstances, CminstancesA, CminstancesB, \
    Stumodules, StumodulesA, StumodulesB, \
    Lock

from django.core.management import call_command

class Command(BaseCommand):

    help = 'Clones timetable and booking related dbs to speed up queries'

    def handle(self, *args, **options):
        # Table format:
        # (OracleTable, BucketA, BucketB, HasSetID, isBookingsGenCache)
        tables = [
            (Module, ModuleA, ModuleB, True, False),
            (Timetable, TimetableA, TimetableB, True, False),
            (Weekstructure, WeekstructureA, WeekstructureB, True, False),
            (Weekmapnumeric, WeekmapnumericA, WeekmapnumericB, True, False),
            (Weekmapstring, WeekmapstringA, WeekmapstringB, True, False),
            (Lecturer, LecturerA, LecturerB, True, False),
            (Sites, SitesA, SitesB, True, False),
            (Students, StudentsA, StudentsB, True, False),
            (Depts, DeptsA, DeptsB, False, False),
            (Cminstances, CminstancesA, CminstancesB, True, False),
            (Stumodules, StumodulesA, StumodulesB, True, False),
            (Room, RoomA, RoomB, True, True),
            (Booking, BookingA, BookingB, True, True)
{'fraction_non_alphanumeric': 0.09407114624505929, 'fraction_numerical': 0.0, 'mean_word_length': 3.2556053811659194, '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': '1563727', 'n_tokens_mistral': 1202, 'n_tokens_neox': 1163, 'n_words': 321}