def rename(self, src, dst): """Rename the label of all nodes matching 'src' to 'lbl'.""" # Sanity checks if not isinstance(src, string_types): raise TypeError("src MUST be a string!") if not isinstance(dst, string_types): raise TypeError("dst MUST be a string!") if not self.__handle: raise RuntimeError("The Augeas object has already been closed!") # Call the function ret = lib.aug_rename(self.__handle, enc(src), enc(dst)) if ret < 0: raise ValueError("Unable to rename src as dst!") return ret
def rename(self, src, dst): """ Rename the label of all nodes matching `src` to `dst`. """ # Sanity checks if not isinstance(src, string_types): raise TypeError("src MUST be a string!") if not isinstance(dst, string_types): raise TypeError("dst MUST be a string!") if not self.__handle: raise RuntimeError("The Augeas object has already been closed!") # Call the function ret = lib.aug_rename(self.__handle, enc(src), enc(dst)) if ret < 0: self._raise_error(AugeasValueError, "Augeas.rename() failed") return ret