Пример #1
0
def partition_analysis(partition_name):
    dictionary_of_dir_files = {}
    extensions = set()
    extension_dict = {}
    file_size_dict = {}
    number_of_files = 0
    number_of_directories = 0

    for (root, directories, files) in os.walk(partition_name):

        number_of_directories, number_of_files = number_of_elements(
            number_of_directories, directories, number_of_files, files)
        dictionary_of_dir_files = {
            'directories': number_of_directories,
            'files': number_of_files
        }

        for file_name in files:
            extension = (os.path.splitext(file_name)[1][1:]).lower()
            extensions, extension_dict = get_extensions(
                extension, extensions, extension_dict)

            full_path = os.path.abspath(os.path.join(root, file_name))
            file_size_dict = get_file_sizes(full_path, extension,
                                            file_size_dict)

    print_number_of_elements(dictionary_of_dir_files)
    print_extensions_info(extensions, extension_dict)
    print_file_sizes_info(file_size_dict)

    page = Page()
    page.add(create_chart_dir_files(dictionary_of_dir_files),
             create_chart_extension_dict(extension_dict),
             create_chart_file_size_dict(file_size_dict))
    page.render()
Пример #2
0
def test_page_iter():
    charts = [gen_bar_base(), gen_line_base()]
    p = Page()
    p.add(*charts)

    for idx, c in enumerate(p):
        assert_equal(c, charts[idx])

    assert_equal(len(p), len(charts))
Пример #3
0
def test_page_before_render():
    charts = [gen_bar_base(), gen_line_base()]
    p = Page()
    p.add(*charts)

    assert_false(hasattr(p, "local_cfg"))
    assert_false(hasattr(p, "notebook_cfg"))
    p.before_render()
    assert_true(hasattr(p, "local_cfg"))
    assert_true(hasattr(p, "notebook_cfg"))
Пример #4
0
scatter_base().render()


def scatter_dotsize_tickcount():
    chart = Scatter("Scatter-散点大小")
    chart.set_options(dot_size=2, y_tick_count=8)
    chart.add_series("series-A",
                     [(z[0], z[1])
                      for z in zip(Faker.values(), Faker.values())])
    chart.add_series("series-B",
                     [(z[0], z[1])
                      for z in zip(Faker.values(), Faker.values())])
    return chart


def scatter_show_line():
    chart = Scatter("Scatter-散点连成线")
    chart.set_options(y_tick_count=8, is_show_line=True)
    chart.add_series("series-A",
                     [(z[0], z[1])
                      for z in zip(Faker.values(), Faker.values())])
    chart.add_series("series-B",
                     [(z[0], z[1])
                      for z in zip(Faker.values(), Faker.values())])
    return chart


page = Page()
page.add(scatter_base(), scatter_dotsize_tickcount(), scatter_show_line())
page.render()
Пример #5
0
def main():
    page = Page()
    page.add(scatter_base(), scatter_dotsize_tickcount(), scatter_show_line())
    put_html(page.render_notebook())
Пример #6
0
def main():
    page = Page()
    page.add(bar_base(), bar_tickcount_colors())
    put_html(page.render_notebook())
Пример #7
0
def main():
    page = Page()
    page.add(radar_base(), radar_legend_colors())
    put_html(page.render_notebook())
Пример #8
0
def main():
    page = Page()
    page.add(pie_base(), pie_legend_font(), pie_radius())
    put_html(page.render_notebook())
def main():
    page = Page()
    page.add(bar_base(), line_base(), pie_base(), radar_base(), scatter_base())
    put_html(page.render_notebook())
Пример #10
0
def main():
    page = Page()
    page.add(line_base(), line_legend(), line_tickcount_colors())
    put_html(page.render_notebook())