This is an automated email from the ASF dual-hosted git repository. vjasani pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push: new 119a3b3c70 Revert "fix: resolve python3 compiler warnings (#2) (#3781)" 119a3b3c70 is described below commit 119a3b3c700b0eeb6936fb5c2b00b1db49f9d91d Author: Viraj Jasani <vjas...@apache.org> AuthorDate: Thu Apr 18 13:44:42 2024 -0700 Revert "fix: resolve python3 compiler warnings (#2) (#3781)" This reverts commit ed9a149fb7e07ab032778410a5c7d3b558e1ee20. --- .../src/main/python/ambari_agent/HostCleanup.py | 2 +- .../libraries/functions/component_version.py | 2 +- ambari-server/src/main/python/ambari-server.py | 4 ++-- .../src/main/python/ambari_server/dbConfiguration.py | 6 +++--- .../python/ambari_server/dbConfiguration_windows.py | 4 ++-- .../main/python/ambari_server/serverConfiguration.py | 20 ++++++++++---------- .../src/main/python/ambari_server/userInput.py | 2 +- .../resources/scripts/check_ambari_permissions.py | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/ambari-agent/src/main/python/ambari_agent/HostCleanup.py b/ambari-agent/src/main/python/ambari_agent/HostCleanup.py index 11f94c04bd..1103fcc7ce 100644 --- a/ambari-agent/src/main/python/ambari_agent/HostCleanup.py +++ b/ambari-agent/src/main/python/ambari_agent/HostCleanup.py @@ -617,7 +617,7 @@ def get_choice_string_input(prompt, default, firstChoice, secondChoice): return True elif choice in secondChoice: return False - elif choice == "": # Just enter pressed + elif choice is "": # Just enter pressed return default else: print("input not recognized, please try again: ") diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/component_version.py b/ambari-common/src/main/python/resource_management/libraries/functions/component_version.py index b01b906eee..42d159f39c 100644 --- a/ambari-common/src/main/python/resource_management/libraries/functions/component_version.py +++ b/ambari-common/src/main/python/resource_management/libraries/functions/component_version.py @@ -64,7 +64,7 @@ def _get_component_repositories(config): :config: the configuration dictionary :return: """ - if "componentVersionMap" not in config or config["componentVersionMap"] == "": + if "componentVersionMap" not in config or config["componentVersionMap"] is "": return None return config["componentVersionMap"] diff --git a/ambari-server/src/main/python/ambari-server.py b/ambari-server/src/main/python/ambari-server.py index 320c788ec7..87b12204a6 100755 --- a/ambari-server/src/main/python/ambari-server.py +++ b/ambari-server/src/main/python/ambari-server.py @@ -731,13 +731,13 @@ def are_db_auth_options_ok(db_windows_auth, db_username, db_password): if db_windows_auth is True: return True else: - if db_username is not None and db_username != "" and db_password is not None and db_password != "": + if db_username is not None and db_username is not "" and db_password is not None and db_password is not "": return True return False @OsFamilyFuncImpl(OSConst.WINSRV_FAMILY) def are_cmd_line_db_args_valid(options): - if (options.database_host is not None and options.database_host != "" \ + if (options.database_host is not None and options.database_host is not "" \ #and options.database_name is not None \ # ambari by default is ok and are_db_auth_options_ok(options.database_windows_auth, options.database_username, diff --git a/ambari-server/src/main/python/ambari_server/dbConfiguration.py b/ambari-server/src/main/python/ambari_server/dbConfiguration.py index 0f0a272a45..9e8c1ffdea 100644 --- a/ambari-server/src/main/python/ambari_server/dbConfiguration.py +++ b/ambari-server/src/main/python/ambari_server/dbConfiguration.py @@ -239,20 +239,20 @@ class DBMSConfig(object): @staticmethod def _init_member_with_default(options, attr_name, default_val): options_val = getattr(options, attr_name, None) - val = options_val if options_val is not None and options_val != "" else default_val + val = options_val if options_val is not None and options_val is not "" else default_val return val @staticmethod def _init_member_with_properties(options, attr_name, properties, property_key): options_val = getattr(options, attr_name, None) - if options_val is None or options_val == "": + if options_val is None or options_val is "": options_val = get_value_from_properties(properties, property_key, None) return options_val @staticmethod def _init_member_with_prop_default(options, attr_name, properties, property_key, default_val): val = DBMSConfig._init_member_with_properties(options, attr_name, properties, property_key) - if val is None or val == "": + if val is None or val is "": val = default_val return val diff --git a/ambari-server/src/main/python/ambari_server/dbConfiguration_windows.py b/ambari-server/src/main/python/ambari_server/dbConfiguration_windows.py index e57f2f8a8b..d40548bdf1 100644 --- a/ambari-server/src/main/python/ambari_server/dbConfiguration_windows.py +++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_windows.py @@ -198,7 +198,7 @@ class MSSQLConfig(DBMSConfig): try: driver_path = properties[JDBC_DRIVER_PATH_PROPERTY] - if driver_path is None or driver_path == "": + if driver_path is None or driver_path is "": return 0 except Exception: # No such attribute set @@ -324,7 +324,7 @@ class MSSQLAmbariDBConfig(MSSQLConfig): super(MSSQLAmbariDBConfig, self).__init__(options, properties, storage_type) - if self.database_name is None or self.database_name == "": + if self.database_name is None or self.database_name is "": self.database_name = AMBARI_DATABASE_NAME self.persistence_property = PERSISTENCE_TYPE_PROPERTY diff --git a/ambari-server/src/main/python/ambari_server/serverConfiguration.py b/ambari-server/src/main/python/ambari_server/serverConfiguration.py index cec3fd7100..2d962d9707 100644 --- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py +++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py @@ -1041,7 +1041,7 @@ def get_original_master_key(properties, options = None): # Decrypt alias with master to validate it, if no master return password = None - if alias and env_master_key and env_master_key != "" and env_master_key != "None": + if alias and env_master_key and env_master_key is not "" and env_master_key != "None": password = read_passwd_for_alias(alias, env_master_key, options) if not password: try: @@ -1356,31 +1356,31 @@ class JDKRelease: inst_dir = "" def __init__(self, i_name, i_desc, i_url, i_dest_file, i_jcpol_url, i_dest_jcpol_file, i_inst_dir, i_reg_exp): - if i_name is None or i_name == "": + if i_name is None or i_name is "": raise FatalException(-1, "Invalid JDK name: " + (i_desc or "")) self.name = i_name - if i_desc is None or i_desc == "": + if i_desc is None or i_desc is "": self.desc = self.name else: self.desc = i_desc - if i_url is None or i_url == "": + if i_url is None or i_url is "": raise FatalException(-1, "Invalid URL for JDK " + i_name) self.url = i_url - if i_dest_file is None or i_dest_file == "": + if i_dest_file is None or i_dest_file is "": self.dest_file = i_name + ".exe" else: self.dest_file = i_dest_file - if not (i_jcpol_url is None or i_jcpol_url == ""): + if not (i_jcpol_url is None or i_jcpol_url is ""): self.jcpol_url = i_jcpol_url - if i_dest_jcpol_file is None or i_dest_jcpol_file == "": + if i_dest_jcpol_file is None or i_dest_jcpol_file is "": self.dest_jcpol_file = "jcpol-" + i_name + ".zip" else: self.dest_jcpol_file = i_dest_jcpol_file - if i_inst_dir is None or i_inst_dir == "": + if i_inst_dir is None or i_inst_dir is "": self.inst_dir = os.path.join(configDefaults.JDK_INSTALL_DIR, i_desc) else: self.inst_dir = i_inst_dir - if i_reg_exp is None or i_reg_exp == "": + if i_reg_exp is None or i_reg_exp is "": raise FatalException(-1, "Invalid output parsing regular expression for JDK " + i_name) self.reg_exp = i_reg_exp @@ -1392,7 +1392,7 @@ class JDKRelease: @staticmethod def __load_properties(properties, section_name): - if section_name is None or section_name == "": + if section_name is None or section_name is "": raise FatalException(-1, "Invalid properties section: " + ("(empty)" if section_name is None else "")) if(properties.__contains__(section_name + ".desc")): #Not critical desc = properties[section_name + ".desc"] diff --git a/ambari-server/src/main/python/ambari_server/userInput.py b/ambari-server/src/main/python/ambari_server/userInput.py index 0076c0b24f..69182bf962 100644 --- a/ambari-server/src/main/python/ambari_server/userInput.py +++ b/ambari-server/src/main/python/ambari_server/userInput.py @@ -58,7 +58,7 @@ def get_choice_string_input(prompt, default, firstChoice, secondChoice, answer = elif choice in secondChoice: result = False inputBool = False - elif choice == "": # Just enter pressed + elif choice is "": # Just enter pressed result = default inputBool = False else: diff --git a/ambari-server/src/main/resources/scripts/check_ambari_permissions.py b/ambari-server/src/main/resources/scripts/check_ambari_permissions.py index ce94881e68..d456c1d3b9 100644 --- a/ambari-server/src/main/resources/scripts/check_ambari_permissions.py +++ b/ambari-server/src/main/resources/scripts/check_ambari_permissions.py @@ -79,7 +79,7 @@ def get_choice_string_input(prompt, default, firstChoice, secondChoice): return True elif choice in secondChoice: return False - elif choice == "": # Just enter pressed + elif choice is "": # Just enter pressed return default else: print("input not recognized, please try again: ") --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@ambari.apache.org For additional commands, e-mail: commits-h...@ambari.apache.org