<commit_before>import locale
import math

from wand.image import Image
from wand.color import Color
from wand.drawing import Drawing


WIDTH = 968
HEIGHT = 484

ZOOM_MULTIPLE = 1.7

GREEN = '#093'
RED = '#d14836'
GREY = '#666666'
BLACK = '#000000'
WHITE = '#ffffff'
BG_GREEN = '#4A913C'

WATERMARK_HEIGHT = 50


def comma(n):
    locale.setlocale(locale.LC_ALL, 'en_US')
    n = float(n)
    return locale.format("%.02f", n, grouping=True)


def millify(n):
    n = float(n)
    if n < 10 ** 6:
        return comma(n)[:-3]

    millnames = ['', '', 'M', 'B', 'T']
    millidx = max(0, min(len(millnames) - 1,
                         int(math.floor(0 if n == 0 else math.log10(abs(n)) / 3))))

    return '{:.01f}{}'.format(n / 10 ** (3 * millidx), millnames[millidx])


def create_image(share, chart_file, out_file):
    # Unpack the quote
    price = share['price']
    change = share['change']
    change_percent = share['change_percent']
    open_price = share['open_price']
    market_cap = share['market_cap']
    year_low = share['year_low']
    year_high = share['year_high']
    day_low = share['day_low']
    day_high = share['day_high']
    volume = share['volume']
    pe_ratio = share['pe_ratio']


    with Color('white') as bg:
        with Image(width=WIDTH, height=HEIGHT, background=bg) as img:
            with Image(filename=chart_file) as chart_img:
                w = int(chart_img.size[0] * ZOOM_MULTIPLE)
                h = int(chart_img.size[1] * ZOOM_MULTIPLE)

                with Drawing() as draw:

                    draw.font = 'fonts/arial.ttf'

                    # Draw watermark
                    draw.fill_color = Color(BG_GREEN)
                    draw.rectangle(left=0, top=HEIGHT-WATERMARK_HEIGHT, right=WIDTH, bottom=HEIGHT)
                    draw(img)
                    draw.font_size = 20
                    draw.fill_color = Color(WHITE)
                    draw.text(WIDTH-150, HEIGHT-WATERMARK_HEIGHT+50, '@slashStock')
<commit_msg>move the watermark in +x a bit<commit_after>import locale
import math

from wand.image import Image
from wand.color import Color
from wand.drawing import Drawing


WIDTH = 968
HEIGHT = 484

ZOOM_MULTIPLE = 1.7

GREEN = '#093'
RED = '#d14836'
GREY = '#666666'
BLACK = '#000000'
WHITE = '#ffffff'
BG_GREEN = '#4A913C'

WATERMARK_HEIGHT = 50


def comma(n):
    locale.setlocale(locale.LC_ALL, 'en_US')
    n = float(n)
    return locale.format("%.02f", n, grouping=True)


def millify(n):
    n = float(n)
    if n < 10 ** 6:
        return comma(n)[:-3]

    millnames = ['', '', 'M', 'B', 'T']
    millidx = max(0, min(len(millnames) - 1,
                         int(math.floor(0 if n == 0 else math.log10(abs(n)) / 3))))

    return '{:.01f}{}'.format(n / 10 ** (3 * millidx), millnames[millidx])


def create_image(share, chart_file, out_file):
    # Unpack the quote
    price = share['price']
    change = share['change']
    change_percent = share['change_percent']
    open_price = share['open_price']
    market_cap = share['market_cap']
    year_low = share['year_low']
    year_high = share['year_high']
    day_low = share['day_low']
    day_high = share['day_high']
    volume = share['volume']
    pe_ratio = share['pe_ratio']


    with Color('white') as bg:
        with Image(width=WIDTH, height=HEIGHT, background=bg) as img:
            with Image(filename=chart_file) as chart_img:
                w = int(chart_img.size[0] * ZOOM_MULTIPLE)
                h = int(chart_img.size[1] * ZOOM_MULTIPLE)

                with Drawing() as draw:

                    draw.font = 'fonts/arial.ttf'

                    # Draw watermark
                    draw.fill_color = Color(BG_GREEN)
                    draw.rectangle(left=0, top=HEIGHT-WATERMARK_HEIGHT, right=WIDTH, bottom=HEIGHT)
                    draw(img)
                    draw.font_size = 20
                    draw.fill_color = Color(WHITE)
                    draw.text(WIDTH-150, HEIGHT-WATERMARK_HEIGHT+30, '@slashStock')

{'fraction_non_alphanumeric': 0.1352838209552388, 'fraction_numerical': 0.031007751937984496, 'mean_word_length': 2.392705682782019, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2044427', 'n_tokens_mistral': 1495, 'n_tokens_neox': 1336, 'n_words': 302}