diff --git a/dash/dash.py b/dash/dash.py index ae8e7d6117..4c0ea9ab92 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -251,14 +251,14 @@ def _generate_config_html(self): # Serve the JS bundles for each package def serve_component_suites(self, package_name, path_in_package_dist): - if (package_name not in self.registered_paths): + if package_name not in self.registered_paths: raise Exception( 'Error loading dependency.\n' '"{}" is not a registered library.\n' 'Registered libraries are: {}' .format(package_name, list(self.registered_paths.keys()))) - elif (path_in_package_dist not in self.registered_paths[package_name]): + elif path_in_package_dist not in self.registered_paths[package_name]: raise Exception( '"{}" is registered but the path requested is not valid.\n' 'The path requested: "{}"\n' @@ -284,7 +284,7 @@ def index(self, *args, **kwargs): css = self._generate_css_dist_html() config = self._generate_config_html() title = getattr(self, 'title', 'Dash') - return (''' + return ''' @@ -304,7 +304,7 @@ def index(self, *args, **kwargs): - '''.format(title, css, config, scripts)) + '''.format(title, css, config, scripts) def dependencies(self): return flask.jsonify([ @@ -449,7 +449,7 @@ def _validate_callback(self, output, inputs, state, events): callback_id = '{}.{}'.format( output.component_id, output.component_property) - if (callback_id in self.callback_map): + if callback_id in self.callback_map: raise exceptions.CantHaveMultipleOutputs(''' You have already assigned a callback to the output with ID "{}" and property "{}". An output can only have diff --git a/dash/development/base_component.py b/dash/development/base_component.py index 72aa027548..808d404b36 100644 --- a/dash/development/base_component.py +++ b/dash/development/base_component.py @@ -111,26 +111,26 @@ def _get_set_or_delete(self, id, operation, new_item=None): # - __len__ def __getitem__(self, id): - '''Recursively find the element with the given ID through the tree + """Recursively find the element with the given ID through the tree of children. - ''' + """ # A component's children can be undefined, a string, another component, # or a list of components. return self._get_set_or_delete(id, 'get') def __setitem__(self, id, item): - '''Set an element by its ID - ''' + """Set an element by its ID + """ return self._get_set_or_delete(id, 'set', item) def __delitem__(self, id): - '''Delete items by ID in the tree of children - ''' + """Delete items by ID in the tree of children + """ return self._get_set_or_delete(id, 'delete') def traverse(self): - '''Yield each item in the tree''' + """Yield each item in the tree""" children = getattr(self, 'children', None) # children is just a component @@ -149,8 +149,8 @@ def traverse(self): yield t def __iter__(self): - '''Yield IDs in the tree of children - ''' + """Yield IDs in the tree of children + """ for t in self.traverse(): if (isinstance(t, Component) and getattr(t, 'id', None) is not None): @@ -158,8 +158,8 @@ def __iter__(self): yield t.id def __len__(self): - '''Return the number of items in the tree - ''' + """Return the number of items in the tree + """ # TODO - Should we return the number of items that have IDs # or just the number of items? # The number of items is more intuitive but returning the number diff --git a/setup.py b/setup.py index 0ea8142ebb..cdb2214b43 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ +import io from setuptools import setup, find_packages -import io + exec(open('dash/version.py').read()) setup( @@ -11,7 +12,7 @@ packages=find_packages(exclude=['tests*']), license='MIT', description=('A Python framework for building reactive web-apps. ' - 'Developed by Plotly.'), + 'Developed by Plotly.'), long_description=io.open('README.md', encoding='utf-8').read(), install_requires=[ 'Flask>=0.12', diff --git a/tests/development/test_base_component.py b/tests/development/test_base_component.py index 1fc2b6b09e..881744ff7c 100644 --- a/tests/development/test_base_component.py +++ b/tests/development/test_base_component.py @@ -20,14 +20,14 @@ def nested_tree(): - '''This tree has a few unique properties: + """This tree has a few unique properties: - children is mixed strings and components (as in c2) - children is just components (as in c) - children is just strings (as in c1) - children is just a single component (as in c3, c4) - children contains numbers (as in c2) - children contains "None" items (as in c2) - ''' + """ c1 = Component( id='0.1.x.x.0', children='string'