summaryrefslogtreecommitdiff
path: root/python/databuffer.py
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2022-01-27 22:43:28 -0500
committerKyleMiles <krm504@nyu.edu>2022-01-28 00:24:06 -0500
commit6812c973c9fa9b4ad642ab81856c05f87bd6fcc4 (patch)
treedace4156d03148bcaf02df138ab4e0d93e61bc6f /python/databuffer.py
parent519c9db22367f2659d1a54599fab47e6313be06e (diff)
Format All Files
Diffstat (limited to 'python/databuffer.py')
-rw-r--r--python/databuffer.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/python/databuffer.py b/python/databuffer.py
index df16cc54..f4905cbd 100644
--- a/python/databuffer.py
+++ b/python/databuffer.py
@@ -25,8 +25,10 @@ from typing import Optional, Union
from . import _binaryninjacore as core
DataBufferInputType = Union[str, bytes, 'DataBuffer', int]
+
+
class DataBuffer:
- def __init__(self, contents:Union[str, bytes, 'DataBuffer', int]=b"", handle=None):
+ def __init__(self, contents: Union[str, bytes, 'DataBuffer', int] = b"", handle=None):
if handle is not None:
self.handle = core.handle_of_type(handle, core.BNDataBuffer)
elif isinstance(contents, int):
@@ -147,24 +149,24 @@ class DataBuffer:
return core.BNDataBufferToBase64(self.handle)
def base64_decode(self) -> 'DataBuffer':
- return DataBuffer(handle = core.BNDecodeBase64(str(self)))
+ return DataBuffer(handle=core.BNDecodeBase64(str(self)))
def zlib_compress(self) -> Optional['DataBuffer']:
buf = core.BNZlibCompress(self.handle)
if buf is None:
return None
- return DataBuffer(handle = buf)
+ return DataBuffer(handle=buf)
def zlib_decompress(self) -> Optional['DataBuffer']:
buf = core.BNZlibDecompress(self.handle)
if buf is None:
return None
- return DataBuffer(handle = buf)
+ return DataBuffer(handle=buf)
-def escape_string(text:bytes) -> str:
+def escape_string(text: bytes) -> str:
return DataBuffer(text).escape()
-def unescape_string(text:bytes) -> 'DataBuffer':
+def unescape_string(text: bytes) -> 'DataBuffer':
return DataBuffer(text).unescape()