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()
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()