<commit_before>"""
utils.wget_images
===========

"""
import urllib as _urllib
import os as _os

import delightfulsoup as _ds
import shortcuts as _shc

# -------------------------------------------------------------------------------


def wget_images(imgs, dir_download,
                dir_publish=False,
                img_src_map=dict(),
                custom_img_name=False,
                translate_src=False,
                img_alt=False):
    """
    """

    # A few constants
    png_raw = 'data:image/png;base64'
    http = ('https://', 'http://')

    img_i = 0  # init image counter

    # If not dir_publish given, set it to dir_download
    if not dir_publish:
        dir_publish = dir_download

    for img in imgs:  # loop through imgs
<commit_msg>add default to dir_download, makedirs if does not exists<commit_after>"""
utils.wget_images
===========

"""
import urllib as _urllib
import os as _os

import delightfulsoup as _ds
import shortcuts as _shc

# -------------------------------------------------------------------------------


def wget_images(imgs,
                dir_download='wget-images',
                dir_publish=False,
                img_src_map=dict(),
                custom_img_name=False,
                translate_src=False,
                img_alt=False):
    """
    """

    # A few constants
    png_raw = 'data:image/png;base64'
    http = ('https://', 'http://')

    img_i = 0  # init image counter

    # Make download, if needed
    if not _os.path.exists(dir_download):
        _os.makedirs(dir_download)

    # If not dir_publish given, set it to dir_download
    if not dir_publish:
        dir_publish = dir_download

    for img in imgs:  # loop through imgs

{'fraction_non_alphanumeric': 0.18524970963995355, 'fraction_numerical': 0.003484320557491289, 'mean_word_length': 1.68798751950078, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4805124', 'n_tokens_mistral': 525, 'n_tokens_neox': 490, 'n_words': 134}