Total Complexity | 5 |
Total Lines | 20 |
Duplicated Lines | 0 % |
1 | """ |
||
15 | @object.__new__ # bind a single instance to the name 'Sentinel' |
||
16 | class Sentinel(object): |
||
17 | __doc__ = doc |
||
18 | __slots__ = ('__weakref__',) |
||
19 | __name__ = name |
||
20 | |||
21 | def __new__(cls): |
||
22 | raise TypeError("Can't construct new instances of %r" % name) |
||
23 | |||
24 | def __repr__(self): |
||
25 | return 'sentinel(%r)' % name |
||
26 | |||
27 | def __reduce__(self): |
||
28 | return sentinel, (name, doc) |
||
29 | |||
30 | def __deepcopy__(self, _memo): |
||
31 | return self |
||
32 | |||
33 | def __copy__(self): |
||
34 | return self |
||
35 | |||
47 |