Total Complexity | 5 |
Total Lines | 20 |
Duplicated Lines | 0 % |
1 | """ |
||
29 | @object.__new__ # bind a single instance to the name 'Sentinel' |
||
30 | class Sentinel(object): |
||
31 | __doc__ = doc |
||
32 | __slots__ = ('__weakref__',) |
||
33 | __name__ = name |
||
34 | |||
35 | def __new__(cls): |
||
36 | raise TypeError('cannot create %r instances' % name) |
||
37 | |||
38 | def __repr__(self): |
||
39 | return 'sentinel(%r)' % name |
||
40 | |||
41 | def __reduce__(self): |
||
42 | return sentinel, (name, doc) |
||
43 | |||
44 | def __deepcopy__(self, _memo): |
||
45 | return self |
||
46 | |||
47 | def __copy__(self): |
||
48 | return self |
||
49 | |||
61 |