##// END OF EJS Templates
tests: split capabilities into separate lines while searching for "narrow"...
tests: split capabilities into separate lines while searching for "narrow" This test is interested only in capabilities that are related to narrow, so let's omit everything else. Makes it easier to update other capabilities (and "rev-branch-cache" is one of the usual patterns that are already present in tests/common-patterns.py anyway). Differential Revision: https://phab.mercurial-scm.org/D4678

File last commit:

r37144:4bd73a95 default
r39756:7d9b1b50 default
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()