Ejemplo n.º 1
0
    def _getEntriesToExtract(
        self,
        tree: mobase.IFileTree,
        extensions: List[str] = ["png", "jpg", "jpeg", "gif", "bmp", "ini"],
    ) -> List[mobase.FileTreeEntry]:
        """
        Retrieve all the entries to extract from the given tree.

        Args:
            tree: The tree.
            extensions: The extensions of files.

        Returns:
            A list of entries corresponding to files with the given extensions.
        """
        entries = []

        def fn(path: str, entry: mobase.FileTreeEntry):
            if entry.isFile() and entry.hasSuffix(extensions):
                entries.append(entry)
            return mobase.IFileTree.CONTINUE

        tree.walk(fn)

        return entries
Ejemplo n.º 2
0
 def getContentsFor(self, tree: mobase.IFileTree) -> List[int]:
     self.content = []
     tree.walk(self.walkContent, "/")
     return self.content