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

import os
import shutil
import sys

import mezzanine


class ProjectException(Exception):
    pass
    
def create_project():
    """
    Copies the contents of the project_template directory to a new directory 
    specified as an argument to the command line.
    """

    # Ensure a directory name is specified.
    script_name = os.path.basename(sys.argv[0])
    if len(sys.argv) == 1:
        raise ProjectException("Usage: %s project_name" % script_name)

    # Ensure the given directory name doesn't clash with an existing Python 
    # package/module.
    try:
        __import__(sys.argv[1])
    except ImportError:
        pass
    else:
        raise ProjectException("'%s' conflicts with the name of an existing "
            "Python module and cannot be used as a project name. Please try "
            "another name." % sys.argv[1])
                    
    mezzanine_path = os.path.dirname(os.path.abspath(mezzanine.__file__))
    from_path = os.path.join(mezzanine_path, "project_template")
    to_path = os.path.join(os.getcwd(), sys.argv[1])
    shutil.copytree(from_path, to_path)
        
if __name__ == "__main__":
    try:
        create_project()
    except ProjectException, e:
        print
        print e
        print
        

<commit_msg>project_name variable instead of continual using sys.argv[1]<commit_after>#!/usr/bin/env python

import os
import shutil
import sys

import mezzanine


class ProjectException(Exception):
    pass
    
def create_project():
    """
    Copies the contents of the project_template directory to a new directory 
    specified as an argument to the command line.
    """

    # Ensure a directory name is specified.
    script_name = os.path.basename(sys.argv[0])
    if len(sys.argv) == 1:
        raise ProjectException("Usage: %s project_name" % script_name)
    project_name = sys.argv[1]

    # Ensure the given directory name doesn't clash with an existing Python 
    # package/module.
    try:
        __import__(project_name)
    except ImportError:
        pass
    else:
        raise ProjectException("'%s' conflicts with the name of an existing "
            "Python module and cannot be used as a project name. Please try "
            "another name." % project_name)
                    
    mezzanine_path = os.path.dirname(os.path.abspath(mezzanine.__file__))
    from_path = os.path.join(mezzanine_path, "project_template")
    to_path = os.path.join(os.getcwd(), project_name)
    shutil.copytree(from_path, to_path)
        
if __name__ == "__main__":
    try:
        create_project()
    except ProjectException, e:
        print
        print e
        print
        


{'fraction_non_alphanumeric': 0.08682745825602968, 'fraction_numerical': 0.003339517625231911, 'mean_word_length': 2.552042160737813, 'pattern_counts': {'":': 2, '<': 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': '3933075', 'n_tokens_mistral': 814, 'n_tokens_neox': 787, 'n_words': 238}