<commit_before>#!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys
import os
import django_structurer
from django_structurer.structurer import project_starter

if __name__ == "__main__":
    project_name = sys.argv[1]
    try:
        yaml_project = file(sys.argv[2], 'r')
    except:
        default_proj = os.path.join(django_structurer.__path__[0], 'default_structure.yaml')
        yaml_project = file(default_proj,'r')

    project_starter(project_name, yaml_project)<commit_msg>now it tries to load the file passed as second argument, but if its not in that folder it tries it on the enviroment folder for djstruct<commit_after>#!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys
import os
import django_structurer
from django_structurer.structurer import project_starter
from django_structurer.snippets_readers import CUSTOM_SNIPPETS

DEFAULT_PROJECT = os.path.join(django_structurer.__path__[0], 'default_structure.yaml')

def check_file(file_name, path):
    try:        
        file_path = os.path.join(path,file_name)
        yaml_file = file(file_path, 'r')
        return yaml_file
    except:
        return None

def tries_different_paths_for_file(file_name):    
    yaml_file = check_file(file_name, "./")
    if yaml_file == None:            
        yaml_file = check_file(file_name, CUSTOM_SNIPPETS)
        if yaml_file == None:
            yaml_file = file(DEFAULT_PROJECT,'r')

    return yaml_file

if __name__ == "__main__":
    project_name = sys.argv[1]
    yaml_project = DEFAULT_PROJECT
    try:        
        yaml_project = sys.argv[2]
    except IndexError:
        pass    

    yaml_file = tries_different_paths_for_file(yaml_project)
    project_starter(project_name, yaml_file)

{'fraction_non_alphanumeric': 0.09175377468060394, 'fraction_numerical': 0.004645760743321719, 'mean_word_length': 3.4637305699481864, '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': '5916325', 'n_tokens_mistral': 576, 'n_tokens_neox': 548, 'n_words': 123}