diff options
| author | Scott Gasch <[email protected]> | 2022-02-09 22:18:59 -0800 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2022-02-09 22:18:59 -0800 |
| commit | c974b8cde11f133df7680967b759772c624007e9 (patch) | |
| tree | 9d6e60f8cd2317c4b836ca65696d956b644a7bc1 /base_presence.py | |
| parent | 804988efe7c8b131fc0c4b30088de2b5c5bd0b74 (diff) | |
More spring cleaning.
Diffstat (limited to 'base_presence.py')
| -rwxr-xr-x | base_presence.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/base_presence.py b/base_presence.py index f18b870..8be4d93 100755 --- a/base_presence.py +++ b/base_presence.py @@ -1,5 +1,10 @@ #!/usr/bin/env python3 +"""This is a module dealing with trying to guess a person's location +based on the location of certain devices (e.g. phones, laptops) +belonging to that person. It works with networks I run that log +device MAC addresses active.""" + import datetime import logging import re @@ -38,6 +43,9 @@ cfg.add_argument( class PresenceDetection(object): + """See above. This is a base class for determining a person's + location on networks I administer.""" + def __init__(self) -> None: # Note: list most important devices first. self.devices_by_person: Dict[Person, List[str]] = { @@ -219,17 +227,11 @@ class PresenceDetection(object): if mac not in self.names_by_mac: continue mac_name = self.names_by_mac[mac] - logger.debug( - 'Looking for %s... check for mac %s (%s)', - name, mac, mac_name - ) + logger.debug('Looking for %s... check for mac %s (%s)', name, mac, mac_name) for location in self.location_ts_by_mac: if mac in self.location_ts_by_mac[location]: ts = (self.location_ts_by_mac[location])[mac] - logger.debug( - 'Seen %s (%s) at %s since %s', - mac, mac_name, location, ts - ) + logger.debug('Seen %s (%s) at %s since %s', mac, mac_name, location, ts) tiebreaks[location] = ts ( @@ -257,10 +259,8 @@ def main() -> None: for person in Person: print(f'{person} => {p.where_is_person_now(person)}') print() - - -# for location in Location: -# print(f'{location} => {p.is_anyone_in_location_now(location)}') + for location in Location: + print(f'{location} => {p.is_anyone_in_location_now(location)}') if __name__ == '__main__': |
