Skip to content

Commit

Permalink
(#197) renaming external_files to extras in archives.base.Archive
Browse files Browse the repository at this point in the history
  • Loading branch information
snake-biscuits committed Nov 7, 2024
1 parent f080cd6 commit 34ae341
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bsp_tool/archives/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ def path_tuple(path: str) -> Tuple[str]:

class Archive:
ext = None
external_filenames: Dict[str, io.BytesIO]
extras: Dict[str, io.BytesIO]

def __init__(self):
self.external_filenames = dict()
self.extras = dict()

def extract(self, filename, to_path=None):
if filename not in self.namelist():
Expand Down Expand Up @@ -65,9 +65,9 @@ def listdir(self, folder: str) -> List[str]:

def mount_file(self, filename: str, archive=None):
if archive is None:
self.external_files[filename] = open(filename, "rb")
self.extras[filename] = open(filename, "rb")
else:
self.external_files[filename] = io.BytesIO(archive.read(filename))
self.extras[filename] = io.BytesIO(archive.read(filename))

def namelist(self) -> List[str]:
# NOTE: we assume namelist only contains filenames, no folders
Expand All @@ -93,7 +93,7 @@ def tree(self, folder: str = ".", depth: int = 0):
self.tree(full_filename, depth + 1)

def unmount_file(self, filename: str):
self.external_files.pop(filename)
self.extras.pop(filename)

@classmethod
def from_archive(cls, parent_archive: Archive, filename: str) -> Archive:
Expand Down

0 comments on commit 34ae341

Please sign in to comment.