From 1be07a4828d3f4a47f7f6a92888bc74e7d2c8872 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 4 May 2021 14:43:11 -0400 Subject: [PATCH] monkey: Rename `get_from...()` methods in UserCreds to be more readable --- monkey/monkey_island/cc/environment/environment_config.py | 2 +- monkey/monkey_island/cc/environment/user_creds.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/monkey/monkey_island/cc/environment/environment_config.py b/monkey/monkey_island/cc/environment/environment_config.py index 183d10932..65c6e57b8 100644 --- a/monkey/monkey_island/cc/environment/environment_config.py +++ b/monkey/monkey_island/cc/environment/environment_config.py @@ -38,7 +38,7 @@ class EnvironmentConfig: self._load_from_dict(data) def _load_from_dict(self, dict_data: Dict): - user_creds = UserCreds.get_from_dict_server_config(dict_data) + user_creds = UserCreds.get_from_server_config_dict(dict_data) aws = dict_data["aws"] if "aws" in dict_data else None data_dir = dict_data["data_dir"] if "data_dir" in dict_data else DEFAULT_DATA_DIR diff --git a/monkey/monkey_island/cc/environment/user_creds.py b/monkey/monkey_island/cc/environment/user_creds.py index 385083311..dbd7b7422 100644 --- a/monkey/monkey_island/cc/environment/user_creds.py +++ b/monkey/monkey_island/cc/environment/user_creds.py @@ -28,7 +28,7 @@ class UserCreds: return User(1, self.username, self.password_hash) @staticmethod - def get_from_dict_new_registration(data_dict: Dict) -> UserCreds: + def get_from_new_registration_dict(data_dict: Dict) -> UserCreds: creds = UserCreds() if "user" in data_dict: creds.username = data_dict["user"] @@ -39,7 +39,7 @@ class UserCreds: return creds @staticmethod - def get_from_dict_server_config(data_dict: Dict) -> UserCreds: + def get_from_server_config_dict(data_dict: Dict) -> UserCreds: creds = UserCreds() if "user" in data_dict: creds.username = data_dict["user"] @@ -50,4 +50,4 @@ class UserCreds: @staticmethod def get_from_json(json_data: bytes) -> UserCreds: cred_dict = json.loads(json_data) - return UserCreds.get_from_dict_new_registration(cred_dict) + return UserCreds.get_from_new_registration_dict(cred_dict)