Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid using 'l' as variable #1356

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/_emerge/Binpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ def _start(self):
fetch_log = os.path.join(
_emerge.emergelog._emerge_log_dir, "emerge-fetch.log"
)
msg = (
msgs = (
"Fetching in the background:",
prefetcher.pkg_path,
"To view fetch progress, run in another terminal:",
f"tail -f {fetch_log}",
)
out = portage.output.EOutput()
for l in msg:
out.einfo(l)
for msg in msgs:
out.einfo(msg)

self._current_task = prefetcher
prefetcher.addExitListener(self._prefetch_exit)
Expand Down
6 changes: 3 additions & 3 deletions lib/_emerge/EbuildBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ def _start_with_metadata(self, aux_get_task):
fetch_log = os.path.join(
_emerge.emergelog._emerge_log_dir, "emerge-fetch.log"
)
msg = (
msgs = (
"Fetching files in the background.",
"To view fetch progress, run in another terminal:",
f"tail -f {fetch_log}",
)
out = portage.output.EOutput()
for l in msg:
out.einfo(l)
for msg in msgs:
out.einfo(msg)

self._current_task = prefetcher
prefetcher.addExitListener(self._prefetch_exit)
Expand Down
6 changes: 3 additions & 3 deletions lib/_emerge/EbuildMetadataPhase.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ def _async_waitpid_cb(self, *args, **kwargs):
).splitlines()
metadata = {}
metadata_valid = True
for l in metadata_lines:
if "=" not in l:
for line in metadata_lines:
if "=" not in line:
metadata_valid = False
break
key, value = l.split("=", 1)
key, value = line.split("=", 1)
metadata[key] = value

if metadata_valid:
Expand Down
4 changes: 2 additions & 2 deletions lib/_emerge/EbuildPhase.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ async def _setup_locale(settings):
# check_locale() returns None when check can not be executed.
if await async_check_locale(silent=True, env=settings.environ()) is False:
# try another locale
for l in ("C.UTF-8", "en_US.UTF-8", "en_GB.UTF-8", "C"):
settings["LC_CTYPE"] = l
for locale in ("C.UTF-8", "en_US.UTF-8", "en_GB.UTF-8", "C"):
settings["LC_CTYPE"] = locale
if await async_check_locale(silent=True, env=settings.environ()):
# TODO: output the following only once
# writemsg(
Expand Down
20 changes: 10 additions & 10 deletions lib/_emerge/Scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,15 +445,15 @@ def _background_mode(self):
level=logging.INFO,
noiselevel=-1,
)
msg = [""]
msgs = [""]
for pkg in interactive_tasks:
pkg_str = " " + colorize("INFORM", str(pkg.cpv))
if pkg.root_config.settings["ROOT"] != "/":
pkg_str += " for " + pkg.root
msg.append(pkg_str)
msg.append("")
msgs.append(pkg_str)
msgs.append("")
writemsg_level(
"".join(f"{l}\n" for l in msg),
"".join(f"{msg}\n" for msg in msgs),
level=logging.INFO,
noiselevel=-1,
)
Expand Down Expand Up @@ -954,15 +954,15 @@ async def _run_pkg_pretend(self, loop=None):
# bintree.inject call which moves the file.
fetched = fetcher.pkg_path
else:
msg = (
msgs = (
"Fetching in the background:",
fetcher.pkg_path,
"To view fetch progress, run in another terminal:",
f"tail -f {self._fetch_log}",
)
out = portage.output.EOutput()
for l in msg:
out.einfo(l)
for msg in msgs:
out.einfo(msg)
if await fetcher.async_wait() != os.EX_OK:
failures += 1
self._record_pkg_failure(x, settings, fetcher.returncode)
Expand Down Expand Up @@ -1121,14 +1121,14 @@ def merge(self):
# for ensuring sane $PWD (bug #239560) and storing elog messages.
tmpdir = root_config.settings.get("PORTAGE_TMPDIR", "")
if not tmpdir or not os.path.isdir(tmpdir):
msg = (
msgs = (
"The directory specified in your PORTAGE_TMPDIR variable does not exist:",
tmpdir,
"Please create this directory or correct your PORTAGE_TMPDIR setting.",
)
out = portage.output.EOutput()
for l in msg:
out.eerror(l)
for msg in msgs:
out.eerror(msg)
return FAILURE

if self._background:
Expand Down
50 changes: 26 additions & 24 deletions lib/_emerge/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2795,18 +2795,20 @@ def adjust_config(myopts, settings):


def display_missing_pkg_set(root_config, set_name):
msg = []
msg.append(
msgs = []
msgs.append(
f"emerge: There are no sets to satisfy '{colorize('INFORM', set_name)}'. "
"The following sets exist:"
)
msg.append("")
msgs.append("")

for s in sorted(root_config.sets):
msg.append(f" {s}")
msg.append("")
msgs.append(f" {s}")
msgs.append("")

writemsg_level("".join(f"{l}\n" for l in msg), level=logging.ERROR, noiselevel=-1)
writemsg_level(
"".join(f"{msg}\n" for msg in msgs), level=logging.ERROR, noiselevel=-1
)


def relative_profile_path(portdir, abs_profile):
Expand Down Expand Up @@ -3053,7 +3055,7 @@ def check_procfs():
return os.EX_OK
msg = f"It seems that {procfs_path} is not mounted. You have been warned."
writemsg_level(
"".join(f"!!! {l}\n" for l in textwrap.wrap(msg, 70)),
"".join(f"!!! {line}\n" for line in textwrap.wrap(msg, 70)),
level=logging.ERROR,
noiselevel=-1,
)
Expand Down Expand Up @@ -3368,25 +3370,25 @@ def repo_name_check(trees):
pass

if missing_repo_names:
msg = []
msg.append(
msgs = []
msgs.append(
"WARNING: One or more repositories " + "have missing repo_name entries:"
)
msg.append("")
msgs.append("")
for p in missing_repo_names:
msg.append(f"\t{p}/profiles/repo_name")
msg.append("")
msg.extend(
msgs.append("")
msgs.extend(
textwrap.wrap(
"NOTE: Each repo_name entry "
+ "should be a plain text file containing a unique "
+ "name for the repository on the first line.",
70,
)
)
msg.append("\n")
msgs.append("\n")
writemsg_level(
"".join(f"{l}\n" for l in msg), level=logging.WARNING, noiselevel=-1
"".join(f"{msg}\n" for msg in msgs), level=logging.WARNING, noiselevel=-1
)

return bool(missing_repo_names)
Expand All @@ -3403,18 +3405,18 @@ def repo_name_duplicate_check(trees):
ignored_repos.setdefault(k, []).extend(paths)

if ignored_repos:
msg = []
msg.append(
msgs = []
msgs.append(
"WARNING: One or more repositories " + "have been ignored due to duplicate"
)
msg.append(" profiles/repo_name entries:")
msg.append("")
msgs.append(" profiles/repo_name entries:")
msgs.append("")
for k in sorted(ignored_repos):
msg.append(f" {', '.join(k)} overrides")
msgs.append(f" {', '.join(k)} overrides")
for path in ignored_repos[k]:
msg.append(f" {path}")
msg.append("")
msg.extend(
msgs.append(f" {path}")
msgs.append("")
msgs.extend(
" " + x
for x in textwrap.wrap(
"All profiles/repo_name entries must be unique in order "
Expand All @@ -3423,9 +3425,9 @@ def repo_name_duplicate_check(trees):
+ "/etc/portage/make.conf if you would like to disable this warning."
)
)
msg.append("\n")
msgs.append("\n")
writemsg_level(
"".join(f"{l}\n" for l in msg), level=logging.WARNING, noiselevel=-1
"".join(f"{msg}\n" for msg in msgs), level=logging.WARNING, noiselevel=-1
)

return bool(ignored_repos)
Expand Down
32 changes: 16 additions & 16 deletions lib/_emerge/depgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,7 @@ def _slot_confict_backtrack(self, root, slot_atom, all_parents, conflict_pkgs):
)
self._dynamic_config._need_restart = True
if debug:
msg = [
msgs = [
"",
"",
"backtracking due to slot conflict:",
Expand All @@ -2090,7 +2090,7 @@ def _slot_confict_backtrack(self, root, slot_atom, all_parents, conflict_pkgs):
"",
]
writemsg_level(
"".join(f"{l}\n" for l in msg), noiselevel=-1, level=logging.DEBUG
"".join(f"{msg}\n" for msg in msgs), noiselevel=-1, level=logging.DEBUG
)

def _slot_conflict_backtrack_abi(self, pkg, slot_nodes, conflict_atoms):
Expand Down Expand Up @@ -3320,17 +3320,17 @@ def _add_dep(self, dep, allow_unsatisfied=False):
self._dynamic_config._backtrack_infos["missing dependency"] = dep
self._dynamic_config._need_restart = True
if debug:
msg = []
msg.append("")
msg.append("")
msgs = []
msgs.append("")
msgs.append("")
msg.append("backtracking due to unsatisfied dep:")
msg.append(f" parent: {dep.parent}")
msg.append(f" priority: {dep.priority}")
msg.append(f" root: {dep.root}")
msg.append(f" atom: {dep.atom}")
msg.append("")
msgs.append(f" parent: {dep.parent}")
msgs.append(f" priority: {dep.priority}")
msgs.append(f" root: {dep.root}")
msgs.append(f" atom: {dep.atom}")
msgs.append("")
writemsg_level(
"".join(f"{l}\n" for l in msg),
"".join(f"{msg}\n" for msg in msgs),
noiselevel=-1,
level=logging.DEBUG,
)
Expand Down Expand Up @@ -12149,15 +12149,15 @@ def show_masked_packages(masked_packages):
writemsg(filename + ":\n" + comment + "\n", noiselevel=-1)
shown_comments.add(comment)
portdb = root_config.trees["porttree"].dbapi
for l in missing_licenses:
if l in shown_licenses:
for lic in missing_licenses:
if lic in shown_licenses:
continue
l_path = portdb.findLicensePath(l)
l_path = portdb.findLicensePath(lic)
if l_path is None:
continue
msg = f"A copy of the '{l}' license is located at '{l_path}'.\n\n"
msg = f"A copy of the '{lic}' license is located at '{l_path}'.\n\n"
writemsg(msg, noiselevel=-1)
shown_licenses.add(l)
shown_licenses.add(lic)
return have_eapi_mask


Expand Down
2 changes: 1 addition & 1 deletion lib/_emerge/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ def profile_check(trees, myaction):
"--help, --info, --search, --sync, and --version."
)
writemsg_level(
"".join(f"!!! {l}\n" for l in textwrap.wrap(msg, 70)),
"".join(f"!!! {line}\n" for line in textwrap.wrap(msg, 70)),
level=logging.ERROR,
noiselevel=-1,
)
Expand Down
4 changes: 2 additions & 2 deletions lib/portage/_emirrordist/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,8 @@ def emirrordist_main(args):
portage.util.initialize_logger()

if options.verbose > 0:
l = logging.getLogger()
l.setLevel(l.getEffectiveLevel() - 10 * options.verbose)
logger = logging.getLogger()
logger.setLevel(logger.getEffectiveLevel() - 10 * options.verbose)

with Config(options, portdb, SchedulerInterface(global_event_loop())) as config:
if not options.mirror:
Expand Down
4 changes: 2 additions & 2 deletions lib/portage/cache/flat_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ def __iter__(self):
raise
del e
continue
for l in dir_list:
p = os.path.join(dir_path, l)
for directory in dir_list:
p = os.path.join(dir_path, directory)
try:
st = os.lstat(p)
except OSError:
Expand Down
6 changes: 3 additions & 3 deletions lib/portage/cache/mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,10 @@ def __iter__(self):
yield k

def __len__(self):
l = 0
result = 0
for i in self.iteritems():
l += 1
return l
result += 1
return result

def iteritems(self):
prefix = self._prefix
Expand Down
10 changes: 5 additions & 5 deletions lib/portage/cache/sql_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,21 +273,21 @@ def iteritems(self):
raise cache_errors.CacheCorruption(self, cpv, e)

oldcpv = None
l = []
items = []
for x, y, v in self.con.fetchall():
if oldcpv != x:
if oldcpv is not None:
d = dict(l)
d = dict(items)
if "_eclasses_" in d:
d["_eclasses_"] = reconstruct_eclasses(oldcpv, d["_eclasses_"])
else:
d["_eclasses_"] = {}
yield cpv, d
l.clear()
items.clear()
oldcpv = x
l.append((y, v))
items.append((y, v))
if oldcpv is not None:
d = dict(l)
d = dict(items)
if "_eclasses_" in d:
d["_eclasses_"] = reconstruct_eclasses(oldcpv, d["_eclasses_"])
else:
Expand Down
6 changes: 3 additions & 3 deletions lib/portage/dbapi/porttree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,10 +1128,10 @@ def cp_all(self, categories=None, trees=None, reverse=False, sort=True):
if atom != atom.cp:
continue
d[atom.cp] = None
l = list(d)
result = list(d)
if sort:
l.sort(reverse=reverse)
return l
result.sort(reverse=reverse)
return result

def cp_list(self, mycp, use_cache=1, mytree=None):
# NOTE: Cache can be safely shared with the match cache, since the
Expand Down
Loading