Optionally surface exceptions that happen under executors by reading
[python_utils.git] / arper.py
index 39aecf90bd438af92d69cffae6f4a3d44ea6aa0e..7700d5a994286f263dd14c35cf44a6e8a3d6c56b 100644 (file)
--- a/arper.py
+++ b/arper.py
@@ -2,6 +2,7 @@
 
 """A caching layer around the kernel's network mapping between IPs and MACs"""
 
+
 import datetime
 import logging
 import os
@@ -131,10 +132,7 @@ class Arper(persistent.Persistent):
                     mac = mac.lower()
                     ip = ip.strip()
                     cached_state[mac] = ip
-            if (
-                len(cached_state)
-                > config.config['arper_min_entries_to_be_valid']
-            ):
+            if len(cached_state) > config.config['arper_min_entries_to_be_valid']:
                 return cls(cached_state)
             else:
                 msg = f'{cache_file} is invalid: only {len(cached_state)} entries.  Deleting it.'
@@ -147,12 +145,8 @@ class Arper(persistent.Persistent):
     @overrides
     def save(self) -> bool:
         if len(self.state) > config.config['arper_min_entries_to_be_valid']:
-            logger.debug(
-                f'Persisting state to {config.config["arper_cache_location"]}'
-            )
-            with file_utils.FileWriter(
-                config.config['arper_cache_location']
-            ) as wf:
+            logger.debug(f'Persisting state to {config.config["arper_cache_location"]}')
+            with file_utils.FileWriter(config.config['arper_cache_location']) as wf:
                 for (mac, ip) in self.state.items():
                     mac = mac.lower()
                     print(f'{mac}, {ip}', file=wf)