<commit_before>#! /usr/bin/env python

#pgclock.py
#analog and digital clock example

import os, sys, pygame
from pygame.locals import *
import datetime

class item:

    def __init__(self,imagename,colorkey,left,top):
        self.img = pygame.image.load(imagename).convert()
        if colorkey == -1:
            ckey = self.img.get_at((0,0))
            self.img.set_colorkey(ckey, RLEACCEL)
        self.rect = self.img.get_rect()
        self.left = left
        self.top = top
        self.width = self.rect.width
        self.height = self.rect.height
        self.center = self.rect.center

    def draw(self):
        screen.blit(self.img,(self.left, self.top))

    def setaxis(self,axis):
        self.axis = axis

    def drawrot(self,axis,angle):
        #Create new rotated image: preserve original
        self.newimg = pygame.transform.rotate(self.img,angle).convert()
        self.newrect = self.newimg.get_rect()
        #Now center the new rectangle to the rotation axis
        self.newrect.left = axis[0]-(self.newrect.w/2)
        self.newrect.top = axis[1]-(self.newrect.h/2)
        screen.blit(self.newimg,(self.newrect.left, self.newrect.top))

#setup screen size and background image
size = width, height = 200, 244
screen = pygame.display.set_mode(size)
pygame.init()

#load clock face as background        
bg = item("clock-face.jpg",0,0,0)
bg.setaxis((bg.width/2,95))

#load and place clock hands
#the hand images rotate around their own central axis because
#almost one half of the image is set to transparent
longhand = item("clockhand-long.bmp",-1,90,23)
shorthand = item("clockhand-short.bmp",-1,90,40)
secondhand = item("secondhand.bmp",-1,90,23)

#setup font
black = 0,0,0
white = 255,255,255
font = pygame.font.Font(None, 40)

while 1:

    for event in pygame.event.get():
        if event.type == QUIT:
           sys.exit(0)

    #redraw the background to clear the screen
    bg.draw()

    #get time<commit_msg>Modified pgclock.py<commit_after>#! /usr/bin/env python

#pgclock.py
#analog and digital clock example

import os, sys, pygame
from pygame.locals import *
import datetime

class item:

    def __init__(self,imagename,colorkey,left,top):
        self.img = pygame.image.load(imagename).convert()
        if colorkey == -1:
            ckey = self.img.get_at((0,0))
            self.img.set_colorkey(ckey, RLEACCEL)
        self.rect = self.img.get_rect()
        self.left = left
        self.top = top
        self.width = self.rect.width
        self.height = self.rect.height
        self.center = self.rect.center

    def draw(self):
        screen.blit(self.img,(self.left, self.top))

    def setaxis(self,axis):
        self.axis = axis

    def drawrot(self,axis,angle):
        #Create new rotated image: preserve original
        self.newimg = pygame.transform.rotate(self.img,angle).convert()
        self.newrect = self.newimg.get_rect()
        #Now center the new rectangle to the rotation axis
        self.newrect.left = axis[0]-(self.newrect.w/2)
        self.newrect.top = axis[1]-(self.newrect.h/2)
        screen.blit(self.newimg,(self.newrect.left, self.newrect.top))

#setup screen size and background image
size = width, height = 320, 240
screen = pygame.display.set_mode(size)
pygame.init()

#load clock face as background        
bg = item("clock-face.jpg",0,0,0)
bg.setaxis((bg.width/2,95))

#load and place clock hands
#the hand images rotate around their own central axis because
#almost one half of the image is set to transparent
longhand = item("clockhand-long.bmp",-1,90,23)
shorthand = item("clockhand-short.bmp",-1,90,40)
secondhand = item("secondhand.bmp",-1,90,23)

#setup font
black = 0,0,0
white = 255,255,255
font = pygame.font.Font(None, 40)

while 1:

    for event in pygame.event.get():
        if event.type == QUIT:
           sys.exit(0)

    #redraw the background to clear the screen
    bg.draw()

    #get time
{'fraction_non_alphanumeric': 0.12646908533469597, 'fraction_numerical': 0.025549310168625446, 'mean_word_length': 2.8955223880597014, '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': '3539545', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1308, 'n_words': 320}