Jose Diaz-Gonzalez

Make kappa pep8 compliant

...@@ -12,19 +12,23 @@ ...@@ -12,19 +12,23 @@
12 # All configuration values have a default; values that are commented out 12 # All configuration values have a default; values that are commented out
13 # serve to show the default. 13 # serve to show the default.
14 14
15 -import sys
16 import os 15 import os
17 import shlex 16 import shlex
17 +import sys
18 +
19 +assert os
20 +assert shlex
21 +assert sys
18 22
19 # If extensions (or modules to document with autodoc) are in another directory, 23 # If extensions (or modules to document with autodoc) are in another directory,
20 # add these directories to sys.path here. If the directory is relative to the 24 # add these directories to sys.path here. If the directory is relative to the
21 # documentation root, use os.path.abspath to make it absolute, like shown here. 25 # documentation root, use os.path.abspath to make it absolute, like shown here.
22 -#sys.path.insert(0, os.path.abspath('.')) 26 +# sys.path.insert(0, os.path.abspath('.'))
23 27
24 # -- General configuration ------------------------------------------------ 28 # -- General configuration ------------------------------------------------
25 29
26 # If your documentation needs a minimal Sphinx version, state it here. 30 # If your documentation needs a minimal Sphinx version, state it here.
27 -#needs_sphinx = '1.0' 31 +# needs_sphinx = '1.0'
28 32
29 # Add any Sphinx extension module names here, as strings. They can be 33 # Add any Sphinx extension module names here, as strings. They can be
30 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 34 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
...@@ -42,7 +46,7 @@ templates_path = ['_templates'] ...@@ -42,7 +46,7 @@ templates_path = ['_templates']
42 source_suffix = '.rst' 46 source_suffix = '.rst'
43 47
44 # The encoding of source files. 48 # The encoding of source files.
45 -#source_encoding = 'utf-8-sig' 49 +# source_encoding = 'utf-8-sig'
46 50
47 # The master toctree document. 51 # The master toctree document.
48 master_doc = 'index' 52 master_doc = 'index'
...@@ -70,9 +74,9 @@ language = None ...@@ -70,9 +74,9 @@ language = None
70 74
71 # There are two options for replacing |today|: either, you set today to some 75 # There are two options for replacing |today|: either, you set today to some
72 # non-false value, then it is used: 76 # non-false value, then it is used:
73 -#today = '' 77 +# today = ''
74 # Else, today_fmt is used as the format for a strftime call. 78 # Else, today_fmt is used as the format for a strftime call.
75 -#today_fmt = '%B %d, %Y' 79 +# today_fmt = '%B %d, %Y'
76 80
77 # List of patterns, relative to source directory, that match files and 81 # List of patterns, relative to source directory, that match files and
78 # directories to ignore when looking for source files. 82 # directories to ignore when looking for source files.
...@@ -80,27 +84,27 @@ exclude_patterns = ['_build'] ...@@ -80,27 +84,27 @@ exclude_patterns = ['_build']
80 84
81 # The reST default role (used for this markup: `text`) to use for all 85 # The reST default role (used for this markup: `text`) to use for all
82 # documents. 86 # documents.
83 -#default_role = None 87 +# default_role = None
84 88
85 # If true, '()' will be appended to :func: etc. cross-reference text. 89 # If true, '()' will be appended to :func: etc. cross-reference text.
86 -#add_function_parentheses = True 90 +# add_function_parentheses = True
87 91
88 # If true, the current module name will be prepended to all description 92 # If true, the current module name will be prepended to all description
89 # unit titles (such as .. function::). 93 # unit titles (such as .. function::).
90 -#add_module_names = True 94 +# add_module_names = True
91 95
92 # If true, sectionauthor and moduleauthor directives will be shown in the 96 # If true, sectionauthor and moduleauthor directives will be shown in the
93 # output. They are ignored by default. 97 # output. They are ignored by default.
94 -#show_authors = False 98 +# show_authors = False
95 99
96 # The name of the Pygments (syntax highlighting) style to use. 100 # The name of the Pygments (syntax highlighting) style to use.
97 pygments_style = 'sphinx' 101 pygments_style = 'sphinx'
98 102
99 # A list of ignored prefixes for module index sorting. 103 # A list of ignored prefixes for module index sorting.
100 -#modindex_common_prefix = [] 104 +# modindex_common_prefix = []
101 105
102 # If true, keep warnings as "system message" paragraphs in the built documents. 106 # If true, keep warnings as "system message" paragraphs in the built documents.
103 -#keep_warnings = False 107 +# keep_warnings = False
104 108
105 # If true, `todo` and `todoList` produce output, else they produce nothing. 109 # If true, `todo` and `todoList` produce output, else they produce nothing.
106 todo_include_todos = False 110 todo_include_todos = False
...@@ -115,26 +119,26 @@ html_theme = 'alabaster' ...@@ -115,26 +119,26 @@ html_theme = 'alabaster'
115 # Theme options are theme-specific and customize the look and feel of a theme 119 # Theme options are theme-specific and customize the look and feel of a theme
116 # further. For a list of options available for each theme, see the 120 # further. For a list of options available for each theme, see the
117 # documentation. 121 # documentation.
118 -#html_theme_options = {} 122 +# html_theme_options = {}
119 123
120 # Add any paths that contain custom themes here, relative to this directory. 124 # Add any paths that contain custom themes here, relative to this directory.
121 -#html_theme_path = [] 125 +# html_theme_path = []
122 126
123 # The name for this set of Sphinx documents. If None, it defaults to 127 # The name for this set of Sphinx documents. If None, it defaults to
124 # "<project> v<release> documentation". 128 # "<project> v<release> documentation".
125 -#html_title = None 129 +# html_title = None
126 130
127 # A shorter title for the navigation bar. Default is the same as html_title. 131 # A shorter title for the navigation bar. Default is the same as html_title.
128 -#html_short_title = None 132 +# html_short_title = None
129 133
130 # The name of an image file (relative to this directory) to place at the top 134 # The name of an image file (relative to this directory) to place at the top
131 # of the sidebar. 135 # of the sidebar.
132 -#html_logo = None 136 +# html_logo = None
133 137
134 # The name of an image file (within the static path) to use as favicon of the 138 # The name of an image file (within the static path) to use as favicon of the
135 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 139 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
136 # pixels large. 140 # pixels large.
137 -#html_favicon = None 141 +# html_favicon = None
138 142
139 # Add any paths that contain custom static files (such as style sheets) here, 143 # Add any paths that contain custom static files (such as style sheets) here,
140 # relative to this directory. They are copied after the builtin static files, 144 # relative to this directory. They are copied after the builtin static files,
...@@ -144,62 +148,62 @@ html_static_path = ['_static'] ...@@ -144,62 +148,62 @@ html_static_path = ['_static']
144 # Add any extra paths that contain custom files (such as robots.txt or 148 # Add any extra paths that contain custom files (such as robots.txt or
145 # .htaccess) here, relative to this directory. These files are copied 149 # .htaccess) here, relative to this directory. These files are copied
146 # directly to the root of the documentation. 150 # directly to the root of the documentation.
147 -#html_extra_path = [] 151 +# html_extra_path = []
148 152
149 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 153 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
150 # using the given strftime format. 154 # using the given strftime format.
151 -#html_last_updated_fmt = '%b %d, %Y' 155 +# html_last_updated_fmt = '%b %d, %Y'
152 156
153 # If true, SmartyPants will be used to convert quotes and dashes to 157 # If true, SmartyPants will be used to convert quotes and dashes to
154 # typographically correct entities. 158 # typographically correct entities.
155 -#html_use_smartypants = True 159 +# html_use_smartypants = True
156 160
157 # Custom sidebar templates, maps document names to template names. 161 # Custom sidebar templates, maps document names to template names.
158 -#html_sidebars = {} 162 +# html_sidebars = {}
159 163
160 # Additional templates that should be rendered to pages, maps page names to 164 # Additional templates that should be rendered to pages, maps page names to
161 # template names. 165 # template names.
162 -#html_additional_pages = {} 166 +# html_additional_pages = {}
163 167
164 # If false, no module index is generated. 168 # If false, no module index is generated.
165 -#html_domain_indices = True 169 +# html_domain_indices = True
166 170
167 # If false, no index is generated. 171 # If false, no index is generated.
168 -#html_use_index = True 172 +# html_use_index = True
169 173
170 # If true, the index is split into individual pages for each letter. 174 # If true, the index is split into individual pages for each letter.
171 -#html_split_index = False 175 +# html_split_index = False
172 176
173 # If true, links to the reST sources are added to the pages. 177 # If true, links to the reST sources are added to the pages.
174 -#html_show_sourcelink = True 178 +# html_show_sourcelink = True
175 179
176 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 180 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
177 -#html_show_sphinx = True 181 +# html_show_sphinx = True
178 182
179 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 183 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
180 -#html_show_copyright = True 184 +# html_show_copyright = True
181 185
182 # If true, an OpenSearch description file will be output, and all pages will 186 # If true, an OpenSearch description file will be output, and all pages will
183 # contain a <link> tag referring to it. The value of this option must be the 187 # contain a <link> tag referring to it. The value of this option must be the
184 # base URL from which the finished HTML is served. 188 # base URL from which the finished HTML is served.
185 -#html_use_opensearch = '' 189 +# html_use_opensearch = ''
186 190
187 # This is the file name suffix for HTML files (e.g. ".xhtml"). 191 # This is the file name suffix for HTML files (e.g. ".xhtml").
188 -#html_file_suffix = None 192 +# html_file_suffix = None
189 193
190 # Language to be used for generating the HTML full-text search index. 194 # Language to be used for generating the HTML full-text search index.
191 # Sphinx supports the following languages: 195 # Sphinx supports the following languages:
192 # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' 196 # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
193 # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' 197 # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
194 -#html_search_language = 'en' 198 +# html_search_language = 'en'
195 199
196 # A dictionary with options for the search language support, empty by default. 200 # A dictionary with options for the search language support, empty by default.
197 # Now only 'ja' uses this config value 201 # Now only 'ja' uses this config value
198 -#html_search_options = {'type': 'default'} 202 +# html_search_options = {'type': 'default'}
199 203
200 # The name of a javascript file (relative to the configuration directory) that 204 # The name of a javascript file (relative to the configuration directory) that
201 # implements a search results scorer. If empty, the default will be used. 205 # implements a search results scorer. If empty, the default will be used.
202 -#html_search_scorer = 'scorer.js' 206 +# html_search_scorer = 'scorer.js'
203 207
204 # Output file base name for HTML help builder. 208 # Output file base name for HTML help builder.
205 htmlhelp_basename = 'kappadoc' 209 htmlhelp_basename = 'kappadoc'
...@@ -207,46 +211,46 @@ htmlhelp_basename = 'kappadoc' ...@@ -207,46 +211,46 @@ htmlhelp_basename = 'kappadoc'
207 # -- Options for LaTeX output --------------------------------------------- 211 # -- Options for LaTeX output ---------------------------------------------
208 212
209 latex_elements = { 213 latex_elements = {
210 -# The paper size ('letterpaper' or 'a4paper'). 214 + # The paper size ('letterpaper' or 'a4paper').
211 -#'papersize': 'letterpaper', 215 + # 'papersize': 'letterpaper',
212 216
213 -# The font size ('10pt', '11pt' or '12pt'). 217 + # The font size ('10pt', '11pt' or '12pt').
214 -#'pointsize': '10pt', 218 + # 'pointsize': '10pt',
215 219
216 -# Additional stuff for the LaTeX preamble. 220 + # Additional stuff for the LaTeX preamble.
217 -#'preamble': '', 221 + # 'preamble': '',
218 222
219 -# Latex figure (float) alignment 223 + # Latex figure (float) alignment
220 -#'figure_align': 'htbp', 224 + # 'figure_align': 'htbp',
221 } 225 }
222 226
223 # Grouping the document tree into LaTeX files. List of tuples 227 # Grouping the document tree into LaTeX files. List of tuples
224 # (source start file, target name, title, 228 # (source start file, target name, title,
225 # author, documentclass [howto, manual, or own class]). 229 # author, documentclass [howto, manual, or own class]).
226 latex_documents = [ 230 latex_documents = [
227 - (master_doc, 'kappa.tex', u'kappa Documentation', 231 + (master_doc, 'kappa.tex', u'kappa Documentation',
228 - u'Mitch Garnaat', 'manual'), 232 + u'Mitch Garnaat', 'manual'),
229 ] 233 ]
230 234
231 # The name of an image file (relative to this directory) to place at the top of 235 # The name of an image file (relative to this directory) to place at the top of
232 # the title page. 236 # the title page.
233 -#latex_logo = None 237 +# latex_logo = None
234 238
235 # For "manual" documents, if this is true, then toplevel headings are parts, 239 # For "manual" documents, if this is true, then toplevel headings are parts,
236 # not chapters. 240 # not chapters.
237 -#latex_use_parts = False 241 +# latex_use_parts = False
238 242
239 # If true, show page references after internal links. 243 # If true, show page references after internal links.
240 -#latex_show_pagerefs = False 244 +# latex_show_pagerefs = False
241 245
242 # If true, show URL addresses after external links. 246 # If true, show URL addresses after external links.
243 -#latex_show_urls = False 247 +# latex_show_urls = False
244 248
245 # Documents to append as an appendix to all manuals. 249 # Documents to append as an appendix to all manuals.
246 -#latex_appendices = [] 250 +# latex_appendices = []
247 251
248 # If false, no module index is generated. 252 # If false, no module index is generated.
249 -#latex_domain_indices = True 253 +# latex_domain_indices = True
250 254
251 255
252 # -- Options for manual page output --------------------------------------- 256 # -- Options for manual page output ---------------------------------------
...@@ -259,7 +263,7 @@ man_pages = [ ...@@ -259,7 +263,7 @@ man_pages = [
259 ] 263 ]
260 264
261 # If true, show URL addresses after external links. 265 # If true, show URL addresses after external links.
262 -#man_show_urls = False 266 +# man_show_urls = False
263 267
264 268
265 # -- Options for Texinfo output ------------------------------------------- 269 # -- Options for Texinfo output -------------------------------------------
...@@ -268,19 +272,19 @@ man_pages = [ ...@@ -268,19 +272,19 @@ man_pages = [
268 # (source start file, target name, title, author, 272 # (source start file, target name, title, author,
269 # dir menu entry, description, category) 273 # dir menu entry, description, category)
270 texinfo_documents = [ 274 texinfo_documents = [
271 - (master_doc, 'kappa', u'kappa Documentation', 275 + (master_doc, 'kappa', u'kappa Documentation',
272 - author, 'kappa', 'One line description of project.', 276 + author, 'kappa', 'One line description of project.',
273 - 'Miscellaneous'), 277 + 'Miscellaneous'),
274 ] 278 ]
275 279
276 # Documents to append as an appendix to all manuals. 280 # Documents to append as an appendix to all manuals.
277 -#texinfo_appendices = [] 281 +# texinfo_appendices = []
278 282
279 # If false, no module index is generated. 283 # If false, no module index is generated.
280 -#texinfo_domain_indices = True 284 +# texinfo_domain_indices = True
281 285
282 # How to display URL addresses: 'footnote', 'no', or 'inline'. 286 # How to display URL addresses: 'footnote', 'no', or 'inline'.
283 -#texinfo_show_urls = 'footnote' 287 +# texinfo_show_urls = 'footnote'
284 288
285 # If true, do not generate a @detailmenu in the "Top" node's menu. 289 # If true, do not generate a @detailmenu in the "Top" node's menu.
286 -#texinfo_no_detailmenu = False 290 +# texinfo_no_detailmenu = False
......
...@@ -190,10 +190,12 @@ class Context(object): ...@@ -190,10 +190,12 @@ class Context(object):
190 def list_event_sources(self): 190 def list_event_sources(self):
191 event_sources = [] 191 event_sources = []
192 for event_source in self.event_sources: 192 for event_source in self.event_sources:
193 - event_sources.append({'arn': event_source.arn, 193 + event_sources.append({
194 - 'starting_position': event_source.starting_position, 194 + 'arn': event_source.arn,
195 - 'batch_size': event_source.batch_size, 195 + 'starting_position': event_source.starting_position,
196 - 'enabled': event_source.enabled}) 196 + 'batch_size': event_source.batch_size,
197 + 'enabled': event_source.enabled
198 + })
197 return event_sources 199 return event_sources
198 200
199 def enable_event_sources(self): 201 def enable_event_sources(self):
......
...@@ -224,10 +224,12 @@ class Function(object): ...@@ -224,10 +224,12 @@ class Function(object):
224 excluded_dirs.append(subdir) 224 excluded_dirs.append(subdir)
225 for excluded in excluded_dirs: 225 for excluded in excluded_dirs:
226 subdirs.remove(excluded) 226 subdirs.remove(excluded)
227 - 227 +
228 try: 228 try:
229 dir_path = os.path.relpath(root, relroot) 229 dir_path = os.path.relpath(root, relroot)
230 - dir_path = os.path.normpath(os.path.splitdrive(dir_path)[1]) 230 + dir_path = os.path.normpath(
231 + os.path.splitdrive(dir_path)[1]
232 + )
231 while dir_path[0] in (os.sep, os.altsep): 233 while dir_path[0] in (os.sep, os.altsep):
232 dir_path = dir_path[1:] 234 dir_path = dir_path[1:]
233 dir_path += '/' 235 dir_path += '/'
...@@ -251,7 +253,7 @@ class Function(object): ...@@ -251,7 +253,7 @@ class Function(object):
251 LOG.debug('zipfile_name=%s', zipfile_name) 253 LOG.debug('zipfile_name=%s', zipfile_name)
252 with zipfile.ZipFile(zipfile_name, 'a', 254 with zipfile.ZipFile(zipfile_name, 'a',
253 compression=zipfile.ZIP_DEFLATED) as zf: 255 compression=zipfile.ZIP_DEFLATED) as zf:
254 - try: 256 + try:
255 zf.getinfo(lambda_file) 257 zf.getinfo(lambda_file)
256 except KeyError: 258 except KeyError:
257 zf.write(lambda_file) 259 zf.write(lambda_file)
......
...@@ -53,17 +53,17 @@ class Log(object): ...@@ -53,17 +53,17 @@ class Log(object):
53 LOG.info( 53 LOG.info(
54 'log group %s has not been created yet', self.log_group_name) 54 'log group %s has not been created yet', self.log_group_name)
55 return [] 55 return []
56 - latest_stream = None 56 + latest = None
57 streams = self.streams() 57 streams = self.streams()
58 for stream in streams: 58 for stream in streams:
59 - if not latest_stream: 59 + if not latest:
60 - latest_stream = stream 60 + latest = stream
61 - elif stream['lastEventTimestamp'] > latest_stream['lastEventTimestamp']: 61 + elif stream['lastEventTimestamp'] > latest['lastEventTimestamp']:
62 - latest_stream = stream 62 + latest = stream
63 response = self._log_client.call( 63 response = self._log_client.call(
64 'get_log_events', 64 'get_log_events',
65 logGroupName=self.log_group_name, 65 logGroupName=self.log_group_name,
66 - logStreamName=latest_stream['logStreamName']) 66 + logStreamName=latest['logStreamName'])
67 LOG.debug(response) 67 LOG.debug(response)
68 return response['events'] 68 return response['events']
69 69
......
...@@ -88,7 +88,7 @@ def tail(ctx): ...@@ -88,7 +88,7 @@ def tail(ctx):
88 """Show the last 10 lines of the log file""" 88 """Show the last 10 lines of the log file"""
89 click.echo('tailing logs') 89 click.echo('tailing logs')
90 for e in ctx.tail()[-10:]: 90 for e in ctx.tail()[-10:]:
91 - ts = datetime.utcfromtimestamp(e['timestamp']//1000).isoformat() 91 + ts = datetime.utcfromtimestamp(e['timestamp'] // 1000).isoformat()
92 click.echo("{}: {}".format(ts, e['message'])) 92 click.echo("{}: {}".format(ts, e['message']))
93 click.echo('done') 93 click.echo('done')
94 94
......