# Path: nudge/utils.py
# class Dict(dict):
#     def __getattr__(self, attr):
#         return self.get(attr, None)
#     __setattr__= dict.__setitem__
#     __delattr__= dict.__delitem__


import os
from nudge.utils import Dict
from jinja2 import Environment, FileSystemLoader
    'get_template',
    'DefaultGenerator',
]

def get_template(filename=None):
    assert filename, "I need a filename, smartypants"
    text=None
    filepath = os.path.join(template_dir, filename)
    assert os.path.exists(filepath), "The template file doesn't exist"
    text = open(filepath, "r").read()
    assert text, "How about some text"
    return template_env.get_template(filename)

class DefaultGenerator(object):
    extension = 'txt'
    template = get_template('default.txt')

    def __init__(self, dir='/tmp', filename='autogenerated_output'):
        self.dir = dir
        if not os.path.exists(dir):
            os.makedirs(dir)
        self.filename = filename
        self.output_file = self._filepath(self.filename)
        self.ensure_output_file()

    def _filepath(self, filename, subdir=None, extension=None):
        dir = self.dir 
        if subdir:
            dir += '/' + subdir
        if not os.path.exists(dir):

# Path: nudge/utils.py
# class Dict(dict):
#     def __getattr__(self, attr):
#         return self.get(attr, None)
#     __setattr__= dict.__setitem__
#     __delattr__= dict.__delitem__


# Path: nudge/automagic/scribes/default.py
import os
from nudge.utils import Dict
from jinja2 import Environment, FileSystemLoader

    'get_template',
    'DefaultGenerator',
]

def get_template(filename=None):
    assert filename, "I need a filename, smartypants"
    text=None
    filepath = os.path.join(template_dir, filename)
    assert os.path.exists(filepath), "The template file doesn't exist"
    text = open(filepath, "r").read()
    assert text, "How about some text"
    return template_env.get_template(filename)

class DefaultGenerator(object):
    extension = 'txt'
    template = get_template('default.txt')

    def __init__(self, dir='/tmp', filename='autogenerated_output'):
        self.dir = dir
        if not os.path.exists(dir):
            os.makedirs(dir)
        self.filename = filename
        self.output_file = self._filepath(self.filename)
        self.ensure_output_file()

    def _filepath(self, filename, subdir=None, extension=None):
        dir = self.dir 
        if subdir:
            dir += '/' + subdir
        if not os.path.exists(dir):

            os.makedirs(dir)