def initialize(self, prefix_name='default', *args, **kwargs):
        """
        Initializes a workdir by adding a new prefix to the workdir.

        Args:
            prefix_name(str): Name of the new prefix to add
            *args: args to pass along to the prefix constructor
            *kwargs: kwargs to pass along to the prefix constructor

        Returns:
            The newly created prefix

        Raises:
            PrefixAlreadyExists: if the prefix name already exists in the
                workdir
        """
        if self.loaded:
            raise WorkdirError('Workdir %s already initialized' % self.path)

        if not os.path.exists(self.path):
            LOGGER.debug('Creating workdir %s', self.path)
            os.makedirs(self.path)

        self.prefixes[prefix_name] = self.prefix_class(
            self.join(prefix_name), *args, **kwargs
        )
        self.prefixes[prefix_name].initialize()
        if self.current is None:
            self._set_current(prefix_name)

        self.load()

        return self.prefixes[prefix_name]
def initialize ( self , prefix_name = 'default' , * args , ** kwargs ) : if self . loaded : raise WorkdirError ( 'Workdir %s already initialized' % self . path ) if not os . path . exists ( self . path ) : LOGGER . debug ( 'Creating workdir %s' , self . path ) os . makedirs ( self . path ) self . prefixes [ prefix_name ] = self . prefix_class ( self . join ( prefix_name ) , * args , ** kwargs ) self . prefixes [ prefix_name ] . initialize ( ) if self . current is None : self . _set_current ( prefix_name ) self . load ( ) return self . prefixes [ prefix_name ]
Initializes a workdir by adding a new prefix to the workdir.

        Args:
            prefix_name(str): Name of the new prefix to add
            *args: args to pass along to the prefix constructor
            *kwargs: kwargs to pass along to the prefix constructor

        Returns:
            The newly created prefix

        Raises:
            PrefixAlreadyExists: if the prefix name already exists in the
                workdir