From 2ca6b52565a15f7a5cdcff2ff8f11493c0dd9fe1 Mon Sep 17 00:00:00 2001 From: Jerry Gamblin Date: Mon, 6 Aug 2018 16:00:40 -0700 Subject: [PATCH] Linted Python With Pep8 Linted Python With Pep8 --- MiscScipts/CarInfo.py | 46 ++++++++++++++++++++---------------------- MiscScipts/obd_info.py | 14 ++++++------- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/MiscScipts/CarInfo.py b/MiscScipts/CarInfo.py index ff27a14..d35035b 100644 --- a/MiscScipts/CarInfo.py +++ b/MiscScipts/CarInfo.py @@ -1,36 +1,34 @@ +#!/usr/bin/env python import sys import time import obd import json import os -import curses - if len(sys.argv) == 1: connection = obd.OBD() else: - connection = obd.OBD(sys.argv[1]) # First arg is the device to connect to + connection = obd.OBD(sys.argv[1]) -curses.setupterm() -sys.stdout.write(curses.tigetstr("clear")) -sys.stdout.flush() +os.system('clear') while True: - print 'Car Information: ' - print 'Speed : ' + str(connection.query(obd.commands.SPEED).value.to("mph")) - print 'RPM : ' + str(connection.query(obd.commands.RPM).value) - print 'Fuel Level: ' + str(connection.query(obd.commands.FUEL_LEVEL).value) - print 'Engine Temp : ' + str(connection.query(obd.commands.COOLANT_TEMP).value.to("degF")) - print '\n' - print 'Diagonstic Information: ' - print 'Stored DTCs: ' + str(connection.query(obd.commands.GET_DTC).value) - print 'UpTme: ' + str(connection.query(obd.commands.RUN_TIME).value) - print '\n' - print 'Weather Information:' - print 'Air Temp: ' + str(connection.query(obd.commands.AMBIANT_AIR_TEMP).value.to("degF")) - print 'Barometric Pressure: ' + str(connection.query(obd.commands.BAROMETRIC_PRESSURE).value) - time.sleep(5) - curses.setupterm() - sys.stdout.write(curses.tigetstr("clear")) - sys.stdout.flush() - + print 'Car Information: ' + print 'Speed : ' + \ + str(connection.query(obd.commands.SPEED).value.to("mph")) + print 'RPM : ' + str(connection.query(obd.commands.RPM).value) + print 'Fuel Level: ' + str(connection.query(obd.commands.FUEL_LEVEL).value) + print 'Engine Temp : ' + \ + str(connection.query(obd.commands.COOLANT_TEMP).value.to("degF")) + print '\n' + print 'Diagonstic Information: ' + print 'Stored DTCs: ' + str(connection.query(obd.commands.GET_DTC).value) + print 'UpTme: ' + str(connection.query(obd.commands.RUN_TIME).value) + print '\n' + print 'Weather Information:' + print 'Air Temp: ' \ + + str(connection.query(obd.commands.AMBIANT_AIR_TEMP).value.to("degF")) + print 'Barometric Pressure: ' \ + + str(connection.query(obd.commands.BAROMETRIC_PRESSURE).value) + time.sleep(5) + os.system('clear') diff --git a/MiscScipts/obd_info.py b/MiscScipts/obd_info.py index a7a49f7..22ae4b4 100644 --- a/MiscScipts/obd_info.py +++ b/MiscScipts/obd_info.py @@ -1,6 +1,7 @@ +#!/usr/bin/env python # Usage: obd_test.py DEVICE # Example: obd_test.py /dev/ttyUSB0 -# Prints supported OBD commands to the console, along with their current values. +# Prints supported OBD commands to the console, along values. import sys import obd @@ -15,9 +16,8 @@ command_names = [] for command in connection.supported_commands: - try: - print("{}: {}".format(command.name, connection.query(command))) - command_names.append(command.name) - except NameError: - pass - + try: + print("{}: {}".format(command.name, connection.query(command))) + command_names.append(command.name) + except NameError: + pass