# Path: nesoni/workspace.py
# class Workspace(object):
#     def __init__(self, working_dir, must_exist=False):
#     def param(self):
#     def update_param(self, remove=[], **updates):
#     def open(self, path, mode):
#     def object_exists(self, path):
#     def get_object(self, path, plain_text=False):
#     def set_object(self, obj, path, plain_text=False):
#     def path_as_relative_path(self, path):        
#     def relative_path_as_path(self, path):
#     def __div__(self, path):
# def tempspace(dir=None):


import sys, os, pickle, traceback, textwrap, re, copy, functools, types, datetime, pipes, platform
            import nesoni
            import resource 
                import resource 
from nesoni import workspace
    from . import grace
    from . import grace
    from . import io
        from nesoni import legion
        from nesoni import legion
            from nesoni import grace
        from nesoni import io
        from nesoni import io    
            raise Error('You need to specify a prefix for the output files.')


@Positional('output_dir', 'Directory for output files (will be created if does not exist).')
class Action_with_output_dir(Action_with_log):
    output_dir = None

    _workspace_class = workspace.Workspace
    def get_workspace(self):
        return self._workspace_class(self.output_dir, must_exist=False)

    def ident(self):
        return Action.ident(self) + '--' + (self.output_dir or '')    

    def log_filename(self):
        if self.output_dir is None: return None
        return os.path.join(self.output_dir, self.shell_name() + '_log.txt')

    def state_filename(self):
        return os.path.join(self.output_dir, self.shell_name() + '.state')
    
    def _before_run(self):
        if not self.output_dir:
            raise Error('You need to specify an output directory.')


@Positional('working_dir', 'Directory for input and output files.')
class Action_with_working_dir(Action_with_log):
    working_dir = None
    

# Path: nesoni/workspace.py
# class Workspace(object):
#     def __init__(self, working_dir, must_exist=False):
#     def param(self):
#     def update_param(self, remove=[], **updates):
#     def open(self, path, mode):
#     def object_exists(self, path):
#     def get_object(self, path, plain_text=False):
#     def set_object(self, obj, path, plain_text=False):
#     def path_as_relative_path(self, path):        
#     def relative_path_as_path(self, path):
#     def __div__(self, path):
# def tempspace(dir=None):


# Path: nesoni/config.py
import sys, os, pickle, traceback, textwrap, re, copy, functools, types, datetime, pipes, platform
            import nesoni
            import resource 
                import resource 
from nesoni import workspace
    from . import grace
    from . import grace
    from . import io
        from nesoni import legion
        from nesoni import legion
            from nesoni import grace
        from nesoni import io
        from nesoni import io    

            raise Error('You need to specify a prefix for the output files.')


@Positional('output_dir', 'Directory for output files (will be created if does not exist).')
class Action_with_output_dir(Action_with_log):
    output_dir = None

    _workspace_class = workspace.Workspace
    def get_workspace(self):
        return self._workspace_class(self.output_dir, must_exist=False)

    def ident(self):
        return Action.ident(self) + '--' + (self.output_dir or '')    

    def log_filename(self):
        if self.output_dir is None: return None
        return os.path.join(self.output_dir, self.shell_name() + '_log.txt')

    def state_filename(self):
        return os.path.join(self.output_dir, self.shell_name() + '.state')
    
    def _before_run(self):
        if not self.output_dir:
            raise Error('You need to specify an output directory.')


@Positional('working_dir', 'Directory for input and output files.')
class Action_with_working_dir(Action_with_log):
    working_dir = None
    

    _workspace_class = workspace.Workspace