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

import argparse
import datetime

def generate_post_file(title, location, disqus_name=None):
    title_line = "title: {}".format(title)
    filename = make_filename(title, get_date_formatted(datetime.date.today()))

    with open(filename, mode='x', encoding='utf-8') as actual_file:
        print('---', file=actual_file)
        print('layout: post', file=actual_file)
        print(title_line, file=actual_file)
        print('excerpt: Your excerpt goes here', file=actual_file)
        print('tags: tag1, tag2', file=actual_file)
        print('---', file=actual_file)
        print('Your post content goes here', file=actual_file)
    return filename

def make_filename(post_title, date_prefix):
    title_formatted = post_title.replace(' ', '-')
    filename = date_prefix + '-' + title_formatted + '.md'
    return filename

def get_date_formatted(date):
    """
    Return the date in the format: 'YEAR-MONTH-DAY'
    """

    year = str(date.year)
    month = str(date.month)
    day = str(date.day)<commit_msg>fix bug (wasn't creating the post file in the specified directory)<commit_after>#!/usr/bin/env python3

import argparse
import datetime
import os

def generate_post_file(title, location, disqus_name=None):
    title_line = "title: {}".format(title)
    filename = make_filename(title, get_date_formatted(datetime.date.today()))

    os.chdir(location) # switch to destination directory

    with open(filename, mode='x', encoding='utf-8') as actual_file:
        print('---', file=actual_file)
        print('layout: post', file=actual_file)
        print(title_line, file=actual_file)
        print('excerpt: Your excerpt goes here', file=actual_file)
        print('tags: tag1, tag2', file=actual_file)
        print('---', file=actual_file)
        print('Your post content goes here', file=actual_file)
    return filename

def make_filename(post_title, date_prefix):
    title_formatted = post_title.replace(' ', '-')
    filename = date_prefix + '-' + title_formatted + '.md'
    return filename

def get_date_formatted(date):
    """
    Return the date in the format: 'YEAR-MONTH-DAY'
    """

    year = str(date.year)
    month = str(date.month)
    day = str(date.day)
{'fraction_non_alphanumeric': 0.13276709879302637, 'fraction_numerical': 0.003576218149307108, 'mean_word_length': 3.711578947368421, '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': '5678577', 'n_tokens_mistral': 716, 'n_tokens_neox': 697, 'n_words': 166}