Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 81e0986

Browse files
committed
cffi: use less ambiguous variable name
And with this change the codebase now passes `ruff check`.
1 parent 435cf87 commit 81e0986

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

make_cffi.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def preprocess(path):
7171
lines = []
7272
it = iter(fh)
7373

74-
for l in it:
74+
for line in it:
7575
# zstd.h includes <stddef.h>, which is also included by cffi's
7676
# boilerplate. This can lead to duplicate declarations. So we strip
7777
# this include from the preprocessor invocation.
@@ -82,7 +82,7 @@ def preprocess(path):
8282
# We define ZSTD_STATIC_LINKING_ONLY, which is redundant with the inline
8383
# #define in zstdmt_compress.h and results in a compiler warning. So drop
8484
# the inline #define.
85-
if l.startswith(
85+
if line.startswith(
8686
(
8787
b"#include <stddef.h>",
8888
b'#include "zstd.h"',
@@ -97,8 +97,8 @@ def preprocess(path):
9797
# a bit hacky. But it gets the job done.
9898
# TODO make limits.h work on Windows so we ensure INT_MAX is
9999
# correct.
100-
if l.startswith(b"#include <limits.h>"):
101-
l = b"#define INT_MAX 2147483647\n"
100+
if line.startswith(b"#include <limits.h>"):
101+
line = b"#define INT_MAX 2147483647\n"
102102

103103
# ZSTDLIB_API may not be defined if we dropped zstd.h. It isn't
104104
# important so just filter it out. Ditto for ZSTDLIB_STATIC_API and
@@ -108,10 +108,10 @@ def preprocess(path):
108108
b"ZSTDLIB_STATIC_API",
109109
b"ZDICTLIB_STATIC_API",
110110
):
111-
if l.startswith(prefix):
112-
l = l[len(prefix) :]
111+
if line.startswith(prefix):
112+
line = line[len(prefix) :]
113113

114-
lines.append(l)
114+
lines.append(line)
115115

116116
fd, input_file = tempfile.mkstemp(suffix=".h")
117117
os.write(fd, b"".join(lines))
@@ -209,7 +209,7 @@ def normalize_output(output):
209209
sources.append(m.group(0) + b" ...")
210210

211211
cdeflines = b"\n".join(sources).splitlines()
212-
cdeflines = [l for l in cdeflines if l.strip()]
212+
cdeflines = [line for line in cdeflines if line.strip()]
213213
ffi.cdef(b"\n".join(cdeflines).decode("latin1"))
214214

215215
if __name__ == "__main__":

0 commit comments

Comments
 (0)