##// END OF EJS Templates
tests: tweak chg test to make it fail less often...
tests: tweak chg test to make it fail less often the test apparently sometimes prints the word "start" as a part of profile, so let's no longer match "start": CHGHG=/*/install/bin/hg (glob) + \x1b[90m | 50.0% 0.01s profiling.py: __enter__ line 196: self.start()\x1b[0m (esc) + \x1b[90m | 50.0% 0.01s profiling.py: start line 261: self._profiler.__enter__()\x1b[0m (esc) + \x1b[90m | 50.0% 0.01s profiling.py: statprofile line 125: statprof.start(mechanism=b'...\x1b[0m (esc) + \x1b[90m | 50.0% 0.01s statprof.py: start line 356: state.thread.start()\x1b[0m (esc) + \x1b[90m | 50.0% 0.01s threading.py: start line 852: self._started.wait()\x1b[0m (esc)

File last commit:

r37144:4bd73a95 default
r52282:db5d7aee stable
Show More
types.py
55 lines | 1.3 KiB | text/x-python | PythonLexer
class CBORTag(object):
"""
Represents a CBOR semantic tag.
:param int tag: tag number
:param value: encapsulated value (any object)
"""
__slots__ = 'tag', 'value'
def __init__(self, tag, value):
self.tag = tag
self.value = value
def __eq__(self, other):
if isinstance(other, CBORTag):
return self.tag == other.tag and self.value == other.value
return NotImplemented
def __repr__(self):
return 'CBORTag({self.tag}, {self.value!r})'.format(self=self)
class CBORSimpleValue(object):
"""
Represents a CBOR "simple value".
:param int value: the value (0-255)
"""
__slots__ = 'value'
def __init__(self, value):
if value < 0 or value > 255:
raise TypeError('simple value too big')
self.value = value
def __eq__(self, other):
if isinstance(other, CBORSimpleValue):
return self.value == other.value
elif isinstance(other, int):
return self.value == other
return NotImplemented
def __repr__(self):
return 'CBORSimpleValue({self.value})'.format(self=self)
class UndefinedType(object):
__slots__ = ()
#: Represents the "undefined" value.
undefined = UndefinedType()
break_marker = object()