From 13870220aa6319be8d5ac036d1984c5165649f97 Mon Sep 17 00:00:00 2001 From: Brian McDonnell Date: Thu, 25 Sep 2014 23:32:14 +0100 Subject: [PATCH 1/6] Fixed PEP8 violation: Should not assign to a lambda. --- bashplotlib/utils/helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bashplotlib/utils/helpers.py b/bashplotlib/utils/helpers.py index bfffe46..a86bfc5 100644 --- a/bashplotlib/utils/helpers.py +++ b/bashplotlib/utils/helpers.py @@ -7,7 +7,8 @@ import sys -isiterable = lambda x: hasattr(x, '__iter__') or hasattr(x, '__getitem__') +def isiterable(x): + return hasattr(x, '__iter__') or hasattr(x, '__getitem__') bcolours = { "white": '\033[97m', From ec92b961dfec1cd845f20455dd9f0e608c2081d1 Mon Sep 17 00:00:00 2001 From: Brian McDonnell Date: Thu, 25 Sep 2014 23:32:48 +0100 Subject: [PATCH 2/6] Fixed PEP8 violation. Whitespace required around operators. --- bashplotlib/utils/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bashplotlib/utils/helpers.py b/bashplotlib/utils/helpers.py index a86bfc5..bb11c94 100644 --- a/bashplotlib/utils/helpers.py +++ b/bashplotlib/utils/helpers.py @@ -69,7 +69,7 @@ def box_text(text, width, offset=0): """ Return text inside an ascii textbox """ - box = " " * offset + "-" * (width+2) + "\n" + box = " " * offset + "-" * (width + 2) + "\n" box += " " * offset + "|" + text.center(width) + "|" + "\n" - box += " " * offset + "-" * (width+2) + box += " " * offset + "-" * (width + 2) return box From 7e5872c968d0731bad4a38047806e62491dda24c Mon Sep 17 00:00:00 2001 From: Brian McDonnell Date: Thu, 25 Sep 2014 23:46:43 +0100 Subject: [PATCH 3/6] Fixed PEP8 violations: Comment style. --- bashplotlib/histogram.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bashplotlib/histogram.py b/bashplotlib/histogram.py index bfff5b1..7017c01 100644 --- a/bashplotlib/histogram.py +++ b/bashplotlib/histogram.py @@ -55,7 +55,7 @@ def run_demo(): sys.stderr.write("run the downloaddata.sh script in the example first\n") sys.exit(1) - #plotting a histogram + # plotting a histogram print "plotting a basic histogram" print "plot_hist('%s')" % demo_file print "hist -f %s" % demo_file @@ -63,21 +63,21 @@ def run_demo(): plot_hist(demo_file) print "*" * 80 - #with colours + # with colours print "histogram with colours" print "plot_hist('%s', colour='blue')" % demo_file print "hist -f %s -c blue" % demo_file plot_hist(demo_file, colour='blue') print "*" * 80 - #changing the shape of the point + # changing the shape of the point print "changing the shape of the bars" print "plot_hist('%s', pch='.')" % demo_file print "hist -f %s -p ." % demo_file plot_hist(demo_file, pch='.') print "*" * 80 - #changing the size of the plot + # changing the size of the plot print "changing the size of the plot" print "plot_hist('%s', height=35.0, bincount=40)" % demo_file print "hist -f %s -s 35.0 -b 40" % demo_file From f4d08162ba26bf72167b588bf9f94b31e501505d Mon Sep 17 00:00:00 2001 From: Brian McDonnell Date: Thu, 25 Sep 2014 23:47:14 +0100 Subject: [PATCH 4/6] Fixed PEP8 violation: Line too long. --- bashplotlib/histogram.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bashplotlib/histogram.py b/bashplotlib/histogram.py index 7017c01..966d8ce 100644 --- a/bashplotlib/histogram.py +++ b/bashplotlib/histogram.py @@ -84,7 +84,9 @@ def run_demo(): plot_hist(demo_file, height=35.0, bincount=40) -def plot_hist(f, height=20.0, bincount=None, binwidth=None, pch="o", colour="default", title="", xlab=None, showSummary=False, regular=False): +def plot_hist(f, height=20.0, bincount=None, binwidth=None, pch="o", + colour="default", title="", xlab=None, showSummary=False, + regular=False): """ Make a histogram From 3c21b8eb61af5c7e34862437d8f54422ede456e3 Mon Sep 17 00:00:00 2001 From: Brian McDonnell Date: Thu, 25 Sep 2014 23:59:56 +0100 Subject: [PATCH 5/6] Converted import * to explicit import list. --- bashplotlib/histogram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bashplotlib/histogram.py b/bashplotlib/histogram.py index 966d8ce..6e36567 100644 --- a/bashplotlib/histogram.py +++ b/bashplotlib/histogram.py @@ -10,7 +10,7 @@ import math import optparse from os.path import dirname -from .utils.helpers import * +from .utils.helpers import isiterable, drange, box_text, printcolour, colour_help from .utils.commandhelp import hist From e091ab7339727e39b925f33cd4e0dc697fa73458 Mon Sep 17 00:00:00 2001 From: Brian McDonnell Date: Fri, 26 Sep 2014 00:46:27 +0100 Subject: [PATCH 6/6] Fixed long ling PEP8 violations. --- bashplotlib/histogram.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bashplotlib/histogram.py b/bashplotlib/histogram.py index 6e36567..3e4d638 100644 --- a/bashplotlib/histogram.py +++ b/bashplotlib/histogram.py @@ -10,7 +10,8 @@ import math import optparse from os.path import dirname -from .utils.helpers import isiterable, drange, box_text, printcolour, colour_help +from .utils.helpers import (isiterable, drange, box_text, + printcolour, colour_help) from .utils.commandhelp import hist @@ -52,7 +53,8 @@ def run_demo(): if not os.path.isfile(demo_file): sys.stderr.write("demo input file not found!\n") - sys.stderr.write("run the downloaddata.sh script in the example first\n") + sys.stderr.write("run the downloaddata.sh script \ +in the example first\n") sys.exit(1) # plotting a histogram @@ -230,7 +232,8 @@ def main(): if opts.demo: run_demo() elif opts.f: - plot_hist(opts.f, opts.h, opts.b, opts.binwidth, opts.p, opts.colour, opts.t, opts.x, opts.showSummary, opts.regular) + plot_hist(opts.f, opts.h, opts.b, opts.binwidth, opts.p, opts.colour, + opts.t, opts.x, opts.showSummary, opts.regular) else: print "nothing to plot!"