code: def __rename_directory(self, source, target):
          
  
          for node in itertools.chain(self.__script_editor.model.get_project_nodes(source),
                                      self.__script_editor.model.get_directory_nodes(source)):
              self.__script_editor.model.unregister_project_nodes(node)
              self.__script_editor.unregister_node_path(node)
              self.__rename_path(source, target)
              node.name = os.path.basename(target)
              node.path = target
              self.__script_editor.model.node_changed(node)
              self.__script_editor.register_node_path(node)
              self.__script_editor.model.set_project_nodes(node)
docs: Renames a directory using given source and target names.
  
          :param source: Source file.
          :type source: unicode
          :param target: Target file.
          :type target: unicode