diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2019-11-16 10:19:07 -0800 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2019-11-16 19:19:07 +0100 |
commit | a7d2ac036866e5f437bd6f9a9f01723f601b4073 (patch) | |
tree | 543d918472952d4d7b41ff9ea3ff56fc21b38448 /pyasn1/type/univ.py | |
parent | e51d6f520bdd57748f70b8defc2bda1ddea9856b (diff) | |
download | pyasn1-git-a7d2ac036866e5f437bd6f9a9f01723f601b4073.tar.gz |
Drop support for EOL Pythons (#131)
Python 2.4, 2.5, 2.6, 3.2 and 3.3 are end of life. They are no longer
receiving bug fixes, including for security issues. These Pythons went
EOL on:
Python 2.6: 2013-10-29
Python 3.2: 2016-02-20
Python 3.3: 2017-09-29
For additional details on supported Python versions, see:
https://devguide.python.org/#status-of-python-branches
Removing support for EOL Pythons will reduce testing and maintenance
resources.
Using pypinfo, here are the download statistics of the project for the
last 30 days, showing limited downloads from EOL Pythons:
| python_version | percent | download_count |
| -------------- | ------: | -------------: |
| 2.7 | 90.33% | 7,975,885 |
| 3.6 | 4.95% | 437,261 |
| 3.5 | 2.99% | 263,637 |
| 3.4 | 1.02% | 89,723 |
| 2.6 | 0.69% | 60,511 |
| 3.7 | 0.02% | 2,024 |
| 3.3 | 0.00% | 441 |
| 3.2 | 0.00% | 38 |
| 3.8 | 0.00% | 9 |
| None | 0.00% | 2 |
By removing support for older Pythons, can remove or update the
following workarounds and code:
* Built-in function bin() is always available.
* Built-in function callable() is always available.
* Built-in function all() is always available.
* The collections.OrderedDict class is always available.
* The datetime.strptime() method is always available.
* The platform module is always available.
* The string.partition() method is always available.
* The NullHandler class is always available.
* The method .__trunc__() is always available.
* Can use set literals.
* Updated unittest is always available. The unittest2 module is
unnecessary.
Users on older versions of Python can continue to download, install, and
use older versions of the library that continue to have support for
older Pythons.
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 |