From 33e74b1f3e6b0bdde1e4c4149f05637978db1738 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 3 May 2021 13:49:27 -0400 Subject: [PATCH] agent: Use consistent naming for parameters to __exit__() Using these specific names prevents Vulture from identifying these parameters as unused. --- monkey/infection_monkey/network/firewall.py | 2 +- monkey/infection_monkey/utils/auto_new_user.py | 2 +- monkey/infection_monkey/utils/linux/users.py | 2 +- monkey/infection_monkey/utils/windows/users.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/monkey/infection_monkey/network/firewall.py b/monkey/infection_monkey/network/firewall.py index cddba49fe..0851a575f 100644 --- a/monkey/infection_monkey/network/firewall.py +++ b/monkey/infection_monkey/network/firewall.py @@ -31,7 +31,7 @@ class FirewallApp(object): def __enter__(self): return self - def __exit__(self, exc_type, value, traceback): + def __exit__(self, _exc_type, value, traceback): self.close() def close(self): diff --git a/monkey/infection_monkey/utils/auto_new_user.py b/monkey/infection_monkey/utils/auto_new_user.py index f3ebda0af..767237d1f 100644 --- a/monkey/infection_monkey/utils/auto_new_user.py +++ b/monkey/infection_monkey/utils/auto_new_user.py @@ -31,7 +31,7 @@ class AutoNewUser(metaclass=abc.ABCMeta): raise NotImplementedError() @abc.abstractmethod - def __exit__(self, exc_type, exc_val, exc_tb): + def __exit__(self, _exc_type, value, traceback): raise NotImplementedError() @abc.abstractmethod diff --git a/monkey/infection_monkey/utils/linux/users.py b/monkey/infection_monkey/utils/linux/users.py index 9bd3c2bf8..002c63f96 100644 --- a/monkey/infection_monkey/utils/linux/users.py +++ b/monkey/infection_monkey/utils/linux/users.py @@ -54,7 +54,7 @@ class AutoNewLinuxUser(AutoNewUser): ) return subprocess.call(command_as_new_user) - def __exit__(self, exc_type, exc_val, exc_tb): + def __exit__(self, _exc_type, value, traceback): # delete the user. commands_to_delete_user = get_linux_commands_to_delete_user(self.username) logger.debug( diff --git a/monkey/infection_monkey/utils/windows/users.py b/monkey/infection_monkey/utils/windows/users.py index 06e626783..1a2bee53c 100644 --- a/monkey/infection_monkey/utils/windows/users.py +++ b/monkey/infection_monkey/utils/windows/users.py @@ -111,7 +111,7 @@ class AutoNewWindowsUser(AutoNewUser): def get_logon_handle(self): return self.logon_handle - def __exit__(self, exc_type, exc_val, exc_tb): + def __exit__(self, _exc_type, value, traceback): # Logoff self.logon_handle.Close()