Пример #1
0
    def delDirs(self, dirs):
        """
		Delete Directories

		@param dirs: directories to be created
		@type dirs: List of str
		"""
        self.__delActualDirs(dirs)
        Tagging.delTagsFromElements(self, dirs)
Пример #2
0
	def delDirs(self, dirs):
		"""
		Delete Directories

		@param dirs: directories to be created
		@type dirs: List of str
		"""
		self.__delActualDirs(dirs)
		Tagging.delTagsFromElements(self, dirs)
Пример #3
0
	def delFiles(self, files, dirs=[]):
		"""
		Delete files

		@param files: List of files to be used
		@type files: List of instances of L{TagFile}
		"""

		Tagging.delElementsFromTags(self, files, tagList=dirs)
Пример #4
0
    def delFiles(self, files, dirs=[]):
        """
		Delete files

		@param files: List of files to be used
		@type files: List of instances of L{TagFile}
		"""

        Tagging.delElementsFromTags(self, files, tagList=dirs)
Пример #5
0
    def renameDir(self, dirs1, dirs2):
        """
		Rename directories
		"""

        fileList = Tagging.getElements(self, tagList=dirs1)
        Tagging.delTagsFromElements(self, dirs1, elementList=fileList)
        Tagging.addTags(self, elementList=fileList, newTagList=dirs2)

        if [dirs1[-1] != dirs2[-1]]:
            self.__renameActualDir(dirs1[-1], dirs2[-1])
Пример #6
0
	def renameDir(self, dirs1, dirs2):
		"""
		Rename directories
		"""
		
		fileList = Tagging.getElements(self, tagList=dirs1)
		Tagging.delTagsFromElements(self, dirs1, elementList=fileList)
		Tagging.addTags(self, elementList=fileList, newTagList=dirs2)

		if [dirs1[-1] != dirs2[-1]]:
			self.__renameActualDir(dirs1[-1], dirs2[-1])
Пример #7
0
	def createDirs(self, dirs, mode=DEFAULT_DIR_MODE):
		"""
		Create Directories

		@param dirs: directories to be created
		@type dirs: List of str

		@param mode: Mode with which the directories are to be created, if required
		@type mode: int
		"""
		self.__createActualDirs(dirs, mode)
		Tagging.addTags(self, newTagList=dirs)
Пример #8
0
    def createDirs(self, dirs, mode=DEFAULT_DIR_MODE):
        """
		Create Directories

		@param dirs: directories to be created
		@type dirs: List of str

		@param mode: Mode with which the directories are to be created, if required
		@type mode: int
		"""
        self.__createActualDirs(dirs, mode)
        Tagging.addTags(self, newTagList=dirs)
Пример #9
0
    def delFilesFromDirs(self, files, dirs):
        """
		Delete files from directories

		@param files: List of files to be used
		@type files: List of instances of L{TagFile}

		@param dirs: List of directories
		@type dirs: List of str
		"""

        self.__delActualDirs(dirs)
        Tagging.delTagsFromElements(self, dirs, files)
Пример #10
0
	def delFilesFromDirs(self, files, dirs):
		"""
		Delete files from directories

		@param files: List of files to be used
		@type files: List of instances of L{TagFile}

		@param dirs: List of directories
		@type dirs: List of str
		"""

		self.__delActualDirs(dirs)
		Tagging.delTagsFromElements(self, dirs, files)
Пример #11
0
    def addDirsToFiles(self, fileList, dirList, mode=DEFAULT_DIR_MODE):
        """
		Associates the specified directories to the specified files

		@param fileList: List of files to be used
		@type fileList: List of instances of L{TagFile}

		@param dirList: List of directories
		@type dirList: List of str

		@param mode: Mode with which the directories are to be created, if required
		@type mode: int
		"""
        self.__createActualDirs(dirList, mode)
        Tagging.addTags(self, fileList, dirList)
Пример #12
0
	def addDirsToFiles(self, fileList, dirList, mode=DEFAULT_DIR_MODE):
		"""
		Associates the specified directories to the specified files

		@param fileList: List of files to be used
		@type fileList: List of instances of L{TagFile}

		@param dirList: List of directories
		@type dirList: List of str

		@param mode: Mode with which the directories are to be created, if required
		@type mode: int
		"""
		self.__createActualDirs(dirList, mode)
		Tagging.addTags(self, fileList, dirList)
Пример #13
0
	def getActualLocation(self, dirs, filename):
		filesInDir = Tagging.getElements(self, dirs)
		matchingFiles = [x for x in filesInDir if x.name == filename]
		if len(matchingFiles) == 0:
			return None
		else:
			return matchingFiles[0].location
