Skip to content

Commit 8732687

Browse files
committed
-
1 parent 967fcfc commit 8732687

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

source_py3/python_toolbox/nifty_collections/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from .frozen_counter import FrozenCounter
1313
from .frozen_crate_counter import FrozenCrateCounter
1414
from .default_sorted_dict import DefaultSortedDict
15-
from .orderable_enum import OrderableEnum
15+
from .cute_enum import CuteEnum
1616

1717
from .emitting_ordered_set import EmittingOrderedSet
1818
from .emitting_weak_key_default_dict import EmittingWeakKeyDefaultDict
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2009-2014 Ram Rachum.
2+
# This program is distributed under the MIT license.
3+
4+
import enum
5+
import functools
6+
7+
from python_toolbox import caching
8+
9+
10+
@functools.total_ordering
11+
class CuteEnum(enum.Enum):
12+
13+
number = caching.CachedProperty(
14+
lambda self: type(self)._member_names_.index(self.name)
15+
)
16+
__lt__ = lambda self, other: isinstance(other, CuteEnum) and \
17+
(self.number <= other.number)

source_py3/python_toolbox/nifty_collections/orderable_enum.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)