Skip to content

Commit 745efc0

Browse files
authored
Merge pull request #667 from onekey-sec/666-python-312
Add Python 3.12 to test matrix.
2 parents 8667d57 + c09b4a0 commit 745efc0

File tree

5 files changed

+63
-46
lines changed

5 files changed

+63
-46
lines changed

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
runs-on: ubuntu-latest
5353
strategy:
5454
matrix:
55-
python-version: ["3.8", "3.9", "3.10", "3.11"]
55+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
5656
steps:
5757
- name: Checkout source code
5858
uses: actions/checkout@v3

poetry.lock

Lines changed: 52 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ pyright = "^1.1.307"
4040
pre-commit = "^2.15.0"
4141
pytest-cov = "^3.0.0"
4242
ruff = "^0.0.259"
43+
pyyaml = "^6.0.1"
4344

4445
[tool.poetry.group.docs]
4546
optional = true

unblob/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env python3
22
import atexit
33
import sys
4+
from importlib.metadata import version
45
from pathlib import Path
56
from typing import Dict, Iterable, List, Optional, Tuple
67

78
import click
8-
import pkg_resources
99
from rich.console import Console
1010
from rich.panel import Panel
1111
from rich.table import Table
@@ -36,7 +36,7 @@ def restore_cursor():
3636

3737

3838
def get_version():
39-
return pkg_resources.get_distribution("unblob").version
39+
return version("unblob")
4040

4141

4242
def show_version(

unblob/handlers/compression/_gzip_reader.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import gzip
2+
import zlib
23

34
from ...file_utils import DEFAULT_BUFSIZE
45

@@ -10,14 +11,19 @@ def read_header(self):
1011
self._init_read()
1112
return self._read_gzip_header()
1213

14+
def _add_read_data(self, data):
15+
self._crc = zlib.crc32(data, self._crc)
16+
self._stream_size = self._stream_size + len(data)
17+
1318
def read(self):
1419
uncompress = b""
1520

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

1924
uncompress = self._decompressor.decompress(buf, DEFAULT_BUFSIZE)
20-
self._fp.prepend(self._decompressor.unconsumed_tail)
25+
if hasattr(self._decompressor, "unconsumed_tail"):
26+
self._fp.prepend(self._decompressor.unconsumed_tail)
2127
self._fp.prepend(self._decompressor.unused_data)
2228

2329
if uncompress != b"":

0 commit comments

Comments
 (0)