CoolFace
Datasetpublic

23ws-LLMcoder/LLMcoder-GitHub-Python-Mix-Direct

Dataset Card for LLMcoder-GitHub-Python-Mix-Direct Python target autocomplete suggestions in the format of conversations for OpenAI's fine-tuning. Dataset Details Dataset Description Curated by: [More Information Needed] Funded by [optional]: [More Information Needed] Shared by [optional]: [More Information Needed] Language(s) (NLP): [More Information Needed] License: [More Information Needed] Dataset Sources [optional] The data… See the full description on the dataset page: https://huggingface.co/datasets/23ws-LLMcoder/LLMcoder-GitHub-Python-Mix-Direct.

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes216downloads
input.txt123 linesDownload Raw Back to pair_31
1#2# The Python Imaging Library.3# $Id$4#5# standard image operations6#7# History:8# 2001-10-20 fl   Created9# 2001-10-23 fl   Added autocontrast operator10# 2001-12-18 fl   Added Kevin's fit operator11# 2004-03-14 fl   Fixed potential division by zero in equalize12# 2005-05-05 fl   Fixed equalize for low number of values13#14# Copyright (c) 2001-2004 by Secret Labs AB15# Copyright (c) 2001-2004 by Fredrik Lundh16#17# See the README file for information on usage and redistribution.18#19 20import functools21import operator22import re23 24from . import ExifTags, Image, ImagePalette25 26#27# helpers28 29 30def _border(border):31    if isinstance(border, tuple):32        if len(border) == 2:33            left, top = right, bottom = border34        elif len(border) == 4:35            left, top, right, bottom = border36    else:37        left = top = right = bottom = border38    return left, top, right, bottom39 40 41def _color(color, mode):42    if isinstance(color, str):43        from . import ImageColor44 45        color = ImageColor.getcolor(color, mode)46    return color47 48 49def _lut(image, lut):50    if image.mode == "P":51        # FIXME: apply to lookup table, not image data52        msg = "mode P support coming soon"53        raise NotImplementedError(msg)54    elif image.mode in ("L", "RGB"):55        if image.mode == "RGB" and len(lut) == 256:56            lut = lut + lut + lut57        return image.point(lut)58    else:59        msg = f"not supported for mode {image.mode}"60        raise OSError(msg)61 62 63#64# actions65 66 67def autocontrast(image, cutoff=0, ignore=None, mask=None, preserve_tone=False):68    """69    Maximize (normalize) image contrast. This function calculates a70    histogram of the input image (or mask region), removes ``cutoff`` percent of the71    lightest and darkest pixels from the histogram, and remaps the image72    so that the darkest pixel becomes black (0), and the lightest73    becomes white (255).74 75    :param image: The image to process.76    :param cutoff: The percent to cut off from the histogram on the low and77                   high ends. Either a tuple of (low, high), or a single78                   number for both.79    :param ignore: The background pixel value (use None for no background).80    :param mask: Histogram used in contrast operation is computed using pixels81                 within the mask. If no mask is given the entire image is used82                 for histogram computation.83    :param preserve_tone: Preserve image tone in Photoshop-like style autocontrast.84 85                          .. versionadded:: 8.2.086 87    :return: An image.88    """89    if preserve_tone:90        histogram = image.convert("L").histogram(mask)91    else:92        histogram = image.histogram(mask)93 94    lut = []95    for layer in range(0, len(histogram), 256):96        h = histogram[layer : layer + 256]97        if ignore is not None:98            # get rid of outliers99            try:100                h[ignore] = 0101            except TypeError:102                # assume sequence103                for ix in ignore:104                    h[ix] = 0105        if cutoff:106            # cut off pixels from both ends of the histogram107            if not isinstance(cutoff, tuple):108                cutoff = (cutoff, cutoff)109            # get number of pixels110            n = 0111            for ix in range(256):112                n = n + h[ix]113            # remove cutoff% pixels from the low end114            cut = n * cutoff[0] // 100115            for lo in range(256):116                if cut > h[lo]:117                    cut = cut - h[lo]118                    h[lo] = 0119                else:120                    h[lo] -= cut121                    cut = 0122                if cut <= 0:123