<commit_before>"""The module houses the class that displays wallpapers in the app."""
from random import choice

from tkinter import *
from PIL import ImageTk
from uiplib.uipImage import UipImage


class Gallery(Frame):
    """A view to show the pictures."""

    def __init__(self, master, appObj):
        """Initialize the gallery."""
        Frame.__init__(self, master)
        self.appObj = appObj
        self.image = None
        self.cv = None
        self.label = None
        self.slider = None

    def show_error(self):
        """Method to display errors."""
        self.image = None
        self.cv = None
        self.label = Label(self, wraplength=150,
                           justify=CENTER,
                           text="No images found. "
                           "Please refresh and try again!")
        self.label.pack(padx=50, pady=50)

    def set_image(self, imagePath):
        """Method to set the image preview."""
        self.label = None
        self.width = 600
        self.height = 340
        if not self.cv:
            self.cv = Canvas(self, width=self.width, height=self.height)
            self.cv.pack(fill=BOTH, expand=YES)
        if not self.slider:
            self._job = None
            self.slider = Scale(self,
                                orient=HORIZONTAL,
                                from_=0, to=30,
                                command=self._blur_helper,
                                label="Blur", showvalue=0)
            self.slider.pack()
        self.image = UipImage(imagePath)
        self.show_image(self.image)

    def show_image(self, image):
        """Show the image on canvas."""
        show_image = image.resize((self.width, self.height))
        self.tk_image = ImageTk.PhotoImage(show_image)
        self.cv.create_image(0, 0, anchor="nw", image=self.tk_image)<commit_msg>Make `Update` work properly<commit_after>"""The module houses the class that displays wallpapers in the app."""
from random import choice

from tkinter import *
from PIL import ImageTk
from uiplib.uipImage import UipImage


class Gallery(Frame):
    """A view to show the pictures."""

    def __init__(self, master, appObj):
        """Initialize the gallery."""
        Frame.__init__(self, master)
        self.appObj = appObj
        self.image = None
        self.cv = None
        self.label = None
        self.slider = None

    def show_error(self):
        """Method to display errors."""
        self.image = None
        self.cv = None
        self.label = Label(self, wraplength=150,
                           justify=CENTER,
                           text="No images found. "
                           "Please refresh and try again!")
        self.label.pack(padx=50, pady=50)

    def set_image(self, imagePath):
        """Method to set the image preview."""
        self.label = None
        self.width = 600
        self.height = 340
        if not self.cv:
            self.cv = Canvas(self, width=self.width, height=self.height)
            self.cv.pack(fill=BOTH, expand=YES)
        if not self.slider:
            self._job = None
            self.slider = Scale(self,
                                orient=HORIZONTAL,
                                from_=0, to=30,
                                command=self._blur_helper,
                                label="Blur", showvalue=0)
            self.slider.pack()
        self.image = UipImage(imagePath)
        self.show_image(self.image)

    def show_image(self, image):
        """Show the image on canvas."""
        show_image = image.resize((self.width, self.height))
        self.tk_image = ImageTk.PhotoImage(show_image)
        self.cv.create_image(0, 0, anchor="nw", image=self.tk_image)
        self.cv.pack(fill=BOTH, expand=YES)
{'fraction_non_alphanumeric': 0.10433174854727945, 'fraction_numerical': 0.010036978341257264, 'mean_word_length': 1.728386167146974, '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': '4294767', 'n_tokens_mistral': 1103, 'n_tokens_neox': 1051, 'n_words': 274}