Пример #14
0
	def getDirsAndFilesForDirs(self, dirList, beRestrictive=False, getCover=False):
		"""
		Get files contained in all the directories specified in dirList. Also get list of other directories which contain ANY of these files

		@param dirList: List of directories to be used
		@type dirList: List of str

		@param beRestrictive: Only return those directories which are NOT associated with ALL the files
			with which the given list of directories is associated.

			The philosophy behind this is, having already got a set of files associated
			with the given set of directories, it would be useful to find directories that would restrict
			the set set of directories further. This helps in creating an hierarchy of directories.

			Defaults to False

		@type beRestrictive: bool

		@param getCover: Get a set of directories which between them contain all the files that are contianed
			within the given set of directories.

			This helps particularly when there are large number of tags in the system. Instead of
			looking at 100s of directories it would be helpful to look at only those directories which cover all
			currently selected files.

			Defaults to False

		@type getCover: bool

		@return: A tuple of list of directories and list of files
		@rtype: (List of str, List of instances of L{TagFile})
		"""

		return Tagging.getTagsAndElementsForTags(self, dirList, beRestrictive, getCover)
Пример #15
0
 def getActualLocation(self, dirs, filename):
     filesInDir = Tagging.getElements(self, dirs)
     matchingFiles = [x for x in filesInDir if x.name == filename]
     if len(matchingFiles) == 0:
         return None
     else:
         return matchingFiles[0].location
Пример #16
0
	def getAllDirs(self):
		"""
		Get a list of all directories

		@return: List of all directories
		@rtype: List of str
		"""

		return Tagging.getTagsForTags(self, tagList = [])
Пример #17
0
    def getAllDirs(self):
        """
		Get a list of all directories

		@return: List of all directories
		@rtype: List of str
		"""

        return Tagging.getTagsForTags(self, tagList=[])
Пример #18
0
    def getFilesForDirs(self, dirList):
        """
		Get a list of files which are contained in all of the given directories

		@param dirList: Directories for which to get files
		@type dirList: List of str

		@return: List of files
		@rtype: List of instances of L{TagFile}
		"""
        return Tagging.getElements(self, dirList)
Пример #19
0
	def getFilesForDirs(self, dirList):
		"""
		Get a list of files which are contained in all of the given directories

		@param dirList: Directories for which to get files
		@type dirList: List of str

		@return: List of files
		@rtype: List of instances of L{TagFile}
		"""
		return Tagging.getElements(self, dirList)
Пример #20
0
	def getDirsForDirs(self, dirList):
		"""
		Get directories which contain the files contained in the given directories

		@param dirList: List of directories to be used
		@type dirList: List of str

		@return: List of all directories
		@rtype: List of str
		"""

		return Tagging.getTagsForTags(self, dirList)
Пример #21
0
    def getDirsForDirs(self, dirList):
        """
		Get directories which contain the files contained in the given directories

		@param dirList: List of directories to be used
		@type dirList: List of str

		@return: List of all directories
		@rtype: List of str
		"""

        return Tagging.getTagsForTags(self, dirList)
Пример #22
0
    def getDirsForFiles(self, files):
        """
		Get directories which contain the given files

		@param files: List of files to be used
		@type files: List of instances of L{TagFile}

		@return: List of all directories
		@rtype: List of str
		"""

        return Tagging.getTagsForElements(self, files)
Пример #23
0
	def getDirsForFiles(self, files):
		"""
		Get directories which contain the given files

		@param files: List of files to be used
		@type files: List of instances of L{TagFile}

		@return: List of all directories
		@rtype: List of str
		"""

		return Tagging.getTagsForElements(self, files)
Пример #24
0
    def getDirsAndFilesForDirs(self,
                               dirList,
                               beRestrictive=False,
                               getCover=False):
        """
		Get files contained in all the directories specified in dirList. Also get list of other directories which contain ANY of these files

		@param dirList: List of directories to be used
		@type dirList: List of str

		@param beRestrictive: Only return those directories which are NOT associated with ALL the files
			with which the given list of directories is associated.

			The philosophy behind this is, having already got a set of files associated
			with the given set of directories, it would be useful to find directories that would restrict
			the set set of directories further. This helps in creating an hierarchy of directories.

			Defaults to False

		@type beRestrictive: bool

		@param getCover: Get a set of directories which between them contain all the files that are contianed
			within the given set of directories.

			This helps particularly when there are large number of tags in the system. Instead of
			looking at 100s of directories it would be helpful to look at only those directories which cover all
			currently selected files.

			Defaults to False

		@type getCover: bool

		@return: A tuple of list of directories and list of files
		@rtype: (List of str, List of instances of L{TagFile})
		"""

        return Tagging.getTagsAndElementsForTags(self, dirList, beRestrictive,
                                                 getCover)
Пример #25
0
 def __str__(self):
     return 'Directory helper for ' + Tagging.__str__(self)
Пример #26
0
	def __str__(self):
		return 'Directory helper for ' + Tagging.__str__(self)