From 045e6ac0d66cc793e0472e5ed427121dd3423875 Mon Sep 17 00:00:00 2001 From: Jack Sweeney Date: Sat, 21 Nov 2020 18:26:27 +0000 Subject: [PATCH] Formatting -Remark -Docustrings --- README.md | 4 ++-- defAirport.py | 6 +++--- planeClass.py | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 546acd7..0614abb 100644 --- a/README.md +++ b/README.md @@ -105,8 +105,8 @@ cd plane-notify ### Configure individual planes -- an example file is given (plane1.ini) plane config files should be in the configs directory, the program looks for any file in that folder with a .ini exstenstion. -- each plane should have its own config +- an example file is given (plane1.ini) plane config files should be in the configs directory, the program looks for any file in that folder with a .ini exstenstion. +- each plane should have its own config ### Enter and create new Screen Session diff --git a/defAirport.py b/defAirport.py index d47096c..a79be74 100644 --- a/defAirport.py +++ b/defAirport.py @@ -8,12 +8,12 @@ def download_airports(): import requests url = 'https://ourairports.com/data/airports.csv' airports = requests.get(url) - + open('airports.csv', 'wb').write(airports.content) - except: + except: raise("Error getting airports.dat or storing") else: - #Writes current date to airports.dat to show when it was aqquired + #Writes current date to airports.dat to show when it was aqquired import datetime date = datetime.datetime.now() with open('airports.csv', 'a') as airports: diff --git a/planeClass.py b/planeClass.py index c431885..3c55216 100644 --- a/planeClass.py +++ b/planeClass.py @@ -1,5 +1,6 @@ class Plane: def __init__(self, icao, conf_file): + '''Initializes a plane object from its config file and given icao''' self.icao = icao.upper() self.conf_file = conf_file self.geo_alt_ft = None @@ -14,7 +15,6 @@ class Plane: self.latitude = None self.callsign = None self.takeoff_time = None - self.map_file_name = icao.upper() + "_map.png" self.last_latitude = None self.last_longitude = None @@ -25,7 +25,7 @@ class Plane: def getICAO(self): return self.icao def run(self, ac_dict, source): - + '''Runs a check of a plane module to see if its landed or takenoff using plane data, and takes action if so''' #Import Modules #Clear Terminal #print("\033[H\033[J") @@ -198,7 +198,7 @@ class Plane: self.trigger_type = "now on ground" self.landed_header = "Landed in " self.last_feed_data = None - #Store a dictionary when data is lost near landing conditions, + #Store a dictionary when data is lost near landing conditions, elif self.last_below_desired_ft and self.last_feeding and self.feeding is False and self.last_on_ground is False: self.last_feed_data = {} self.last_feed_data.update(self.__dict__) @@ -353,7 +353,7 @@ class Plane: elif self.config.get('MAP', 'OPTION') == "ADSBX": getSS(self.icao) append_airport(self.map_file_name, nearest_airport_dict['icao'], nearest_airport_dict['name'], nearest_airport_dict['distance']) - + else: raise Exception("Map option not set correctly in this planes conf") #Discord