# HG changeset patch
# User David Douard <david.douard@logilab.fr>
# Date 1487674457 -3600
#      Tue Feb 21 11:54:17 2017 +0100
# Node ID da3ef51e1b4e4e3c12c5c1378e07b350555cb253
# Parent  a420b5c0c8b1c2a520fab4a81e2c221e567cb310
[ccplugin] flake8

diff --git a/ccplugin.py b/ccplugin.py
--- a/ccplugin.py
+++ b/ccplugin.py
@@ -2,7 +2,7 @@
 """cubicweb-ctl plugin providing the index-in-es command
 
 :organization: Logilab
-:copyright: 2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2016-2017 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 """
 from __future__ import print_function
@@ -18,8 +18,6 @@
 from cubes.elasticsearch.es import indexable_types, fulltext_indexable_rql
 
 
-__docformat__ = "restructuredtext en"
-
 HERE = osp.dirname(osp.abspath(__file__))
 
 
@@ -34,21 +32,26 @@
     name = 'index-in-es'
     min_args = max_args = 1
     arguments = '<instance id>'
-    options = [('dry-run', {'type': 'yn', 'default': False,
-                            'help': 'set to True if you want to skip the insertion in ES'}),
-               ('debug', {'type': 'yn', 'default': False,
-                          'help': 'set to True if you want to print'
-                                  'out debug info and progress'}),
-               ('etypes', {'type': 'csv', 'default': '',
-                           'help': 'only index given etypes '
-                                   '[default:all indexable types]'}),
-               ('index-name', {'type': 'string', 'default': '',
-                               'help': 'override index-name if you want to use a different ID'
-                                       '[default: uses index-name from all-in-one.conf]'}),
-               ('except-etypes', {'type': 'string', 'default': '',
-                                  'help': 'all indexable types except given etypes'
-                                          '[default: []]'}),
-               ]
+    options = [
+        ('dry-run',
+         {'type': 'yn', 'default': False,
+          'help': 'set to True if you want to skip the insertion in ES'}),
+        ('debug',
+         {'type': 'yn', 'default': False,
+          'help': ('set to True if you want to print '
+                   'out debug info and progress')}),
+        ('etypes',
+         {'type': 'csv', 'default': '',
+          'help': 'only index given etypes [default:all indexable types]'}),
+        ('index-name',
+         {'type': 'string', 'default': '',
+          'help': ('override index-name if you want to use a different ID'
+                   '[default: uses index-name from all-in-one.conf]')}),
+        ('except-etypes',
+         {'type': 'string', 'default': '',
+          'help': 'all indexable types except given etypes'
+          '[default: []]'}),
+    ]
 
     def run(self, args):
         """run the command with its specific arguments"""
@@ -64,20 +67,19 @@
                 if self.config.etypes:
                     etypes = self.config.etypes
                 else:
-                    etypes = indexable_types(schema,
-                                             custom_skip_list=self.config.except_etypes)
+                    etypes = indexable_types(
+                        schema, custom_skip_list=self.config.except_etypes)
                     assert self.config.except_etypes not in etypes
                 if self.config.debug and not self.config.etypes:
                     print(u'found indexable_types {}'.format(
                         ','.join(etypes)))
-                for _ in parallel_bulk(es,
-                                       self.bulk_actions(etypes,
-                                                         cnx,
-                                                         index_name=self.config.index_name,
-                                                         dry_run=self.config.dry_run),
-                                       raise_on_error=False,
-                                       raise_on_exception=False):
-                            pass
+                for _ in parallel_bulk(
+                        es, self.bulk_actions(etypes, cnx,
+                                              index_name=self.config.index_name,
+                                              dry_run=self.config.dry_run),
+                        raise_on_error=False,
+                        raise_on_exception=False):
+                    pass
             else:
                 if self.config.debug:
                     print(u'no elasticsearch configuration found, skipping')