Skip to content

Commit

Permalink
Add deprecation notice for Resource.flush_to_disk (redballoonsecurity…
Browse files Browse the repository at this point in the history
  • Loading branch information
whyitfor authored Jan 14, 2025
1 parent d6f10cb commit 7edd54e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ofrak_core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Update registered identifiers to make use of new `MagicIdentifier` for following resource tags: `Apk`, `Bzip2Data`, `CpioFilesystem`, `DeviceTreeBlob`, `Elf`, `Ext2Filesystem`, `Ext3Filesystem`, `Ext4Filesystem`, `GzipData`, `ISO9660Image`, `Jffs2Filesystem`, `LzmaData`, `XzData`, `LzoData`, `OpenWrtTrx`, `Pe`, `RarArchive`, `SevenZFilesystem`, `SquashfsFilesystem`, `TarArchive`, `Ubi`, `Ubifs`, `Uf2File`, `UImage`, `ZipArchive`, `ZlibData`, `ZstdData`
- Update `Instruction.get_assembly` to by synchronous ([#539](https://github.com/redballoonsecurity/ofrak/issues/539))

### Deprecated
- `Resource.flush_to_disk` deprecated in favor of `Resource.flush_data_to_disk`. ([#373](https://github.com/redballoonsecurity/ofrak/pull/373), [#567](https://github.com/redballoonsecurity/ofrak/pull/568))

### Removed
- Removed `Instruction.disassembly` from `Instruction` class: use `Instruction.get_assembly()` instead ([#539](https://github.com/redballoonsecurity/ofrak/issues/539))

Expand Down
9 changes: 9 additions & 0 deletions ofrak_core/ofrak/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
overload,
)
from contextlib import asynccontextmanager
from warnings import warn

import tempfile312 as tempfile

from ofrak.component.interface import ComponentInterface
Expand Down Expand Up @@ -1451,6 +1453,13 @@ async def flush_data_to_disk(self, path: str, pack: bool = True):
with open(path, "wb") as f:
pass

async def flush_to_disk(self, path: str, pack: bool = True): # pragma: no cover
warn(
"Resource.flush_to_disk is deprecated! Use Resource.flush_data_to_disk instead.",
category=DeprecationWarning,
)
return await self.flush_data_to_disk(path, pack)

def __repr__(self):
properties = [
f"resource_id={self._resource.id.hex()}",
Expand Down

0 comments on commit 7edd54e

Please sign in to comment.