diff options
author | Ilya Etingof <etingof@gmail.com> | 2019-11-23 09:57:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-23 09:57:24 +0100 |
commit | 2b646e07d5d83f0892fa2a809ae4c981430cb12c (patch) | |
tree | 20b10450bced84c425ca0735b4ee7202e68ee1ec /pyasn1/type/univ.py | |
parent | 788af3c44edc2ebd079eda3f7a4ae2f9931446fd (diff) | |
parent | f10434e31f9293c4e739ac6c5d1519f407bd1540 (diff) | |
download | pyasn1-git-2b646e07d5d83f0892fa2a809ae4c981430cb12c.tar.gz |
Merge branch 'master' into streamoptimum37
Diffstat (limited to 'pyasn1/type/univ.py')
-rw-r--r-- | pyasn1/type/univ.py | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/pyasn1/type/univ.py b/pyasn1/type/univ.py index aa688b2..05fa677 100644 --- a/pyasn1/type/univ.py +++ b/pyasn1/type/univ.py @@ -9,7 +9,6 @@ import sys from pyasn1 import error from pyasn1.codec.ber import eoo -from pyasn1.compat import binary from pyasn1.compat import integer from pyasn1.compat import octets from pyasn1.type import base @@ -231,9 +230,8 @@ class Integer(base.SimpleAsn1Type): def __ceil__(self): return math.ceil(self._value) - if sys.version_info[0:2] > (2, 5): - def __trunc__(self): - return self.clone(math.trunc(self._value)) + def __trunc__(self): + return self.clone(math.trunc(self._value)) def __lt__(self, value): return self._value < value @@ -586,7 +584,7 @@ class BitString(base.SimpleAsn1Type): def asBinary(self): """Get |ASN.1| value as a text string of bits. """ - binString = binary.bin(self._value)[2:] + binString = bin(self._value)[2:] return '0' * (len(self._value) - len(binString)) + binString @classmethod @@ -719,19 +717,6 @@ class BitString(base.SimpleAsn1Type): ) -try: - # noinspection PyStatementEffect - all - -except NameError: # Python 2.4 - # noinspection PyShadowingBuiltins - def all(iterable): - for element in iterable: - if not element: - return False - return True - - class OctetString(base.SimpleAsn1Type): """Create |ASN.1| schema or value object. @@ -1499,9 +1484,8 @@ class Real(base.SimpleAsn1Type): def __ceil__(self): return self.clone(math.ceil(float(self))) - if sys.version_info[0:2] > (2, 5): - def __trunc__(self): - return self.clone(math.trunc(float(self))) + def __trunc__(self): + return self.clone(math.trunc(float(self))) def __lt__(self, value): return float(self) < value |