示例#1
0
    def __repr__(self):
        """Print representation of profiler instance.

        """

        # get name of profiler
        profiler_name = self.__class__.__name__

        # get parameter names
        param_names = get_param_names(self.__class__.__init__, ["self"])
        param_dict = {x: getattr(self, x) for x in param_names}

        return header(profiler_name) + enumeration(param_dict)
示例#2
0
    def __repr__(self):

        template = '{wrangler_name} ({computation_engine})\n\n{parameters}'\

        parameters = (_pprint.header("Parameters", 3) +
                      _pprint.enumeration(self.get_params(), 3))

        _repr = template.format(wrangler_name=self.__class__.__name__,
                                computation_engine=self.computation_engine,
                                parameters=parameters)

        if not self.preserves_sample_size:
            _repr += "\n\n   Note: Does not preserve sample size."

        return _repr
示例#3
0
def test_enumeration_list_with_bullet():
    test_input = ["note 1", "note 2"]
    test_output = 'o note 1\no note 2'

    assert _pprint.enumeration(test_input, bullet_char="o") == test_output
示例#4
0
def test_enumeration_list_with_indent():
    test_input = ["note 1", "note 2"]
    test_output = '    - note 1\n    - note 2'

    assert _pprint.enumeration(test_input, indent=4) == test_output
示例#5
0
def test_enumeration_dict_align_values_with_align_width():
    test_input = {"a": 1, "bb": 2}
    test_output = '-   a: 1\n-  bb: 2'

    assert _pprint.enumeration(test_input, align_width=3) == test_output
示例#6
0
def test_enumeration_dict_align_values_false():
    test_input = {"a": 1, "bb": 2}
    test_output = '- a: 1\n- bb: 2'

    assert _pprint.enumeration(test_input, align_values=False) == test_output