Skip to content

Commit

Permalink
gh-109653: Improve enum import time by avoiding import of `functool…
Browse files Browse the repository at this point in the history
…s` (GH-109789)
  • Loading branch information
AlexWaygood authored Sep 23, 2023
1 parent e8be0c9 commit 51863b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Lib/enum.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import sys
import builtins as bltns
from types import MappingProxyType, DynamicClassAttribute
from operator import or_ as _or_
from functools import reduce


__all__ = [
Expand Down Expand Up @@ -1884,7 +1882,8 @@ def __call__(self, enumeration):
missed = [v for v in values if v not in member_values]
if missed:
missing_names.append(name)
missing_value |= reduce(_or_, missed)
for val in missed:
missing_value |= val
if missing_names:
if len(missing_names) == 1:
alias = 'alias %s is missing' % missing_names[0]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reduce the import time of :mod:`enum` by over 50%. Patch by Alex Waygood.

0 comments on commit 51863b7

Please sign in to comment.