Skip to content

Commit

Permalink
pylint 1.7 fixes and 3.6 testing (#112)
Browse files Browse the repository at this point in the history
* pylint 1.7 fixes and 3.6 testing

* resolve sphinx

* rearrange some docstrings
  • Loading branch information
jwkvam committed Apr 14, 2017
1 parent 68b9529 commit 9bcda7e
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 55 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"

install:
# get latest version of node
Expand Down
2 changes: 1 addition & 1 deletion bowtie/_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def prod(ctx, extra):
try:
arg = sys.argv[1:]
except IndexError:
arg = '--help',
arg = ('--help',)
# pylint: disable=no-value-for-parameter
sys.exit(cmd(arg))

Expand Down
8 changes: 4 additions & 4 deletions bowtie/_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def json_conversion(obj):
# numpy isn't an explicit dependency of bowtie
# so we can't assume it's available
import numpy as np
if isinstance(obj, np.ndarray) or isinstance(obj, np.generic):
if isinstance(obj, np.ndarray, np.generic):
return obj.tolist()
except ImportError:
pass
Expand All @@ -54,7 +54,7 @@ def json_conversion(obj):
except ImportError:
pass

if isinstance(obj, datetime) or isinstance(obj, time) or isinstance(obj, date):
if isinstance(obj, datetime, time, date):
return obj.isoformat()
raise TypeError('Not sure how to serialize {} of type {}'.format(obj, type(obj)))

Expand All @@ -70,7 +70,7 @@ def encoders(obj):
# numpy isn't an explicit dependency of bowtie
# so we can't assume it's available
import numpy as np
if isinstance(obj, np.ndarray) or isinstance(obj, np.generic):
if isinstance(obj, np.ndarray, np.generic):
# https://docs.scipy.org/doc/numpy/reference/arrays.scalars.html
return obj.tolist()
except ImportError:
Expand All @@ -85,7 +85,7 @@ def encoders(obj):
except ImportError:
pass

if isinstance(obj, datetime) or isinstance(obj, time) or isinstance(obj, date):
if isinstance(obj, datetime, time, date):
return obj.isoformat()

return obj
Expand Down
81 changes: 38 additions & 43 deletions bowtie/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,13 +368,7 @@ def get(self, data):


class Number(_Controller):
"""A number input widget with increment and decrement buttons.
References
----------
https://ant.design/components/input/
"""
"""A number input widget with increment and decrement buttons."""

_TEMPLATE = 'number.jsx'
_COMPONENT = 'AntNumber'
Expand Down Expand Up @@ -405,6 +399,11 @@ def __init__(self, start=0, minimum=-1e100, maximum=1e100,
Size of the textbox.
caption : str, optional
Heading text.
References
----------
https://ant.design/components/input/
"""
super(Number, self).__init__()
self._instantiate = self._TAG.format(
Expand Down Expand Up @@ -444,13 +443,7 @@ def get(self, data):


class Textbox(_Controller):
"""A single line text box.
References
----------
https://ant.design/components/input/
"""
"""A single line text box."""

_TEMPLATE = 'textbox.jsx'
_COMPONENT = 'Textbox'
Expand All @@ -474,6 +467,10 @@ def __init__(self, placeholder='Enter text', size='default', caption=''):
caption : str, optional
Heading text.
References
----------
https://ant.design/components/input/
"""
super(Textbox, self).__init__()

Expand Down Expand Up @@ -524,13 +521,7 @@ def get(self, data):


class Slider(_Controller):
"""Ant Design slider.
References
----------
https://ant.design/components/slider/
"""
"""Ant Design slider."""

_TEMPLATE = 'slider.jsx'
_COMPONENT = 'AntSlider'
Expand Down Expand Up @@ -566,6 +557,10 @@ def __init__(self, start=None, ranged=False, minimum=0, maximum=100, step=1,
caption : str, optional
Heading text.
References
----------
https://ant.design/components/slider/
"""
super(Slider, self).__init__()

Expand Down Expand Up @@ -626,27 +621,7 @@ def get(self, data):


class Nouislider(_Controller):
"""A lightweight JavaScript range slider library.
Parameters
----------
start : number or list with two values, optional
Determines the starting value.
If a list of two values are given it will be a range slider.
minimum : number, optional
Minimum value of the slider.
maximum : number, optional
Maximum value of the slider.
tooltips : bool, optional
Show a popup text box.
caption : str, optional
Heading text.
References
----------
https://refreshless.com/nouislider/events-callbacks/
"""
"""A lightweight JavaScript range slider library."""

_TEMPLATE = 'nouislider.jsx'
_COMPONENT = 'Nouislider'
Expand All @@ -659,7 +634,27 @@ class Nouislider(_Controller):
'/>')

def __init__(self, start=0, minimum=0, maximum=100, tooltips=True, caption=''):
"""Create a slider."""
"""Create a slider.
Parameters
----------
start : number or list with two values, optional
Determines the starting value.
If a list of two values are given it will be a range slider.
minimum : number, optional
Minimum value of the slider.
maximum : number, optional
Maximum value of the slider.
tooltips : bool, optional
Show a popup text box.
caption : str, optional
Heading text.
References
----------
https://refreshless.com/nouislider/events-callbacks/
"""
super(Nouislider, self).__init__()

if not isinstance(start, Iterable):
Expand Down
10 changes: 3 additions & 7 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,6 @@
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}

def skip(app, what, name, obj, skip, options):
if name == "__init__":
return False
return skip

def setup(app):
app.connect("autodoc-skip-member", skip)
# rtd doesn't seem to support the setup function
# so we'll just combine the class and __init__ docstrings
autoclass_content = 'both'

0 comments on commit 9bcda7e

Please sign in to comment.