Skip to content

Commit 1cfd305

Browse files
committed
Fix python 3 pep errors
Change-Id: I377b3cbcebcaed178141d19223bafb9d377ca2c3
1 parent a414f87 commit 1cfd305

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

hdrh/histogram.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,8 @@ def output_percentile_distribution(self,
577577
out_file,
578578
output_value_unit_scaling_ratio,
579579
ticks_per_half_distance=5):
580-
out_file.write('%12s %14s %10s %14s\n\n' %
581-
('Value', 'Percentile', 'TotalCount', '1/(1-Percentile)'))
580+
out_file.write(b'%12s %14s %10s %14s\n\n' %
581+
(b'Value', b'Percentile', b'TotalCount', b'1/(1-Percentile)'))
582582

583583
percentile_format = '%12.{}f %2.12f %10d %14.2f\n'.format(self.significant_figures)
584584
last_line_percentile_format = '%12.{}f %2.12f %10d\n'.format(self.significant_figures)
@@ -588,18 +588,21 @@ def output_percentile_distribution(self,
588588
total_count = iter_value.total_count_to_this_value
589589
if iter_value.percentile_level_iterated_to != 100:
590590
other = 1 / (1 - iter_value.percentile_level_iterated_to / 100)
591-
out_file.write(percentile_format % (value, percentile, total_count, other))
591+
out_file.write(percentile_format.encode() % (value, percentile,
592+
total_count, other))
592593
else:
593-
out_file.write(last_line_percentile_format % (value, percentile, total_count))
594+
out_file.write(last_line_percentile_format.encode() % (value,
595+
percentile,
596+
total_count))
594597

595598
mean = self.get_mean_value() / output_value_unit_scaling_ratio
596599
stddev = self.get_stddev()
597-
out_file.write('#[Mean = %12.{0}f, StdDeviation = %12.{0}f]\n'.format(
598-
self.significant_figures) % (mean, stddev))
600+
out_file.write('#[Mean = %12.{0}f, StdDeviation = %12.{0}f]\n'.
601+
format(self.significant_figures).encode() % (mean, stddev))
599602

600603
max = self.get_max_value() / output_value_unit_scaling_ratio
601604
total = self.get_total_count()
602605
out_file.write('#[Max = %12.{0}f, TotalCount = %12.{0}f]\n'.format(
603-
self.significant_figures) % (max, total))
604-
out_file.write('#[Buckets = %12d, SubBuckets = %12d]\n' % (
606+
self.significant_figures).encode() % (max, total))
607+
out_file.write(b'#[Buckets = %12d, SubBuckets = %12d]\n' % (
605608
self.bucket_count, self.sub_bucket_count))

0 commit comments

Comments
 (0)