Skip to content

Commit

Permalink
base: fix flake8 complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
no92 committed Nov 7, 2024
1 parent 05c4c7e commit d18b48c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions xbstrap/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def try_rmtree(path):

def stat_mtime(path):
try:
with open(path) as f:
with open(path) as _:
stat = os.stat(path)
return stat.st_mtime
except FileNotFoundError:
Expand Down Expand Up @@ -816,8 +816,11 @@ def traverse_graph(*, roots, visit, key=None):
seen = set()
stack = []

def default_mapping(n):
return

if key is None:
key = lambda n: n
key = default_mapping

for n in roots:
k = key(n)
Expand Down Expand Up @@ -2351,7 +2354,7 @@ def run_program(
)
else:
if verbosity:
_util.log_info(f"Sysroot is not bind mounted")
_util.log_info("Sysroot is not bind mounted")

with tempfile.NamedTemporaryFile("w+") as f:
json.dump(cbuild_json, f)
Expand Down Expand Up @@ -3564,12 +3567,12 @@ def _do_ordering(self):
item.reverse_edge_list.append(target_item)

# Sort all edge lists to make the order deterministic.
def sort_items(l):
l.sort(key=PlanItem.get_ordering_key)
def sort_items(items):
items.sort(key=PlanItem.get_ordering_key)
# Alternatively, shuffle the edge lists to randomize the order.
# Note that sorting them first ensures that the order is deterministic.
if self.ordering_prng:
self.ordering_prng.shuffle(l)
self.ordering_prng.shuffle(items)

root_list = list(self._items.values())
sort_items(root_list)
Expand Down

0 comments on commit d18b48c

Please sign in to comment.