Skip to content

Commit

Permalink
chore: fix new issues reported by linter
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed May 23, 2020
1 parent 198af3d commit 22fa4b1
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 32 deletions.
4 changes: 2 additions & 2 deletions pylib/gyp/generator/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,9 +981,9 @@ def WriteList(
"""
values = ""
if value_list:
value_list = [quoter(prefix + l) for l in value_list]
value_list = [quoter(prefix + value) for value in value_list]
if local_pathify:
value_list = [self.LocalPathify(l) for l in value_list]
value_list = [self.LocalPathify(value) for value in value_list]
values = " \\\n\t" + " \\\n\t".join(value_list)
self.fp.write("%s :=%s\n\n" % (variable, values))

Expand Down
2 changes: 1 addition & 1 deletion pylib/gyp/generator/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -1944,7 +1944,7 @@ def WriteList(self, value_list, variable=None, prefix="", quoter=QuoteIfNecessar
"""
values = ""
if value_list:
value_list = [quoter(prefix + l) for l in value_list]
value_list = [quoter(prefix + value) for value in value_list]
values = " \\\n\t" + " \\\n\t".join(value_list)
self.fp.write("%s :=%s\n\n" % (variable, values))

Expand Down
14 changes: 9 additions & 5 deletions pylib/gyp/generator/ninja.py
Original file line number Diff line number Diff line change
Expand Up @@ -1481,16 +1481,20 @@ def WriteLinkForArch(
library_dirs = config.get("library_dirs", [])
if self.flavor == "win":
library_dirs = [
self.msvs_settings.ConvertVSMacros(l, config_name) for l in library_dirs
self.msvs_settings.ConvertVSMacros(library_dir, config_name)
for library_dir in library_dirs
]
library_dirs = [
"/LIBPATH:" + QuoteShellArgument(self.GypPathToNinja(l), self.flavor)
for l in library_dirs
"/LIBPATH:"
+ QuoteShellArgument(self.GypPathToNinja(library_dirs), self.flavor)
for library_dirs in library_dirs
]
else:
library_dirs = [
QuoteShellArgument("-L" + self.GypPathToNinja(l), self.flavor)
for l in library_dirs
QuoteShellArgument(
"-L" + self.GypPathToNinja(library_dirs), self.flavor
)
for library_dirs in library_dirs
]

libraries = gyp.common.uniquer(
Expand Down
18 changes: 9 additions & 9 deletions pylib/gyp/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -1619,10 +1619,10 @@ def ExpandWildcardDependencies(targets, data):
index = index + 1


def Unify(l):
"""Removes duplicate elements from l, keeping the first element."""
def Unify(list):
"""Removes duplicate elements from list, keeping the first element."""
seen = {}
return [seen.setdefault(e, e) for e in l if e not in seen]
return [seen.setdefault(e, e) for e in list if e not in seen]


def RemoveDuplicateDependencies(targets):
Expand All @@ -1635,10 +1635,10 @@ def RemoveDuplicateDependencies(targets):
target_dict[dependency_key] = Unify(dependencies)


def Filter(l, item):
"""Removes item from l."""
def Filter(list, item):
"""Removes item from list."""
res = {}
return [res.setdefault(e, e) for e in l if e != item]
return [res.setdefault(e, e) for e in list if e != item]


def RemoveSelfDependencies(targets):
Expand Down Expand Up @@ -2242,11 +2242,11 @@ def MergeLists(to, fro, to_file, fro_file, is_paths=False, append=True):
def is_hashable(val):
return val.__hash__

# If x is hashable, returns whether x is in s. Else returns whether x is in l.
def is_in_set_or_list(x, s, l):
# If x is hashable, returns whether x is in s. Else returns whether x is in list.
def is_in_set_or_list(x, s, list):
if is_hashable(x):
return x in s
return x in l
return x in list

prepend_index = 0

Expand Down
26 changes: 13 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
entry_points={"console_scripts": ["gyp=gyp:script_main"]},
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
)
4 changes: 2 additions & 2 deletions test_gyp.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ def run_test(self, test, fmt, i):
and not (stdout.endswith("NO RESULT\n"))
):
print()
for l in stdout.splitlines():
print(" %s" % l)
for line in stdout.splitlines():
print(" %s" % line)
elif not self.isatty:
print()

Expand Down

0 comments on commit 22fa4b1

Please sign in to comment.