Compare commits
	
		
			No commits in common. "master" and "v2.1.3" have entirely different histories.
		
	
	
		
							
								
								
									
										3
									
								
								setup.py
								
								
								
								
							
							
						
						
									
										3
									
								
								setup.py
								
								
								
								
							|  | @ -92,8 +92,5 @@ setup( | ||||||
|         'Programming Language :: Python :: 3.5', |         'Programming Language :: Python :: 3.5', | ||||||
|         'Programming Language :: Python :: 3.6', |         'Programming Language :: Python :: 3.6', | ||||||
|         'Programming Language :: Python :: 3.7', |         'Programming Language :: Python :: 3.7', | ||||||
|         'Programming Language :: Python :: 3.8', |  | ||||||
|         'Programming Language :: Python :: 3.9', |  | ||||||
|         'Programming Language :: Python :: 3.10', |  | ||||||
|     ] |     ] | ||||||
| ) | ) | ||||||
|  |  | ||||||
							
								
								
									
										55
									
								
								speedtest.py
								
								
								
								
							
							
						
						
									
										55
									
								
								speedtest.py
								
								
								
								
							|  | @ -15,18 +15,18 @@ | ||||||
| #    License for the specific language governing permissions and limitations | #    License for the specific language governing permissions and limitations | ||||||
| #    under the License. | #    under the License. | ||||||
| 
 | 
 | ||||||
| import csv |  | ||||||
| import datetime |  | ||||||
| import errno |  | ||||||
| import math |  | ||||||
| import os | import os | ||||||
| import platform |  | ||||||
| import re | import re | ||||||
|  | import csv | ||||||
|  | import sys | ||||||
|  | import math | ||||||
|  | import errno | ||||||
| import signal | import signal | ||||||
| import socket | import socket | ||||||
| import sys |  | ||||||
| import threading |  | ||||||
| import timeit | import timeit | ||||||
|  | import datetime | ||||||
|  | import platform | ||||||
|  | import threading | ||||||
| import xml.parsers.expat | import xml.parsers.expat | ||||||
| 
 | 
 | ||||||
| try: | try: | ||||||
|  | @ -36,7 +36,7 @@ except ImportError: | ||||||
|     gzip = None |     gzip = None | ||||||
|     GZIP_BASE = object |     GZIP_BASE = object | ||||||
| 
 | 
 | ||||||
| __version__ = '2.1.4b1' | __version__ = '2.1.3' | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class FakeShutdownEvent(object): | class FakeShutdownEvent(object): | ||||||
|  | @ -49,8 +49,6 @@ class FakeShutdownEvent(object): | ||||||
|         "Dummy method to always return false""" |         "Dummy method to always return false""" | ||||||
|         return False |         return False | ||||||
| 
 | 
 | ||||||
|     is_set = isSet |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| # Some global variables we use | # Some global variables we use | ||||||
| DEBUG = False | DEBUG = False | ||||||
|  | @ -58,7 +56,6 @@ _GLOBAL_DEFAULT_TIMEOUT = object() | ||||||
| PY25PLUS = sys.version_info[:2] >= (2, 5) | PY25PLUS = sys.version_info[:2] >= (2, 5) | ||||||
| PY26PLUS = sys.version_info[:2] >= (2, 6) | PY26PLUS = sys.version_info[:2] >= (2, 6) | ||||||
| PY32PLUS = sys.version_info[:2] >= (3, 2) | PY32PLUS = sys.version_info[:2] >= (3, 2) | ||||||
| PY310PLUS = sys.version_info[:2] >= (3, 10) |  | ||||||
| 
 | 
 | ||||||
| # Begin import game to handle Python 2 and Python 3 | # Begin import game to handle Python 2 and Python 3 | ||||||
| try: | try: | ||||||
|  | @ -269,6 +266,17 @@ else: | ||||||
|             write(arg) |             write(arg) | ||||||
|         write(end) |         write(end) | ||||||
| 
 | 
 | ||||||
|  | if PY32PLUS: | ||||||
|  |     etree_iter = ET.Element.iter | ||||||
|  | elif PY25PLUS: | ||||||
|  |     etree_iter = ET_Element.getiterator | ||||||
|  | 
 | ||||||
