mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 17:34:49 +08:00
Upgrade to flake8 v6 (#8007)
* Upgrade to flake8 v6 * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -32,7 +32,7 @@ def parse_file(file_path: str) -> list[Letter]:
|
||||
if not c:
|
||||
break
|
||||
chars[c] = chars[c] + 1 if c in chars else 1
|
||||
return sorted((Letter(c, f) for c, f in chars.items()), key=lambda l: l.freq)
|
||||
return sorted((Letter(c, f) for c, f in chars.items()), key=lambda x: x.freq)
|
||||
|
||||
|
||||
def build_tree(letters: list[Letter]) -> Letter | TreeNode:
|
||||
@ -47,7 +47,7 @@ def build_tree(letters: list[Letter]) -> Letter | TreeNode:
|
||||
total_freq = left.freq + right.freq
|
||||
node = TreeNode(total_freq, left, right)
|
||||
response.append(node)
|
||||
response.sort(key=lambda l: l.freq)
|
||||
response.sort(key=lambda x: x.freq)
|
||||
return response[0]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user