Skip to content

Commit

Permalink
flake8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
robdmc committed Jul 24, 2015
1 parent 954e90c commit 307fe90
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 61 deletions.
3 changes: 0 additions & 3 deletions pandashells/bin/p_cdf.py
Expand Up @@ -23,8 +23,6 @@


def main():
#msg = "Plot cumulative distribution of input column."

msg = textwrap.dedent(
"""
Plots the emperical cumulative distribution function (ECDF).
Expand All @@ -45,7 +43,6 @@ def main():
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter, description=msg)


# specify column to use
parser.add_argument(
"-c", "--col", required=True, nargs=1,
Expand Down
2 changes: 0 additions & 2 deletions pandashells/bin/p_df.py
Expand Up @@ -186,8 +186,6 @@ def main(): # pragma: no cover
-----------------------------------------------------------------------
""")



parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter, description=msg)
arg_lib.add_args(parser, 'io_in', 'io_out', 'decorating', 'example')
Expand Down
4 changes: 2 additions & 2 deletions pandashells/bin/p_example_data.py
Expand Up @@ -2,7 +2,7 @@

# standard library imports
import os
import sys
import sys # noqa
import argparse

import pandashells
Expand All @@ -22,7 +22,7 @@ def main():
parser = argparse.ArgumentParser(description=msg)

parser.add_argument(
'-d', '--dataset', nargs=1, type=str,
'-d', '--dataset', nargs=1, type=str,
dest='dataset', choices=sorted(f_dict.keys()), required=True,
help='The name of the sample dataset')

Expand Down
14 changes: 1 addition & 13 deletions pandashells/bin/p_facet_grid.py
Expand Up @@ -2,7 +2,6 @@

# standard library imports
import argparse
import re
import sys # NOQA just use this for patching in tests
import textwrap

Expand All @@ -12,16 +11,13 @@
module_checker_lib.check_for_modules(
['pandas', 'numpy', 'matplotlib', 'seaborn'])

import numpy as np
import matplotlib as mpl
import pylab as pl
import seaborn as sns

sns.set_context('talk')
CC = mpl.rcParams['axes.color_cycle']