|  | if PY26PLUS: | ||||||
|  |     thread_is_alive = threading.Thread.is_alive | ||||||
|  | else: | ||||||
|  |     thread_is_alive = threading.Thread.isAlive | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| # Exception "constants" to support Python 2 through Python 3 | # Exception "constants" to support Python 2 through Python 3 | ||||||
| try: | try: | ||||||
|     import ssl |     import ssl | ||||||
|  | @ -285,23 +293,6 @@ except ImportError: | ||||||
|     ssl = None |     ssl = None | ||||||
|     HTTP_ERRORS = (HTTPError, URLError, socket.error, BadStatusLine) |     HTTP_ERRORS = (HTTPError, URLError, socket.error, BadStatusLine) | ||||||
| 
 | 
 | ||||||
| if PY32PLUS: |  | ||||||
|     etree_iter = ET.Element.iter |  | ||||||
| elif PY25PLUS: |  | ||||||
|     etree_iter = ET_Element.getiterator |  | ||||||
| 
 |  | ||||||
| if PY26PLUS: |  | ||||||
|     thread_is_alive = threading.Thread.is_alive |  | ||||||
| else: |  | ||||||
|     thread_is_alive = threading.Thread.isAlive |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| def event_is_set(event): |  | ||||||
|     try: |  | ||||||
|         return event.is_set() |  | ||||||
|     except AttributeError: |  | ||||||
|         return event.isSet() |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| class SpeedtestException(Exception): | class SpeedtestException(Exception): | ||||||
|     """Base exception for this module""" |     """Base exception for this module""" | ||||||
|  | @ -778,7 +769,7 @@ def print_dots(shutdown_event): | ||||||
|     status |     status | ||||||
|     """ |     """ | ||||||
|     def inner(current, total, start=False, end=False): |     def inner(current, total, start=False, end=False): | ||||||
|         if event_is_set(shutdown_event): |         if shutdown_event.isSet(): | ||||||
|             return |             return | ||||||
| 
 | 
 | ||||||
|         sys.stdout.write('.') |         sys.stdout.write('.') | ||||||
|  | @ -817,7 +808,7 @@ class HTTPDownloader(threading.Thread): | ||||||
|         try: |         try: | ||||||
|             if (timeit.default_timer() - self.starttime) <= self.timeout: |             if (timeit.default_timer() - self.starttime) <= self.timeout: | ||||||
|                 f = self._opener(self.request) |                 f = self._opener(self.request) | ||||||
|                 while (not event_is_set(self._shutdown_event) and |                 while (not self._shutdown_event.isSet() and | ||||||
|                         (timeit.default_timer() - self.starttime) <= |                         (timeit.default_timer() - self.starttime) <= | ||||||
|                         self.timeout): |                         self.timeout): | ||||||
|                     self.result.append(len(f.read(10240))) |                     self.result.append(len(f.read(10240))) | ||||||
|  | @ -873,7 +864,7 @@ class HTTPUploaderData(object): | ||||||
| 
 | 
 | ||||||
|     def read(self, n=10240): |     def read(self, n=10240): | ||||||
|         if ((timeit.default_timer() - self.start) <= self.timeout and |         if ((timeit.default_timer() - self.start) <= self.timeout and | ||||||
|                 not event_is_set(self._shutdown_event)): |                 not self._shutdown_event.isSet()): | ||||||
|             chunk = self.data.read(n) |             chunk = self.data.read(n) | ||||||
|             self.total.append(len(chunk)) |             self.total.append(len(chunk)) | ||||||
|             return chunk |             return chunk | ||||||
|  | @ -911,7 +902,7 @@ class HTTPUploader(threading.Thread): | ||||||
|         request = self.request |         request = self.request | ||||||
|         try: |         try: | ||||||
|             if ((timeit.default_timer() - self.starttime) <= self.timeout and |             if ((timeit.default_timer() - self.starttime) <= self.timeout and | ||||||
|                     not event_is_set(self._shutdown_event)): |                     not self._shutdown_event.isSet()): | ||||||
|                 try: |                 try: | ||||||
|                     f = self._opener(request) |                     f = self._opener(request) | ||||||
|                 except TypeError: |                 except TypeError: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue