Skip to content

Commit

Permalink
flake8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chriddyp committed Jan 3, 2018
1 parent 1d4b5aa commit 5e5a5fb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
4 changes: 2 additions & 2 deletions dash/dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def _validate_callback(self, output, inputs, state, events):
arg.component_id,
arg.component_property,
arg.component_id,
component.available_properties)\
component.available_properties)
.replace(' ', ''))

if (hasattr(arg, 'component_event') and
Expand All @@ -422,7 +422,7 @@ def _validate_callback(self, output, inputs, state, events):
arg.component_id,
arg.component_event,
arg.component_id,
component.available_events)\
component.available_events)
.replace(' ', ''))

if state and not events and not inputs:
Expand Down
3 changes: 3 additions & 0 deletions dash/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ def __init__(self, component_id, component_property):
self.component_id = component_id
self.component_property = component_property


# pylint: disable=old-style-class, too-few-public-methods
class Input:
def __init__(self, component_id, component_property):
self.component_id = component_id
self.component_property = component_property


# pylint: disable=old-style-class, too-few-public-methods
class State:
def __init__(self, component_id, component_property):
self.component_id = component_id
self.component_property = component_property


# pylint: disable=old-style-class, too-few-public-methods
class Event:
def __init__(self, component_id, component_event):
Expand Down
37 changes: 21 additions & 16 deletions dash/development/base_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ def __init__(self, **kwargs):
for k, v in list(kwargs.items()):
if k not in self._prop_names: # pylint: disable=no-member
# TODO - What's the right exception here?
# pylint: disable=no-member
raise Exception(
'Unexpected keyword argument `{}`'.format(k) +
'\nAllowed arguments: {}'.format(
', '.join(sorted(self._prop_names)) # pylint: disable=no-member
', '.join(sorted(self._prop_names))
)
)
setattr(self, k, v)
Expand All @@ -43,12 +44,13 @@ def to_plotly_json(self):

return as_json


# pylint: disable=too-many-branches, too-many-return-statements, redefined-builtin, inconsistent-return-statements
# pylint: disable=too-many-branches, too-many-return-statements
# pylint: disable=redefined-builtin, inconsistent-return-statements
def _get_set_or_delete(self, id, operation, new_item=None):
_check_if_has_indexable_children(self)

# pylint: disable=access-member-before-definition, attribute-defined-outside-init
# pylint: disable=access-member-before-definition,
# pylint: disable=attribute-defined-outside-init
if isinstance(self.children, Component):
if getattr(self.children, 'id', None) is not None:
# Woohoo! It's the item that we're looking for
Expand Down Expand Up @@ -182,7 +184,8 @@ def __len__(self):
return length


def generate_class(typename, props, description, namespace): # pylint: disable=unused-argument
# pylint: disable=unused-argument
def generate_class(typename, props, description, namespace):
# Dynamically generate classes to have nicely formatted docstrings,
# keyword arguments, and repr
# Insired by http://jameso.be/2013/08/06/namedtuple.html
Expand Down Expand Up @@ -234,28 +237,29 @@ def __repr__(self):
repr(getattr(self, self._prop_names[0], None)) + ')')
'''

filtered_props = reorder_props(filter_props(props)) # pylint: disable=unused-variable
list_of_valid_keys = repr(list(filtered_props.keys())) # pylint: disable=unused-variable
docstring = create_docstring( # pylint: disable=unused-variable
# pylint: disable=unused-variable
filtered_props = reorder_props(filter_props(props))
list_of_valid_keys = repr(list(filtered_props.keys()))
docstring = create_docstring(
typename,
filtered_props,
parse_events(props),
description
)
events = '[' + ', '.join(parse_events(props)) + ']' # pylint: disable=unused-variable
events = '[' + ', '.join(parse_events(props)) + ']'
if 'children' in props:
default_argtext = 'children=None, **kwargs' # pylint: disable=unused-variable
argtext = 'children=children, **kwargs' # pylint: disable=unused-variable
default_argtext = 'children=None, **kwargs'
argtext = 'children=children, **kwargs'
else:
default_argtext = '**kwargs' # pylint: disable=unused-variable
argtext = '**kwargs' # pylint: disable=unused-variable
default_argtext = '**kwargs'
argtext = '**kwargs'

required_args = required_props(props) # pylint: disable=unused-variable
required_args = required_props(props)

d = c.format(**locals())

scope = {'Component': Component}
exec(d, scope) # pylint: disable=exec-used
exec(d, scope)
result = scope[typename]
return result

Expand Down Expand Up @@ -355,7 +359,8 @@ def js_to_py_type(type_object):
])),

# React's PropTypes.arrayOf
'arrayOf': lambda: 'list'.format( # pylint: disable=too-many-format-args
# pylint: disable=too-many-format-args
'arrayOf': lambda: 'list'.format(
'of {}s'.format(js_to_py_type(type_object['value']))
if js_to_py_type(type_object['value']) != ''
else ''
Expand Down

0 comments on commit 5e5a5fb

Please sign in to comment.