Skip to content

Commit 73736e1

Browse files
committed
Small fixes
Sometimes I really hate pylint, but I suppose it makes me a "better programmer"
1 parent 8a6c678 commit 73736e1

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

mods/data_info.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ def import_test ():
99

1010

1111
class SatelliteData:
12+
""" Takes Celestrak satellite group and data directory path + Optional force download and max amount of days before downloading again."""
1213
def __init__ (self, sat_group:str, data_path:str, force_dl=False, max_days=7.0):
1314
self.data_path = data_path
1415
self.csv_path = self.getkeps(sat_group, force_dl, max_days)
@@ -17,19 +18,11 @@ def __init__ (self, sat_group:str, data_path:str, force_dl=False, max_days=7.0):
1718

1819
# Imports satinfo.txt and grabs additionally added satellite information.
1920
def __addinfo__(self, d_dir, csv_path):
20-
"""Imports Satellite information via the satinfo.txt in the /data directory
21-
Returns->list [ {
22-
"Name" : Satellite Name,
23-
"NORAD" : NORAD ID,
24-
"Uplink" : Uplink Frequency,
25-
"Downlink" : Downlink Frequency,
26-
"Mode" : Transmitter Mode } ], ...
27-
"""
2821
sat_info = []
29-
with open(path.join(d_dir,'satinfo.txt'), "rt", encoding="utf-8") as info:
22+
with open(path.join(d_dir,'satinfo.txt'), 'rt', encoding='utf-8') as info:
3023
info_list = info.read().split("\n")
3124
col = "NORAD_CAT_ID"
32-
with open(csv_path, mode='r', newline='') as f:
25+
with open(csv_path, mode='r', newline='', encoding='utf-8') as f:
3326
csv_data = DictReader(f)
3427
for row in csv_data:
3528
for nfo in info_list:
@@ -60,8 +53,6 @@ def getkeps(self, sat_group:str, force_dl:bool, max_days:float):
6053
if not load.exists(file_path) or load.days_old(file_path) >= max_days or force_dl:
6154
if force_dl: print("Downloading...")
6255
load.download(url, filename=file_path)
63-
with load.open(file_path, mode='r') as f:
64-
kep_data = list(DictReader(f))
6556
return file_path
6657

6758
print(f"{self.data_path} does not exist.")

mods/path_to.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def import_test ():
66

77

88
def data_dir():
9-
if path.exists("..\\data"): data_dir = "..\\data"
10-
elif path.exists(".\\data"): data_dir = ".\\data"
9+
if path.exists("..\\data"): data = "..\\data"
10+
elif path.exists(".\\data"): data = ".\\data"
1111
else: raise NotADirectoryError("No data directory found")
12-
return data_dir
12+
return data

0 commit comments

Comments
 (0)