2727
2828# Fixed global default broadcast key for ephID generation.
2929BROADCAST_KEY = "Broadcast key"
30-
30+
3131# Length of an epoch (in minutes).
3232EPOCH_LENGTH = 15
3333
3434# Number of epochs per day.
3535NUM_EPOCHS_PER_DAY = 24 * 60 // EPOCH_LENGTH
36-
36+
3737# Duration key and contact history is kept (in days).
3838RETENTION_PERIOD = 14
3939
@@ -136,7 +136,7 @@ def get_epoch(self, now):
136136 def get_current_ephID (self , now = None ):
137137 ''' Returns the current ephID
138138 '''
139- if now == None :
139+ if now is None :
140140 now = datetime .now (timezone .utc )
141141 return self .ephIDs [self .get_epoch (now )]
142142
@@ -153,7 +153,7 @@ def __init__(self):
153153
154154 # Remote beacon management
155155 ##########################
156- def receive_scans (self , beacons = [] , now = None ):
156+ def receive_scans (self , beacons = None , now = None ):
157157 ''' Receive a set of new BLE beacons and process them.
158158
159159 Add the current received information to the observations for the
@@ -163,7 +163,10 @@ def receive_scans(self, beacons = [], now = None):
163163 beacons([]): list of received beacons.
164164 now(datetime): current time, override for mock testing.
165165 '''
166- if now == None :
166+ if beacons is None :
167+ beacons = []
168+
169+ if now is None :
167170 now = datetime .now (timezone .utc )
168171
169172 timestamp = (now .hour * 60 + now .minute )* 60 + now .second
@@ -234,7 +237,7 @@ def check_infected(self, inf_SK0, date, now = None):
234237 date(str): date of SK_t (i.e., the t in the form 2020-04-23).
235238 now(datetime): current date for mock testing.
236239 '''
237- if now == None :
240+ if now is None :
238241 now = datetime .now (timezone .utc )
239242 infect_date = datetime .strptime (date , "%Y-%m-%d" )
240243 days_infected = (now - infect_date ).days
@@ -273,4 +276,4 @@ def next_day(self):
273276 self .ctmgr .rotate_contacts ()
274277
275278 def next_epoch (self ):
276- self .ctmgr .process_epoch ()
279+ self .ctmgr .process_epoch ()
0 commit comments