kopia lustrzana https://github.com/ctjacobs/pyqso
Flake8.
rodzic
2d30163e7d
commit
5454c8e296
|
@ -18,12 +18,6 @@
|
||||||
# along with PyQSO. If not, see <http://www.gnu.org/licenses/>.
|
# along with PyQSO. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import unittest
|
|
||||||
try:
|
|
||||||
import configparser
|
|
||||||
except ImportError:
|
|
||||||
import ConfigParser as configparser
|
|
||||||
from os.path import expanduser
|
|
||||||
|
|
||||||
|
|
||||||
class Cabrillo:
|
class Cabrillo:
|
||||||
|
@ -33,12 +27,10 @@ class Cabrillo:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
""" Initialise class for I/O of files using the Cabrillo format. """
|
""" Initialise class for I/O of files using the Cabrillo format. """
|
||||||
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def write(self, records, path):
|
def write(self, records, path):
|
||||||
|
|
||||||
logging.debug("Writing records to an Cabrillo file...")
|
logging.debug("Writing records to an Cabrillo file...")
|
||||||
try:
|
try:
|
||||||
f = open(path, mode='w', errors="replace") # Open file for writing
|
f = open(path, mode='w', errors="replace") # Open file for writing
|
||||||
|
@ -49,7 +41,10 @@ class Cabrillo:
|
||||||
|
|
||||||
# Write each record to the file.
|
# Write each record to the file.
|
||||||
for r in records:
|
for r in records:
|
||||||
|
|
||||||
|
# Frequency
|
||||||
|
freq = r["FREQ"]
|
||||||
|
|
||||||
# Mode
|
# Mode
|
||||||
if(r["MODE"] == "SSB"):
|
if(r["MODE"] == "SSB"):
|
||||||
mo = "PH"
|
mo = "PH"
|
||||||
|
@ -62,15 +57,28 @@ class Cabrillo:
|
||||||
mo = "RY"
|
mo = "RY"
|
||||||
|
|
||||||
# Date in yyyy-mm-dd format.
|
# Date in yyyy-mm-dd format.
|
||||||
date = r["QSO_DATE"][0:4] + "-" + r["QSO_DATE"][4:6] + "-" r["QSO_DATE"][6:8]
|
date = r["QSO_DATE"][0:4] + "-" + r["QSO_DATE"][4:6] + "-" + r["QSO_DATE"][6:8]
|
||||||
|
|
||||||
# Time
|
# Time
|
||||||
time = r["TIME_ON"]
|
time = r["TIME_ON"]
|
||||||
|
|
||||||
# Callsign
|
# The callsign that was used when operating the contest station.
|
||||||
call = r["CALL"]
|
call_sent = "TEST"
|
||||||
|
|
||||||
f.write("""QSO: %s %s %s %s %s \n""" % (freq, mo, date, time, call, ))
|
# Exchange (the part sent to the distant station)
|
||||||
|
exch_sent = r["RST_SENT"]
|
||||||
|
|
||||||
|
# Callsign
|
||||||
|
call_rcvd = r["CALL"]
|
||||||
|
|
||||||
|
# Exchange (the part received from the distant station)
|
||||||
|
exch_rcvd = r["RST_RCVD"]
|
||||||
|
|
||||||
|
# Transmitter ID (must be 0 or 1, if applicable).
|
||||||
|
# FIXME: For now this has been hard-coded to 0.
|
||||||
|
t = "0"
|
||||||
|
|
||||||
|
f.write("""QSO: %s %s %s %s %s %s %s %s %s\n""" % (freq, mo, date, time, call_sent, exch_sent, call_rcvd, exch_rcvd, t))
|
||||||
|
|
||||||
# Footer
|
# Footer
|
||||||
f.write("END-OF-LOG:")
|
f.write("END-OF-LOG:")
|
||||||
|
|
Ładowanie…
Reference in New Issue