Skip to content

Commit c275654

Browse files
committed
global: format with ruff
1 parent 7d7ff17 commit c275654

File tree

7 files changed

+160
-156
lines changed

7 files changed

+160
-156
lines changed

bench.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def bench(
8181
def wrapper(fn):
8282
if not fn.__name__.startswith(("compress_", "decompress_")):
8383
raise ValueError(
84-
"benchmark function must begin with " "compress_ or decompress_"
84+
"benchmark function must begin with compress_ or decompress_"
8585
)
8686

8787
fn.mode = mode
@@ -789,18 +789,17 @@ def bench_content_dict_decompression(chunks, total_size, zparams):
789789
group.add_argument(
790790
"--stream",
791791
action="store_true",
792-
help="Feed each input into a stream and emit " "flushed blocks",
792+
help="Feed each input into a stream and emit flushed blocks",
793793
)
794794
group.add_argument(
795795
"--content-dict",
796796
action="store_true",
797-
help="Compress each input using the previous as a "
798-
"content dictionary",
797+
help="Compress each input using the previous as a content dictionary",
799798
)
800799
group.add_argument(
801800
"--discrete-dict",
802801
action="store_true",
803-
help="Compress each input independently with a " "dictionary",
802+
help="Compress each input independently with a dictionary",
804803
)
805804

806805
group = parser.add_argument_group("Benchmark Selection")
@@ -854,7 +853,7 @@ def bench_content_dict_decompression(chunks, total_size, zparams):
854853
group.add_argument(
855854
"--compress-threads",
856855
type=int,
857-
help="Use multi-threaded compression with this many " "threads",
856+
help="Use multi-threaded compression with this many threads",
858857
)
859858
group.add_argument(
860859
"--batch-threads",
@@ -885,7 +884,7 @@ def bench_content_dict_decompression(chunks, total_size, zparams):
885884
group.add_argument(
886885
"--dict-sample-limit",
887886
type=int,
888-
help="limit how many samples are fed into dictionary " "training",
887+
help="limit how many samples are fed into dictionary training",
889888
)
890889
group.add_argument(
891890
"--chunk-encoding",
@@ -897,7 +896,7 @@ def bench_content_dict_decompression(chunks, total_size, zparams):
897896
group.add_argument(
898897
"--split-input-size",
899898
type=int,
900-
help="Split inputs into chunks so they are at most this " "many bytes",
899+
help="Split inputs into chunks so they are at most this many bytes",
901900
)
902901

903902
parser.add_argument("path", metavar="PATH", nargs="+")

make_cffi.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
]
2424

2525
# Headers whose preprocessed output will be fed into cdef().
26-
HEADERS = [os.path.join(HERE, "zstd", p) for p in ("zstd_errors.h", "zstd.h", "zdict.h")]
26+
HEADERS = [
27+
os.path.join(HERE, "zstd", p)
28+
for p in ("zstd_errors.h", "zstd.h", "zdict.h")
29+
]
2730

2831
INCLUDE_DIRS = [
2932
os.path.join(HERE, "zstd"),
@@ -95,7 +98,7 @@ def preprocess(path):
9598

9699
# There's a naked `static` before the declaration of ZSTD_customMem that
97100
# confuses the cffi parser. Strip it.
98-
if line == b'static\n':
101+
if line == b"static\n":
99102
continue
100103

101104
# The preprocessor environment on Windows doesn't define include
@@ -164,6 +167,7 @@ def normalize_output(output):
164167

165168
return b"\n".join(lines)
166169

170+
167171
# musl 1.1 doesn't define qsort_r. We need to force using the C90
168172
# variant.
169173
define_macros = []
@@ -189,7 +193,7 @@ def normalize_output(output):
189193
""",
190194
sources=SOURCES,
191195
include_dirs=INCLUDE_DIRS,
192-
define_macros=define_macros
196+
define_macros=define_macros,
193197
)
194198

195199
DEFINE = re.compile(rb"^#define\s+([a-zA-Z0-9_]+)\s+(\S+)")

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146

147147
if not version:
148148
raise Exception(
149-
"could not resolve package version; " "this should never happen"
149+
"could not resolve package version; this should never happen"
150150
)
151151

152152
setup(

tests/test_compressor_compress.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ def test_multithreaded_dict(self):
198198

199199
self.assertEqual(
200200
result,
201-
b"\x28\xb5\x2f\xfd\x23\x27\x42\xfc\x42\x03\x19\x00\x00"
202-
b"\x66\x6f\x6f",
201+
b"\x28\xb5\x2f\xfd\x23\x27\x42\xfc\x42\x03\x19\x00\x00\x66\x6f\x6f",
203202
)
204203

205204
def test_multithreaded_compression_params(self):

tests/test_decompressor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ class TestFrameHeaderSize(unittest.TestCase):
77
def test_empty(self):
88
with self.assertRaisesRegex(
99
zstd.ZstdError,
10-
"could not determine frame header size: Src size " "is incorrect",
10+
"could not determine frame header size: Src size is incorrect",
1111
):
1212
zstd.frame_header_size(b"")
1313

1414
def test_too_small(self):
1515
with self.assertRaisesRegex(
1616
zstd.ZstdError,
17-
"could not determine frame header size: Src size " "is incorrect",
17+
"could not determine frame header size: Src size is incorrect",
1818
):
1919
zstd.frame_header_size(b"foob")
2020

zstandard/__init__.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,9 @@ class FrameParameters(object):
450450
def estimate_decompression_context_size() -> int: ...
451451
def frame_content_size(data: ByteString) -> int: ...
452452
def frame_header_size(data: ByteString) -> int: ...
453-
def get_frame_parameters(data: ByteString, format: Optional[int] = None) -> FrameParameters: ...
453+
def get_frame_parameters(
454+
data: ByteString, format: Optional[int] = None
455+
) -> FrameParameters: ...
454456
def train_dictionary(
455457
dict_size: int,
456458
samples: list[ByteString],

0 commit comments

Comments
 (0)