def main():
msg = textwrap.dedent(
"""
Expand Down Expand Up @@ -81,9 +77,6 @@ def main():
'--kwargs', nargs='+', type=str, dest='kwargs',
metavar='kwargs', help=msg)

#parser.add_argument(
# '--sharex', type=bool, dest='sharex', default
# metavar='kwargs', help=msg)
msg = 'Share x axis'
parser.add_argument('--sharex', action='store_true', dest='sharex',
default=False, help=msg)
Expand Down Expand Up @@ -127,15 +120,10 @@ def main():
for kwarg in args.kwargs:
exec('map_kwargs.update(dict({}))'.format(kwarg))

grid.map(map_func, *map_args, **map_kwargs)
grid.map(map_func, *map_args, **map_kwargs) # noqa defined in exec above
grid.add_legend()
plot_lib.show(args)



#seaborn.FacetGrid(data, row=None, col=None, hue=None, col_wrap=None, sharex=True, sharey=True, size=3, aspect=1,
# palette=None, row_order=None, col_order=None, hue_order=None, hue_kws=None, dropna=True,
# legend_out=True, despine=True, margin_titles=False, xlim=None, ylim=None, subplot_kws=None,
# gridspec_kws=None)
if __name__ == '__main__': # pragma: no cover
main()
76 changes: 39 additions & 37 deletions pandashells/lib/arg_lib.py
Expand Up @@ -33,17 +33,19 @@ def _io_in_adder(parser, config_dict, *args):

# allow the option of supplying input column names
msg = 'Overwrite input column names with this list'
group.add_argument('--names', nargs='+', type=str,
dest='names', metavar="name",
help=msg)
group.add_argument(
'--names', nargs='+', type=str, dest='names',
metavar="name", help=msg)

default_for_input = [config_dict['io_input_type'],
config_dict['io_input_header']]
default_for_input = [
config_dict['io_input_type'],
config_dict['io_input_header']
]
msg = 'Must be one of {}'.format(repr(io_opt_list))
group.add_argument('-i', '--input_options', nargs='+',
type=str, dest='input_options', metavar='option',
default=default_for_input, choices=io_opt_list,
help=msg)
group.add_argument(
'-i', '--input_options', nargs='+', type=str, dest='input_options',
metavar='option', default=default_for_input, choices=io_opt_list,
help=msg)


def _io_out_adder(parser, config_dict, *args):
Expand Down Expand Up @@ -95,44 +97,44 @@ def _decorating_adder(parser, *args):

group = parser.add_argument_group('Plot specific Options')
msg = "Set the x-limits for the plot"
group.add_argument('--xlim', nargs=2, type=float, dest='xlim',
metavar=('XMIN', 'XMAX'), help=msg)
group.add_argument(
'--xlim', nargs=2, type=float, dest='xlim',
metavar=('XMIN', 'XMAX'), help=msg)
msg = "Set the y-limits for the plot"
group.add_argument('--ylim', nargs=2, type=float, dest='ylim',
metavar=('YMIN', 'YMAX'), help=msg)
group.add_argument(
'--ylim', nargs=2, type=float, dest='ylim',
metavar=('YMIN', 'YMAX'), help=msg)
msg = "Set the x-label for the plot"
group.add_argument('--xlabel', nargs=1, type=str, dest='xlabel',
help=msg)
group.add_argument(
'--xlabel', nargs=1, type=str, dest='xlabel', help=msg)
msg = "Set the y-label for the plot"
group.add_argument('--ylabel', nargs=1, type=str, dest='ylabel',
help=msg)
group.add_argument(
'--ylabel', nargs=1, type=str, dest='ylabel', help=msg)
msg = "Set the title for the plot"
group.add_argument('--title', nargs=1, type=str, dest='title',
help=msg)
group.add_argument(
'--title', nargs=1, type=str, dest='title', help=msg)
msg = "Specify legend location"
group.add_argument('--legend', nargs=1, type=str, dest='legend',
choices=['1', '2', '3', '4', 'best'], help=msg)
group.add_argument(
'--legend', nargs=1, type=str, dest='legend',
choices=['1', '2', '3', '4', 'best'], help=msg)
msg = "Specify whether hide the grid or not"
group.add_argument('--nogrid', action='store_true', dest='no_grid',
default=False, help=msg)
group.add_argument(
'--nogrid', action='store_true', dest='no_grid', default=False,
help=msg)
msg = "Specify plot context. Default = '{}' ".format(context_list[0])
group.add_argument('--context', nargs=1,
type=str, dest='plot_context',
default=[context_list[0]], choices=context_list,
help=msg)
group.add_argument(
'--context', nargs=1, type=str, dest='plot_context',
default=[context_list[0]], choices=context_list, help=msg)
msg = "Specify plot theme. Default = '{}' ".format(theme_list[0])
group.add_argument('--theme', nargs=1,
type=str, dest='plot_theme',
default=[theme_list[0]], choices=theme_list,
help=msg)
group.add_argument(
'--theme', nargs=1, type=str, dest='plot_theme',
default=[theme_list[0]], choices=theme_list, help=msg)
msg = "Specify plot palette. Default = '{}' ".format(palette_list[0])
group.add_argument('--palette', nargs=1,
type=str, dest='plot_palette',
default=[palette_list[0]], choices=palette_list,
help=msg)
group.add_argument(
'--palette', nargs=1, type=str, dest='plot_palette',
default=[palette_list[0]], choices=palette_list, help=msg)
msg = "Save the figure to this file"
group.add_argument('--savefig', nargs=1, type=str,
help=msg)
group.add_argument('--savefig', nargs=1, type=str, help=msg)


def _xy_adder(parser, *args):
Expand Down
2 changes: 0 additions & 2 deletions pandashells/test/arg_lib_tests.py
Expand Up @@ -84,7 +84,6 @@ def test_io_out_adder_active(self):
"""
# set up mock parser
parser = MagicMock()
#parser.add_argument = MagicMock()
group = MagicMock()
group.add_argument = MagicMock()
parser.add_argument_group = MagicMock(return_value=group)
Expand Down Expand Up @@ -244,7 +243,6 @@ def test_xy_adder_active(self):
# make sure proper calls were made
self.assertEqual(parser.add_argument.call_args_list, calls)


@patch('pandashells.lib.arg_lib._xy_adder')
@patch('pandashells.lib.arg_lib._decorating_adder')
@patch('pandashells.lib.arg_lib._io_out_adder')
Expand Down
2 changes: 0 additions & 2 deletions pandashells/test/p_crypt_test.py
Expand Up @@ -5,8 +5,6 @@

from pandashells.bin.p_crypt import main

#TODO: Mock out the add_args methods in failing tests to get them to pass


class MainTests(TestCase):

Expand Down

0 comments on commit 307fe90

Please sign in to comment.