From 1a8c9de92206fd3d17e83eee41eef6fc60aeb96c Mon Sep 17 00:00:00 2001 From: Dave Schaefer Date: Fri, 20 Oct 2023 17:35:16 -0600 Subject: [PATCH] Simplify sorting code For https://github.com/pypa/pipenv/issues/5964 As suggested in https://github.com/pypa/pipenv/pull/5965 We don't need to cast to `dict` first, we can just sort. --- pipenv/project.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pipenv/project.py b/pipenv/project.py index c5173c93..291607ef 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -1114,9 +1114,8 @@ class Project: def _sort_category(self, category): # toml tables won't maintain sorted dictionary order # so construct the table in the order that we need - sorted_category = dict(sorted(category.items())) table = tomlkit.table() - for key, value in sorted_category.items(): + for key, value in sorted(category.items()): table.add(key, value) return table