Skip to content

Commit

Permalink
Use pybcj instead of bcj-cffi for BCJ filter
Browse files Browse the repository at this point in the history
- Use internal BCJ filter for PyPy3

Signed-off-by: Hiroshi Miura <[email protected]>
  • Loading branch information
miurahr committed Oct 15, 2021
1 parent 0400077 commit 6710061
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions py7zr/bcjfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,31 +251,31 @@ def __init__(self):
super().__init__(self.sparc_code, 4, True)


class PpcDecoder(BCJFilter):
class PPCDecoder(BCJFilter):
def __init__(self, size: int):
super().__init__(self.ppc_code, 4, False, size)


class PpcEncoder(BCJFilter):
class PPCEncoder(BCJFilter):
def __init__(self):
super().__init__(self.ppc_code, 4, True)


class ArmtDecoder(BCJFilter):
class ARMTDecoder(BCJFilter):
def __init__(self, size: int):
super().__init__(self.armt_code, 4, False, size)


class ArmtEncoder(BCJFilter):
class ARMTEncoder(BCJFilter):
def __init__(self):
super().__init__(self.armt_code, 4, True)


class ArmDecoder(BCJFilter):
class ARMDecoder(BCJFilter):
def __init__(self, size: int):
super().__init__(self.arm_code, 4, False, size)


class ArmEncoder(BCJFilter):
class ARMEncoder(BCJFilter):
def __init__(self):
super().__init__(self.arm_code, 4, True)
12 changes: 6 additions & 6 deletions py7zr/compressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,15 @@ def flush(self):

class BcjPpcDecoder(ISevenZipDecompressor):
def __init__(self, size: int):
self.decoder = BCJFilter.PpcDecoder(size)
self.decoder = BCJFilter.PPCDecoder(size)

def decompress(self, data: Union[bytes, bytearray, memoryview], max_length: int = -1) -> bytes:
return self.decoder.decode(data)


class BcjPpcEncoder(ISevenZipCompressor):
def __init__(self):
self.encoder = BCJFilter.PpcEncoder()
self.encoder = BCJFilter.PPCEncoder()

def compress(self, data: Union[bytes, bytearray, memoryview]) -> bytes:
return self.encoder.encode(data)
Expand All @@ -376,15 +376,15 @@ def flush(self):

class BcjArmtDecoder(ISevenZipDecompressor):
def __init__(self, size: int):
self.decoder = BCJFilter.ArmtDecoder(size)
self.decoder = BCJFilter.ARMTDecoder(size)

def decompress(self, data: Union[bytes, bytearray, memoryview], max_length: int = -1) -> bytes:
return self.decoder.decode(data)


class BcjArmtEncoder(ISevenZipCompressor):
def __init__(self):
self.encoder = BCJFilter.ArmtEncoder()
self.encoder = BCJFilter.ARMTEncoder()

def compress(self, data: Union[bytes, bytearray, memoryview]) -> bytes:
return self.encoder.encode(data)
Expand All @@ -395,15 +395,15 @@ def flush(self):

class BcjArmDecoder(ISevenZipDecompressor):
def __init__(self, size: int):
self.decoder = BCJFilter.ArmDecoder(size)
self.decoder = BCJFilter.ARMDecoder(size)

def decompress(self, data: Union[bytes, bytearray, memoryview], max_length: int = -1) -> bytes:
return self.decoder.decode(data)


class BcjArmEncoder(ISevenZipCompressor):
def __init__(self):
self.encoder = BCJFilter.ArmEncoder()
self.encoder = BCJFilter.ARMEncoder()

def compress(self, data: Union[bytes, bytearray, memoryview]) -> bytes:
return self.encoder.encode(data)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ install_requires =
brotlicffi>=1.0.9.2;platform_python_implementation=="PyPy"
pyzstd>=0.14.4
pyppmd>=0.17.0
bcj-cffi>=0.5.1,<0.6.0
pybcj>=0.5.0;platform_python_implementation=="CPython"
multivolumefile>=0.2.3
setup_requires =
setuptools-scm>=6.0.1
Expand Down

0 comments on commit 6710061

Please sign in to comment.