-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhint.py
More file actions
executable file
·144 lines (126 loc) · 4.39 KB
/
hint.py
File metadata and controls
executable file
·144 lines (126 loc) · 4.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
############################################################################################
#
# hint.py - Rev 1.0
# Copyright (C) 2021-5 by Joseph B. Attili, joe DOT aa2il AT gmail DOT com
#
# Routines for generating hints from past contest logs and/or contacts.
#
############################################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
############################################################################################
from utilities import error_trap
from counties import COUNTIES
############################################################################################
# Routine to sift through previous contest lists to get a hint of exhcange
# info (qth, member no. etc.)
def master(P,call,dx_station=None,VERBOSITY=0):
call=call.upper()
if VERBOSITY>0:
print('HINT->MASTER: call=',call,len(P.calls))
# Check for DX calls
if (call not in P.calls) and dx_station and ('/' in call):
call=dx_station.homecall
if call in P.calls:
if VERBOSITY>0:
print('HINT->MASTER:',call,' is in master list')
if P.KEYING:
h=P.KEYING.hint(call)
try:
print('HINT->MASTER: call=',call,'\n\tmaster=',P.MASTER[call],'\n\thint=',h)
except:
error_trap('HINT->MASTER - I dont know what I am doing here'+call,1)
return h
else:
print('HINT->MASTER: No hints available for this contest')
return None
else:
if VERBOSITY>0:
print('HINT->MASTER:',call,' is NOT in master list')
if dx_station:
if P.contest_name=='CQWW':
return dx_station.cqz
return None
# Routine to give a hint of QTH of a CA station
def commie_fornia(dx_station,qth,VERBOSITY=0):
if dx_station.country=='United States' and dx_station.cqz==3:
if VERBOSITY>0:
print('Commie-fornia')
hints=[]
n=len(qth)
for s in COUNTIES['CA']:
if qth==s[0:n]:
hints.append(s)
return ' '.join(hints)
else:
return None
"""
# Routine to give a hint of QTH of a Canadian station
def oh_canada(dx_station):
Prefixes Province/Territory
VE1 VA1 Nova Scotia
VE2 VA2 Quebec
VE3 VA3 Ontario
VE4 VA4 Manitoba
VE5 VA5 Saskatchewan
VE6 VA6 Alberta
VE7 VA7 British Columbia
VE8 Northwest Territories
VE9 New Brunswick
VE0* International Waters
VO1 Newfoundland
VO2 Labrador
VY1 Yukon
VY2 Prince Edward Island
VY9** Government of Canada
VY0 Nunavut
CY0*** Sable Is.[16]
CY9*** St-Paul Is.[16]
For the CQP:
MR Maritimes
QC Quebec
ON Ontario
MB Manitoba
SK Saskatchewan
AB Alberta
BC British Columbia
NT
# For Cali QSO Party:
# MR = Maritime provinces plus Newfoundland and Labrador (NB, NL, NS, PE)
CQP_VE_CALL_AREAS = ['??','MR','QC','ON','MB','SK','AB','BC','NT']
if dx_station.country=='Canada':
#if (dx_station.prefix=='VO2' or dx_station.prefix=='VY2'):
if dx_station.prefix in ['VO2','VY2','VE9']:
qth='MR'
else:
num=int( dx_station.call_number )
if num>=0 and num<len( CQP_VE_CALL_AREAS ):
qth=CQP_VE_CALL_AREAS[num]
else:
y
qth=''
print('**** ERROR *** HINTS - Oh Canada - having trouble with',\
dx_station.call,dx_station.call_number,num)
elif dx_station.country=='Alaska':
qth='AK'
elif dx_station.country=='Hawaii':
qth='HI'
elif dx_station.country=='Puerto Rico':
qth='PR'
elif dx_station.country=='US Virgin Islands':
qth='VI'
elif dx_station.country and dx_station.country!='United States':
qth='DX'
else:
qth=None
return qth
"""