kopia lustrzana https://github.com/projecthorus/radiosonde_auto_rx
				
				
				
			
							rodzic
							
								
									3e061465c8
								
							
						
					
					
						commit
						664352bd77
					
				|  | @ -17,6 +17,7 @@ import time | |||
| import traceback | ||||
| import os | ||||
| from dateutil.parser import parse | ||||
| from queue import Queue | ||||
| 
 | ||||
| if sys.version_info < (3, 6): | ||||
|     print("CRITICAL - radiosonde_auto_rx requires Python 3.6 or newer!") | ||||
|  | @ -49,13 +50,6 @@ from autorx.web import ( | |||
| from autorx.gpsd import GPSDAdaptor | ||||
| from autorx.sdr_wrappers import shutdown_sdr | ||||
| 
 | ||||
| try: | ||||
|     # Python 2 | ||||
|     from Queue import Queue | ||||
| except ImportError: | ||||
|     # Python 3 | ||||
|     from queue import Queue | ||||
| 
 | ||||
| 
 | ||||
| # Logging level | ||||
| # INFO = Basic status messages | ||||
|  |  | |||
|  | @ -5,11 +5,6 @@ | |||
| #   Copyright (C) 2018  Mark Jessop <vk5qi@rfhead.net> | ||||
| #   Released under GNU GPL v3 or later | ||||
| # | ||||
| try: | ||||
|     # Python 2 | ||||
|     from Queue import Queue | ||||
| except ImportError: | ||||
|     # Python 3 | ||||
| from queue import Queue | ||||
| 
 | ||||
| # Now using Semantic Versioning (https://semver.org/)  MAJOR.MINOR.PATCH | ||||
|  |  | |||
|  | @ -11,17 +11,11 @@ import random | |||
| import time | ||||
| import traceback | ||||
| import socket | ||||
| from queue import Queue | ||||
| from threading import Thread, Lock | ||||
| from . import __version__ as auto_rx_version | ||||
| from .utils import strip_sonde_serial | ||||
| 
 | ||||
| try: | ||||
|     # Python 2 | ||||
|     from Queue import Queue | ||||
| except ImportError: | ||||
|     # Python 3 | ||||
|     from queue import Queue | ||||
| 
 | ||||
| 
 | ||||
| def telemetry_to_aprs_position( | ||||
|     sonde_data, object_name="<id>", aprs_comment="BOM Balloon", position_report=False | ||||
|  |  | |||
|  | @ -11,6 +11,7 @@ import logging | |||
| import os | ||||
| import traceback | ||||
| import json | ||||
| from configparser import RawConfigParser | ||||
| from .sdr_wrappers import test_sdr | ||||
| 
 | ||||
| # Dummy initial config with some parameters we need to make the web interface happy. | ||||
|  | @ -26,13 +27,6 @@ global_config = { | |||
| # Web interface credentials | ||||
| web_password = "none" | ||||
| 
 | ||||
| try: | ||||
|     # Python 2 | ||||
|     from ConfigParser import RawConfigParser | ||||
| except ImportError: | ||||
|     # Python 3 | ||||
|     from configparser import RawConfigParser | ||||
| 
 | ||||
| # Fixed minimum update rates for APRS & Habitat | ||||
| # These are set to avoid congestion on the APRS-IS network, and on the Habitat server | ||||
| # Please respect other users of these networks and leave these settings as they are. | ||||
|  |  | |||
|  | @ -11,19 +11,12 @@ import time | |||
| import smtplib | ||||
| from email.mime.text import MIMEText | ||||
| from email.utils import formatdate | ||||
| from queue import Queue | ||||
| from threading import Thread | ||||
| from .config import read_auto_rx_config | ||||
| from .utils import position_info, strip_sonde_serial | ||||
| from .geometry import GenericTrack | ||||
| 
 | ||||
| try: | ||||
|     # Python 2 | ||||
|     from Queue import Queue | ||||
| 
 | ||||
| except ImportError: | ||||
|     # Python 3 | ||||
|     from queue import Queue | ||||
| 
 | ||||
| 
 | ||||
| class EmailNotification(object): | ||||
|     """ Radiosonde Email Notification Class. | ||||
|  |  | |||
|  | @ -15,16 +15,10 @@ import traceback | |||
| import json | ||||
| from base64 import b64encode | ||||
| from hashlib import sha256 | ||||
| from queue import Queue | ||||
| from threading import Thread, Lock | ||||
| from . import __version__ as auto_rx_version | ||||
| 
 | ||||
| try: | ||||
|     # Python 2 | ||||
|     from Queue import Queue | ||||
| except ImportError: | ||||
|     # Python 3 | ||||
|     from queue import Queue | ||||
| 
 | ||||
| # These get replaced out after init | ||||
| url_habitat_uuids = "" | ||||
| url_habitat_db = "" | ||||
|  |  | |||
|  | @ -10,14 +10,8 @@ import glob | |||
| import logging | ||||
| import os | ||||
| import time | ||||
| from threading import Thread | ||||
| 
 | ||||
| try: | ||||
|     # Python 2 | ||||
|     from Queue import Queue | ||||
| except ImportError: | ||||
|     # Python 3 | ||||
| from queue import Queue | ||||
| from threading import Thread | ||||
| 
 | ||||
| 
 | ||||
| class TelemetryLogger(object): | ||||
|  |  | |||
|  | @ -10,14 +10,8 @@ import json | |||
| import logging | ||||
| import socket | ||||
| import time | ||||
| from threading import Thread | ||||
| 
 | ||||
| try: | ||||
|     # Python 2 | ||||
|     from Queue import Queue | ||||
| except ImportError: | ||||
|     # Python 3 | ||||
| from queue import Queue | ||||
| from threading import Thread | ||||
| 
 | ||||
| 
 | ||||
| class OziUploader(object): | ||||
|  |  | |||
|  | @ -10,16 +10,10 @@ import socket | |||
| import time | ||||
| import numpy as np | ||||
| 
 | ||||
| from queue import Queue | ||||
| from threading import Thread, Lock | ||||
| from autorx.utils import position_info | ||||
| 
 | ||||
| try: | ||||
|     # Python 2 | ||||
|     from Queue import Queue | ||||
| except ImportError: | ||||
|     # Python 3 | ||||
|     from queue import Queue | ||||
| 
 | ||||
| 
 | ||||
| def read_rotator(rotctld_host="localhost", rotctld_port=4533, timeout=5): | ||||
|     """ Attempt to read a position from a rotctld server. | ||||
|  |  | |||
|  | @ -13,6 +13,7 @@ import platform | |||
| import subprocess | ||||
| import time | ||||
| import traceback | ||||
| from io import StringIO | ||||
| from threading import Thread, Lock | ||||
| from types import FunctionType, MethodType | ||||
| from .utils import ( | ||||
|  | @ -24,12 +25,6 @@ from .utils import ( | |||
| ) | ||||
| from .sdr_wrappers import * | ||||
| 
 | ||||
| try: | ||||
|     # Python 2 | ||||
|     from StringIO import StringIO | ||||
| except ImportError: | ||||
|     # Python 3 | ||||
|     from io import StringIO | ||||
| 
 | ||||
| try: | ||||
|     from .web import flask_emit_event | ||||
|  |  | |||
|  | @ -18,16 +18,10 @@ import logging | |||
| import os | ||||
| import requests | ||||
| import time | ||||
| from queue import Queue | ||||
| from threading import Thread | ||||
| from email.utils import formatdate | ||||
| 
 | ||||
| try: | ||||
|     # Python 2 | ||||
|     from Queue import Queue | ||||
| except ImportError: | ||||
|     # Python 3 | ||||
|     from queue import Queue | ||||
| 
 | ||||
| 
 | ||||
| class SondehubUploader(object): | ||||
|     """ Sondehub Uploader Class. | ||||
|  | @ -83,21 +77,11 @@ class SondehubUploader(object): | |||
|         # Record of when we last uploaded a user station position to Sondehub. | ||||
|         self.last_user_position_upload = 0 | ||||
| 
 | ||||
|         try: | ||||
|             # Python 2 check. Python 2 doesnt have gzip.compress so this will throw an exception. | ||||
|             gzip.compress(b"\x00\x00") | ||||
| 
 | ||||
|         # Start queue processing thread. | ||||
|         self.input_processing_running = True | ||||
|         self.input_process_thread = Thread(target=self.process_queue) | ||||
|         self.input_process_thread.start() | ||||
| 
 | ||||
|         except: | ||||
|             logging.error( | ||||
|                 "Detected Python 2.7, which does not support gzip.compress. Sondehub DB uploading will be disabled." | ||||
|             ) | ||||
|             self.input_processing_running = False | ||||
| 
 | ||||
|     def update_station_position(self, lat, lon, alt): | ||||
|         """ Update the internal station position record. Used when determining the station position by GPSD """ | ||||
|         if self.inhibit_upload: | ||||
|  |  | |||
|  | @ -22,14 +22,8 @@ import semver | |||
| from dateutil.parser import parse | ||||
| from datetime import datetime, timedelta | ||||
| from math import radians, degrees, sin, cos, atan2, sqrt, pi | ||||
| from . import __version__ as auto_rx_version | ||||
| 
 | ||||
| try: | ||||
|     # Python 2 | ||||
|     from Queue import Queue | ||||
| except ImportError: | ||||
|     # Python 3 | ||||
| from queue import Queue | ||||
| from . import __version__ as auto_rx_version | ||||
| 
 | ||||
| 
 | ||||
| # List of binaries we check for on startup | ||||
|  | @ -723,8 +717,7 @@ def is_not_linux(): | |||
| 
 | ||||
|     # Second check for the existence of '-Microsoft' in the uname release field. | ||||
|     # This is a good check that we are running in WSL. | ||||
|     # Note the use of indexing instead of the named field, for Python 2 & 3 compatability. | ||||
|     if "Microsoft" in platform.uname()[2]: | ||||
|     if "Microsoft" in platform.uname().release: | ||||
|         return True | ||||
| 
 | ||||
|     # Else, we're probably in native Linux! | ||||
|  |  | |||
|  | @ -21,6 +21,7 @@ import autorx.scan | |||
| from autorx.geometry import GenericTrack | ||||
| from autorx.utils import check_autorx_versions | ||||
| from autorx.log_files import list_log_files, read_log_by_serial, zip_log_files | ||||
| from queue import Queue | ||||
| from threading import Thread | ||||
| import flask | ||||
| from flask import request, abort, make_response, send_file | ||||
|  | @ -35,13 +36,6 @@ except ImportError: | |||
|     ) | ||||
|     sys.exit(1) | ||||
| 
 | ||||
| try: | ||||
|     # Python 2 | ||||
|     from Queue import Queue | ||||
| except ImportError: | ||||
|     # Python 3 | ||||
|     from queue import Queue | ||||
| 
 | ||||
| 
 | ||||
| # Inhibit Flask warning message about running a development server... (we know!) | ||||
| cli = sys.modules["flask.cli"] | ||||
|  |  | |||
|  | @ -4,28 +4,18 @@ | |||
| # | ||||
| import sys | ||||
| 
 | ||||
| # Check if we are running in Python 2 or 3 | ||||
| PY3 = sys.version_info[0] == 3 | ||||
| 
 | ||||
| _sample_rate = int(sys.argv[1]) | ||||
| _symbol_rate = int(sys.argv[2]) | ||||
| 
 | ||||
| _bit_length = _sample_rate // _symbol_rate | ||||
| 
 | ||||
| if PY3: | ||||
| _zero = b'\x00'*_bit_length | ||||
| _one = b'\xFF'*_bit_length | ||||
| 
 | ||||
| _in = sys.stdin.read | ||||
| _out = sys.stdout.buffer.write | ||||
| 
 | ||||
| else: | ||||
| 	_zero = '\x00'*_bit_length | ||||
| 	_one = '\xFF'*_bit_length | ||||
| 
 | ||||
| 	_in = sys.stdin.read | ||||
| 	_out = sys.stdout.write	 | ||||
| 
 | ||||
| while True: | ||||
| 	_char = _in(1) | ||||
| 
 | ||||
|  |  | |||
|  | @ -13,12 +13,9 @@ import socket, json, sys, traceback | |||
| from threading import Thread | ||||
| from dateutil.parser import parse | ||||
| from datetime import datetime, timedelta | ||||
| from io import StringIO | ||||
| import time | ||||
| 
 | ||||
| try: | ||||
|     from StringIO import StringIO ## for Python 2 | ||||
| except ImportError: | ||||
|     from io import StringIO ## for Python 3 | ||||
| 
 | ||||
| MAX_JSON_LEN = 32768 | ||||
| 
 | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Jiří Pinkava
						Jiří Pinkava