@path_required<EOL><INDENT>def rename_directory(self, relativePath, newName, raiseError=True, ntrials=<NUM_LIT:3>):<DEDENT>
assert isinstance(raiseError, bool), "<STR_LIT>"<EOL>assert isinstance(ntrials, int), "<STR_LIT>"<EOL>assert ntrials><NUM_LIT:0>, "<STR_LIT>"<EOL>relativePath = self.to_repo_relative_path(path=relativePath, split=False)<EOL>parentPath, dirName = os.path.split(relativePath)<EOL>if relativePath == '<STR_LIT>':<EOL><INDENT>error = "<STR_LIT>"<EOL>assert not raiseError, error<EOL>return False, error<EOL><DEDENT>realPath = os.path.join(self.__path,relativePath)<EOL>newRealPath = os.path.join(os.path.dirname(realPath), newName)<EOL>if os.path.isdir(newRealPath):<EOL><INDENT>error = "<STR_LIT>"%(newRealPath,)<EOL>assert not raiseError, error<EOL>return False, error<EOL><DEDENT>LD =  Locker(filePath=None, lockPass=str(uuid.uuid1()), lockPath=os.path.join(self.__path,parentPath, self.__dirLock))<EOL>acquired, code = LD.acquire_lock()<EOL>if not acquired:<EOL><INDENT>error = "<STR_LIT>"%(code,dirPath)<EOL>assert not raiseError, error<EOL>return False, error<EOL><DEDENT>error = None<EOL>LR =  Locker(filePath=None, lockPass=str(uuid.uuid1()), lockPath=os.path.join(self.__path, self.__repoLock))<EOL>acquired, code = LR.acquire_lock()<EOL>if not acquired:<EOL><INDENT>LD.release_lock()<EOL>m = "<STR_LIT>"%(code,dirPath)<EOL>assert raiseError,  Exception(m)<EOL>return False,m<EOL><DEDENT>for _trial in range(ntrials):<EOL><INDENT>try:<EOL><INDENT>repo = self.__load_repository_pickle_file(os.path.join(self.__path, self.__repoFile))<EOL>self.__repo['<STR_LIT>'] = repo['<STR_LIT>']<EOL><DEDENT>except Exception as err:<EOL><INDENT>error = str(err)<EOL>if self.DEBUG_PRINT_FAILED_TRIALS: print("<STR_LIT>"%(_trial, inspect.stack()[<NUM_LIT:1>][<NUM_LIT:3>], str(error)))<EOL><DEDENT>else:<EOL><INDENT>error = None<EOL>break<EOL><DEDENT><DEDENT>if error is not None:<EOL><INDENT>LD.release_lock()<EOL>LR.release_lock()<EOL>assert not raiseError, Exception(error)<EOL>return False, error<EOL><DEDENT>for _trial in range(ntrials):<EOL><INDENT>error = None<EOL>try:<EOL><INDENT>dirList = self.__get_repository_parent_directory(relativePath=relativePath)<EOL>assert dirList is not None, "<STR_LIT>"%(relativePath,)<EOL>_dirDict = [nd for nd in dirList  if isinstance(nd,dict)]<EOL>_dirDict = [nd for nd in _dirDict if dirName in nd]<EOL>assert len(_dirDict) == <NUM_LIT:1>, "<STR_LIT>"<EOL>os.rename(realPath, newRealPath)<EOL>_dirDict[<NUM_LIT:0>][newName] = _dirDict[<NUM_LIT:0>][dirName]<EOL>_dirDict[<NUM_LIT:0>].pop(dirName)<EOL>self.__save_dirinfo(description=None, dirInfoPath=parentPath, create=False)<EOL><DEDENT>except Exception as err:<EOL><INDENT>error = str(err)<EOL>if self.DEBUG_PRINT_FAILED_TRIALS: print("<STR_LIT>"%(_trial, inspect.stack()[<NUM_LIT:1>][<NUM_LIT:3>], str(error)))<EOL><DEDENT>else:<EOL><INDENT>error = None<EOL>break<EOL><DEDENT><DEDENT>if error is None:<EOL><INDENT>_, error = self.__save_repository_pickle_file(lockFirst=False, raiseError=False)<EOL><DEDENT>LR.release_lock()<EOL>LD.release_lock()<EOL>assert error is None or not raiseError, "<STR_LIT>"%(relativePath, newName, ntrials, error,)<EOL>return error is None, error<EOL>
Rename a directory in the repository. It insures renaming the directory in the system.

:Parameters:
    #. relativePath (string): The relative to the repository path of
       the directory to be renamed.
    #. newName (string): The new directory name.
    #. raiseError (boolean): Whether to raise encountered error instead
       of returning failure.
    #. ntrials (int): After aquiring all locks, ntrials is the maximum
       number of trials allowed before failing.
       In rare cases, when multiple processes
       are accessing the same repository components, different processes
       can alter repository components between successive lock releases
       of some other process. Bigger number of trials lowers the
       likelyhood of failure due to multiple processes same time
       alteration.

:Returns:
    #. success (boolean): Whether renaming the directory was successful.
    #. message (None, string): Some explanatory message or error reason
       why directory was not renamed.