Replace lambda with itemgetter in script/gen_requirements_all.py (#99661)

pull/99677/head
J. Nick Koston 2023-09-05 10:36:01 -05:00 committed by GitHub
parent a04c61e77b
commit abb0537928
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ from __future__ import annotations
import difflib
import importlib
from operator import itemgetter
import os
from pathlib import Path
import pkgutil
@ -333,7 +334,7 @@ def process_requirements(
def generate_requirements_list(reqs: dict[str, list[str]]) -> str:
"""Generate a pip file based on requirements."""
output = []
for pkg, requirements in sorted(reqs.items(), key=lambda item: item[0]):
for pkg, requirements in sorted(reqs.items(), key=itemgetter(0)):
for req in sorted(requirements):
output.append(f"\n# {req}")