Code Duplication    Length = 25-25 lines in 2 locations

sources/tableau_hyper_management/ProjectNeeds.py 1 location

@@ 81-105 (lines=25) @@
78
        # checking inputs, if anything is invalid an exit(1) will take place
79
        self.fn_check_inputs_specific(self.parameters)
80
81
    def listing_parameter_values(self, in_logger, timer, title, in_config, given_parameter_values):
82
        timer.start()
83
        in_logger.info('=' * 50)
84
        in_logger.info(self.locale.gettext('{application_name} has started')
85
                       .replace('{application_name}', title))
86
        in_logger.info('~' * 50)
87
        in_logger.info(self.locale.gettext('Overview of input parameter given values'))
88
        in_logger.info('~' * 50)
89
        parameter_values_dictionary = given_parameter_values.__dict__
90
        for input_key, attributes in in_config.items():
91
            # checking first if short key was provided, otherwise consider longer
92
            if input_key in parameter_values_dictionary:
93
                key_value_to_consider = input_key
94
            else:
95
                key_value_to_consider = attributes['option_long'].replace('-', '_')
96
            # having the key consider we determine the value of the current parameter
97
            value_to_consider = parameter_values_dictionary[key_value_to_consider]
98
            # we build the parameter feedback considering "option_description"
99
            # and replacing %s with parameter value
100
            feedback = self.locale.gettext(attributes['option_description']) \
101
                .replace('%s', value_to_consider)
102
            # we finally write the feedback to logger
103
            in_logger.info(feedback)
104
        in_logger.info('~' * 50)
105
        timer.stop()
106

sources/common/CommandLineArgumentsManagement.py 1 location

@@ 23-47 (lines=25) @@
20
        lang_folder = os.path.join(os.path.dirname(__file__), current_script + '_Locale')
21
        self.locale = gettext.translation(current_script, lang_folder, languages=[default_language])
22
23
    def listing_parameter_values(self, in_logger, timer, title, in_config, given_parameter_values):
24
        timer.start()
25
        in_logger.info('=' * 50)
26
        in_logger.info(self.locale.gettext('{application_name} has started')
27
                       .replace('{application_name}', title))
28
        in_logger.info('~' * 50)
29
        in_logger.info(self.locale.gettext('Overview of input parameter given values'))
30
        in_logger.info('~' * 50)
31
        parameter_values_dictionary = given_parameter_values.__dict__
32
        for input_key, attributes in in_config.items():
33
            # checking first if short key was provided, otherwise consider longer
34
            if input_key in parameter_values_dictionary:
35
                key_value_to_consider = input_key
36
            else:
37
                key_value_to_consider = attributes['option_long'].replace('-', '_')
38
            # having the key consider we determine the value of the current parameter
39
            value_to_consider = parameter_values_dictionary[key_value_to_consider]
40
            # we build the parameter feedback considering "option_description"
41
            # and replacing %s with parameter value
42
            feedback = self.locale.gettext(attributes['option_description']) \
43
                .replace('%s', str(value_to_consider))
44
            # we finally write the feedback to logger
45
            in_logger.info(feedback)
46
        in_logger.info('~' * 50)
47
        timer.stop()
48
49
    def parse_arguments(self, configuration_details):
50
        parser = argparse.ArgumentParser()