Skip to content

Commit

Permalink
Merge pull request #667 from onekey-sec/666-python-312
Browse files Browse the repository at this point in the history
Add Python 3.12 to test matrix.
  • Loading branch information
vlaci authored Oct 13, 2023
2 parents 8667d57 + c09b4a0 commit 745efc0
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout source code
uses: actions/checkout@v3
Expand Down
94 changes: 52 additions & 42 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pyright = "^1.1.307"
pre-commit = "^2.15.0"
pytest-cov = "^3.0.0"
ruff = "^0.0.259"
pyyaml = "^6.0.1"

[tool.poetry.group.docs]
optional = true
Expand Down
4 changes: 2 additions & 2 deletions unblob/cli.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
import atexit
import sys
from importlib.metadata import version
from pathlib import Path
from typing import Dict, Iterable, List, Optional, Tuple

import click
import pkg_resources
from rich.console import Console
from rich.panel import Panel
from rich.table import Table
Expand Down Expand Up @@ -36,7 +36,7 @@ def restore_cursor():


def get_version():
return pkg_resources.get_distribution("unblob").version
return version("unblob")


def show_version(
Expand Down
8 changes: 7 additions & 1 deletion unblob/handlers/compression/_gzip_reader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import gzip
import zlib

from ...file_utils import DEFAULT_BUFSIZE

Expand All @@ -10,14 +11,19 @@ def read_header(self):
self._init_read()
return self._read_gzip_header()

def _add_read_data(self, data):
self._crc = zlib.crc32(data, self._crc)
self._stream_size = self._stream_size + len(data)

def read(self):
uncompress = b""

while True:
buf = self._fp.read(DEFAULT_BUFSIZE)

uncompress = self._decompressor.decompress(buf, DEFAULT_BUFSIZE)
self._fp.prepend(self._decompressor.unconsumed_tail)
if hasattr(self._decompressor, "unconsumed_tail"):
self._fp.prepend(self._decompressor.unconsumed_tail)
self._fp.prepend(self._decompressor.unused_data)

if uncompress != b"":
Expand Down

0 comments on commit 745efc0

Please sign in to comment.