Skip to content

Commit f7341ce

Browse files
committed
PR Suggestions
1 parent 9bf2e9c commit f7341ce

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

magic/loader.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111

1212
def _lib_candidates_linux():
1313
"""Yield possible libmagic library names on Linux."""
14-
prefixes = ('libmagic.so.1', 'libmagic.so')
14+
fnames = ('libmagic.so.1', 'libmagic.so')
1515

16-
for i in prefixes:
16+
for fname in fnames:
1717
# libmagic bundled in the wheel
18-
yield os.path.join(here, i)
18+
yield os.path.join(here, fname)
1919
# libmagic in the current working directory
20-
yield os.path.join(os.path.abspath('.'), i)
20+
yield os.path.join(os.path.abspath('.'), fname)
2121
# libmagic install from source default destination path
22-
yield os.path.join('/usr/local/lib', i)
22+
yield os.path.join('/usr/local/lib', fname)
2323
# on some linux systems (musl/alpine), find_library('magic') returns None
2424
# first try finding libmagic using ldconfig
2525
# otherwise fall back to /usr/lib/
2626
yield subprocess.check_output(
27-
"( ldconfig -p | grep '{0}' | grep -o '/.*' ) || echo '/usr/lib/{0}'".format(i),
27+
"( ldconfig -p | grep '{0}' | grep -o '/.*' ) || echo '/usr/lib/{0}'".format(fname),
2828
shell=True,
2929
universal_newlines=True,
3030
).strip()
@@ -43,13 +43,13 @@ def _lib_candidates_macos():
4343
'/opt/homebrew/lib',
4444
] + glob.glob('/usr/local/Cellar/libmagic/*/lib')
4545

46-
for i in paths:
47-
yield os.path.join(i, 'libmagic.dylib')
46+
for path in paths:
47+
yield os.path.join(path, 'libmagic.dylib')
4848

4949

5050
def _lib_candidates_windows():
5151
"""Yield possible libmagic library names on Windows."""
52-
prefixes = (
52+
fnames = (
5353
"libmagic",
5454
"magic1",
5555
"magic-1",
@@ -58,13 +58,13 @@ def _lib_candidates_windows():
5858
"msys-magic-1",
5959
)
6060

61-
for i in prefixes:
61+
for fname in fnames:
6262
# libmagic bundled in the wheel
63-
yield os.path.join(here, '%s.dll' % i)
63+
yield os.path.join(here, '%s.dll' % fname)
6464
# libmagic in the current working directory
65-
yield os.path.join(os.path.abspath('.'), '%s.dll' % i)
65+
yield os.path.join(os.path.abspath('.'), '%s.dll' % fname)
6666
# find_library searches in %PATH% but not the current directory
67-
yield find_library(i)
67+
yield find_library(fname)
6868

6969

7070
def _lib_candidates():

0 commit comments

Comments
 (0)