X-Git-Url: http://www.git.cypherpunks.ru/?p=pyderasn.git;a=blobdiff_plain;f=pyderasn.py;h=d14997bfe24d4569f7732bf238e812263aa92f89;hp=5c311e09c11d2c39eed450a0d2f768bd195f1bea;hb=3d77f13bff0bb7b47384a748f3bf080d59dd22da;hpb=524e7468d461f5803a01f228fc144b6ec901736d diff --git a/pyderasn.py b/pyderasn.py index 5c311e0..d14997b 100755 --- a/pyderasn.py +++ b/pyderasn.py @@ -177,7 +177,7 @@ by specifying ``leavemm=True`` argument. When object is decoded, ``decoded`` property is true and you can safely use following properties: -* ``offset`` -- position from initial offset where object's tag is started +* ``offset`` -- position including initial offset where object's tag starts * ``tlen`` -- length of object's tag * ``llen`` -- length of object's length value * ``vlen`` -- length of object's value @@ -735,6 +735,18 @@ class Obj(object): def __str__(self): # pragma: no cover return self.__bytes__() if PY2 else self.__unicode__() + def __ne__(self, their): + return not(self == their) + + def __gt__(self, their): # pragma: no cover + return not(self < their) + + def __le__(self, their): # pragma: no cover + return (self == their) or (self < their) + + def __ge__(self, their): # pragma: no cover + return (self == their) or (self > their) + def _encode(self): # pragma: no cover raise NotImplementedError() @@ -1327,10 +1339,7 @@ class Integer(Obj): ) def __lt__(self, their): - return self._value < their - - def __gt__(self, their): - return self._value > their + return self._value < their._value @property def named(self): @@ -1647,7 +1656,10 @@ class BitString(Obj): def copy(self): obj = self.__class__(_specs=self.specs) - obj._value = self._value + value = self._value + if value is not None: + value = (value[0], value[1]) + obj._value = value obj.tag = self.tag obj._expl = self._expl obj.default = self.default @@ -1946,6 +1958,9 @@ class OctetString(Obj): self._expl == their._expl ) + def __lt__(self, their): + return self._value < their._value + def __call__( self, value=None, @@ -2313,10 +2328,7 @@ class ObjectIdentifier(Obj): ) def __lt__(self, their): - return self._value < their - - def __gt__(self, their): - return self._value > their + return self._value < their._value def __call__( self,