summaryrefslogtreecommitdiffstats
path: root/Lib/enum.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-09-25 21:55:55 (GMT)
committerGitHub <noreply@github.com>2017-09-25 21:55:55 (GMT)
commit81108375d9b2ccd0add1572da745311d4dfac505 (patch)
tree54632e1d6ec58850f70941452634c4faf1ea7218 /Lib/enum.py
parentf1502d097c29b266a5748312ee2451a2d6ac0af6 (diff)
downloadcpython-81108375d9b2ccd0add1572da745311d4dfac505.zip
cpython-81108375d9b2ccd0add1572da745311d4dfac505.tar.gz
cpython-81108375d9b2ccd0add1572da745311d4dfac505.tar.bz2
bpo-30152: Reduce the number of imports for argparse. (#1269)
Diffstat (limited to 'Lib/enum.py')
-rw-r--r--Lib/enum.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/Lib/enum.py b/Lib/enum.py
index 6d90f7d..fe7cb20 100644
--- a/Lib/enum.py
+++ b/Lib/enum.py
@@ -1,7 +1,5 @@
import sys
from types import MappingProxyType, DynamicClassAttribute
-from functools import reduce
-from operator import or_ as _or_
# try _collections first to reduce startup cost
try:
@@ -744,11 +742,10 @@ class Flag(Enum):
def __invert__(self):
members, uncovered = _decompose(self.__class__, self._value_)
- inverted_members = [
- m for m in self.__class__
- if m not in members and not m._value_ & self._value_
- ]
- inverted = reduce(_or_, inverted_members, self.__class__(0))
+ inverted = self.__class__(0)
+ for m in self.__class__:
+ if m not in members and not (m._value_ & self._value_):
+ inverted = inverted | m
return self.__class__(inverted)