diff options
Diffstat (limited to 'Lib/enum.py')
-rw-r--r-- | Lib/enum.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Lib/enum.py b/Lib/enum.py index 84e3cc1..0776761 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -1390,17 +1390,28 @@ def _power_of_two(value): return value == 2 ** _high_bit(value) def global_enum_repr(self): - return '%s.%s' % (self.__class__.__module__, self._name_) + """ + use module.enum_name instead of class.enum_name + + the module is the last module in case of a multi-module name + """ + module = self.__class__.__module__.split('.')[-1] + return '%s.%s' % (module, self._name_) def global_flag_repr(self): - module = self.__class__.__module__ + """ + use module.flag_name instead of class.flag_name + + the module is the last module in case of a multi-module name + """ + module = self.__class__.__module__.split('.')[-1] cls_name = self.__class__.__name__ if self._name_ is None: - return "%x" % (module, cls_name, self._value_) + return "%s.%s(0x%x)" % (module, cls_name, self._value_) if _is_single_bit(self): return '%s.%s' % (module, self._name_) if self._boundary_ is not FlagBoundary.KEEP: - return module + module.join(self.name.split('|')) + return '|'.join(['%s.%s' % (module, name) for name in self.name.split('|')]) else: name = [] for n in self._name_.split('|'): |