)
cfg.add_argument(
'--presence_tolerable_staleness_seconds',
type=argparse_utils.valid_duration,
default=datetime.timedelta(seconds=60 * 5),
metavar='DURATION',
)
cfg.add_argument(
'--presence_tolerable_staleness_seconds',
type=argparse_utils.valid_duration,
default=datetime.timedelta(seconds=60 * 5),
metavar='DURATION',
# Note: list most important devices first.
self.devices_by_person: Dict[Person, List[str]] = {
Person.SCOTT: [
# Note: list most important devices first.
self.devices_by_person: Dict[Person, List[str]] = {
Person.SCOTT: [
- "DC:E5:5B:0F:03:3D", # pixel6
- "6C:40:08:AE:DC:2E", # laptop
+ "DC:E5:5B:0F:03:3D", # pixel6
+ "6C:40:08:AE:DC:2E", # laptop
- "08:CC:27:63:26:14", # motog7
- "B8:31:B5:9A:4F:19", # laptop
+ "08:CC:27:63:26:14", # motog7
+ "B8:31:B5:9A:4F:19", # laptop
- "0C:CB:85:0C:8B:AE", # phone
- "D0:C6:37:E3:36:9A", # laptop
+ "0C:CB:85:0C:8B:AE", # phone
+ "D0:C6:37:E3:36:9A", # laptop
self.run_location = site_config.get_location()
logger.debug(f"run_location is {self.run_location}")
self.weird_mac_at_cabin = False
self.run_location = site_config.get_location()
logger.debug(f"run_location is {self.run_location}")
self.weird_mac_at_cabin = False
- self.location_ts_by_mac: Dict[
- Location, Dict[str, datetime.datetime]
- ] = defaultdict(dict)
+ self.location_ts_by_mac: Dict[Location, Dict[str, datetime.datetime]] = defaultdict(dict)
self.names_by_mac: Dict[str, str] = {}
self.dark_locations: Set[Location] = set()
self.names_by_mac: Dict[str, str] = {}
self.dark_locations: Set[Location] = set()
self.dark_locations.add(Location.CABIN)
def update_from_cabin(self) -> None:
from exec_utils import cmd
self.dark_locations.add(Location.CABIN)
def update_from_cabin(self) -> None:
from exec_utils import cmd
- def read_persisted_macs_file(
- self, filename: str, location: Location
- ) -> None:
+ def read_persisted_macs_file(self, filename: str, location: Location) -> None:
if location is Location.UNKNOWN:
return
with open(filename, "r") as rf:
if location is Location.UNKNOWN:
return
with open(filename, "r") as rf:
cabin_count += 1
try:
(mac, count, ip_name, mfg, ts) = line.split(",")
cabin_count += 1
try:
(mac, count, ip_name, mfg, ts) = line.split(",")
ip_name = ip_name.strip()
match = re.match(r"(\d+\.\d+\.\d+\.\d+) +\(([^\)]+)\)", ip_name)
if match is not None:
ip_name = ip_name.strip()
match = re.match(r"(\d+\.\d+\.\d+\.\d+) +\(([^\)]+)\)", ip_name)
if match is not None:
if len(self.dark_locations) > 0:
msg = f"Can't see {self.dark_locations} right now; answer confidence impacted"
logger.warning(msg)
if len(self.dark_locations) > 0:
msg = f"Can't see {self.dark_locations} right now; answer confidence impacted"
logger.warning(msg)
votes: Dict[Location, int] = {}
tiebreaks: Dict[Location, datetime.datetime] = {}
credit = 10000
votes: Dict[Location, int] = {}
tiebreaks: Dict[Location, datetime.datetime] = {}
credit = 10000
bonus = credit
v = votes.get(most_recent_location, 0)
votes[most_recent_location] = v + bonus
logger.debug(f'{name}: {location} gets {bonus} votes.')
bonus = credit
v = votes.get(most_recent_location, 0)
votes[most_recent_location] = v + bonus
logger.debug(f'{name}: {location} gets {bonus} votes.')