Merge lp:~ev/uci-engine/fix-pep8-and-pyflakes into lp:uci-engine

Proposed by Evan
Status: Needs review
Proposed branch: lp:~ev/uci-engine/fix-pep8-and-pyflakes
Merge into: lp:uci-engine
Diff against target: 511 lines (+39/-222)
15 files modified
bin/engine_health.py (+1/-1)
branch-source-builder/bin/check_bsbuilder.py (+1/-1)
branch-source-builder/cupstream2distro/packageinppa.py (+0/-2)
charms/precise/key-secret-subordinate/unit_tests/test_hooks.py (+1/-1)
charms/precise/system-image-server/hooks/hooks.py (+6/-14)
charms/precise/webui/unit_tests/test_hooks.py (+0/-1)
cupstream2distro/tests/unit/test_resignpackage.py (+1/-1)
docs/conf.py (+20/-191)
image-builder/imagebuilder/run_worker.py (+1/-1)
lander/setup.py (+0/-1)
nf-stats-service/nfss/__init__.py (+2/-0)
ticket_system/project/tests.py (+1/-1)
ticket_system/ticket/tests/test_style.py (+1/-1)
ticket_system/ticket/tests/test_user_info.py (+2/-2)
ticket_system/ticket_system/settings.py (+2/-4)
To merge this branch: bzr merge lp:~ev/uci-engine/fix-pep8-and-pyflakes
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Canonical CI Engineering Pending
Review via email: mp+242806@code.launchpad.net

Commit message

PEP8 and pyflakes fixes.

Description of the change

I fixed some pyflakes and pep8 errors on the flight out to Austin.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:901
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/1747/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/1747/rebuild

review: Approve (continuous-integration)
Revision history for this message
Robert Bruce Park (robru) wrote :

Considering that everything under cupstream2distro/ directory is an abandoned fork of lp:cupstream2distro, I hope you didn't waste too much time on that. It's probably worthwhile to delete that code or at least re-import it from our trunk, because your copy is just rotting away.

Revision history for this message
Evan (ev) wrote :

On 25 November 2014 at 20:16, ♫ Robert Bruce Park ♫
<email address hidden> wrote:
> Considering that everything under cupstream2distro/ directory is an abandoned fork of lp:cupstream2distro, I hope you didn't waste too much time on that. It's probably worthwhile to delete that code or at least re-import it from our trunk, because your copy is just rotting away.

I'm not deeply familiar with our cupstream2distro work. That's more a
question for Ursula or Francis. Guys?

Unmerged revisions

901. By Evan

Revert pyflakes-the-world change.

900. By Evan

Merge with trunk.

899. By Evan

Create a couple of exceptions to the pyflakes tests.

898. By Evan

Use the exclusion filter for pyflakes tests.

897. By Evan

Add a pyflakes check.

896. By Evan

Add a rationale for the new style test.

895. By Evan

Fix pep8 in time_sorted_tests tests.

894. By Evan

Make pep8 an opt-out, rather than opt-in test for python files. Test non-packaged python code.

893. By Evan

pyflakes fixes.

892. By Evan

pep8 fixes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/engine_health.py'
2--- bin/engine_health.py 2014-07-25 23:53:47 +0000
3+++ bin/engine_health.py 2014-11-25 16:38:40 +0000
4@@ -59,7 +59,7 @@
5 # Health check always expects 'OK' or 'FAILED' in the first line of the
6 # result file.
7 result_file_contents = open(result_file).readlines()
8- if not 'OK' in result_file_contents[0]:
9+ if 'OK' not in result_file_contents[0]:
10 # Printing only the first line of the result file because nagios
11 # displays limited output on its interface (one line). Concatenating
12 # the whole file on a single message would produce a very confusing
13
14=== modified file 'branch-source-builder/bin/check_bsbuilder.py'
15--- branch-source-builder/bin/check_bsbuilder.py 2014-10-29 15:06:26 +0000
16+++ branch-source-builder/bin/check_bsbuilder.py 2014-11-25 16:38:40 +0000
17@@ -158,7 +158,7 @@
18 # run `worker.handle_request` in an isolated GPG environment
19 # so it has a chance to auto-retrieve missing keys from the
20 # keyserver.
21- with gpg.GnupgEnvironment() as gnupg:
22+ with gpg.GnupgEnvironment():
23 (cb, result) = worker.handle_request(params, log)
24 except Exception as exc:
25 message = 'BSB raised: {}'.format(exc.message)
26
27=== modified file 'branch-source-builder/cupstream2distro/packageinppa.py'
28--- branch-source-builder/cupstream2distro/packageinppa.py 2014-04-16 18:36:03 +0000
29+++ branch-source-builder/cupstream2distro/packageinppa.py 2014-11-25 16:38:40 +0000
30@@ -179,9 +179,7 @@
31
32 # Try to see if all binaries availables for this arch are built, including arch:all on other archs
33 status = self.current_status
34- at_least_one_published_binary = False
35 for binary in self.source.getPublishedBinaries():
36- at_least_one_published_binary = True
37 # all binaries for an arch are published at the same time
38 # launchpad is lying, it's telling that archs not in the ppa are built (for arch:all). Even for non supported arch!
39 # for instance, we can have the case of self.arch_all_arch (arch:all), built before the others and amd64 will be built for it
40
41=== modified file 'charms/precise/key-secret-subordinate/unit_tests/test_hooks.py'
42--- charms/precise/key-secret-subordinate/unit_tests/test_hooks.py 2014-07-22 12:38:30 +0000
43+++ charms/precise/key-secret-subordinate/unit_tests/test_hooks.py 2014-11-25 16:38:40 +0000
44@@ -113,7 +113,7 @@
45 def test_juju_info_joined(self):
46 # Keys are placed immediatelly when the subordinate charm is bound.
47 os.makedirs(self.service_dir)
48- self.config.return_value['ssh-private-key'] = base64.b64encode(
49+ self.config.return_value['ssh-private-key'] = base64.b64encode(
50 'secret!')
51
52 hooks.hooks.execute(['hooks/juju-info-relation-joined'])
53
54=== modified file 'charms/precise/system-image-server/hooks/hooks.py'
55--- charms/precise/system-image-server/hooks/hooks.py 2014-10-14 09:04:09 +0000
56+++ charms/precise/system-image-server/hooks/hooks.py 2014-11-25 16:38:40 +0000
57@@ -16,11 +16,6 @@
58 return os.path.join(charmconfig['install_root'], unit)
59
60
61-def _install_from_tarball(charmconfig, upgrade):
62- #Do we need this?
63- pass
64-
65-
66 def _install_from_bzr(charmconfig, upgrade):
67 log('grabbing service from bzr...', 'INFO')
68 sdir = _service_dir(charmconfig)
69@@ -77,16 +72,17 @@
70
71 def _generate_keys(charmconfig):
72 log('generating keys...', 'INFO')
73- #haveged is just an entropy generator
74+ # haveged is just an entropy generator
75 subprocess.check_output(['haveged'])
76 srvdir = _service_dir(charmconfig)
77- #the system-image tools unfortunately really want to run from this dir
78+ # the system-image tools unfortunately really want to run from this dir
79 os.chdir(srvdir)
80 out = subprocess.check_output(['{}/tests/generate-keys'.format(srvdir)])
81 log(out, 'INFO')
82- #copy the keys we just generated into the proper location
83+ # copy the keys we just generated into the proper location
84 shutil.rmtree('{}/secret/gpg/keys/'.format(srvdir))
85- shutil.copytree('{}/tests/keys'.format(srvdir), '{}/secret/gpg/keys/'.format(srvdir))
86+ dest = '{}/secret/gpg/keys/'.format(srvdir)
87+ shutil.copytree('{}/tests/keys'.format(srvdir), dest)
88 subprocess.check_output(['{}/bin/generate-keyrings'.format(srvdir)])
89 log(out, 'INFO')
90
91@@ -99,11 +95,7 @@
92 charmhelpers.fetch.configure_sources(update=True)
93 charmhelpers.fetch.apt_install(pkgs)
94
95- if charmconfig.get('vcs') == 'tarball':
96- _install_from_tarball(charmconfig, upgrade)
97- else:
98- _install_from_bzr(charmconfig, upgrade)
99-
100+ _install_from_bzr(charmconfig, upgrade)
101 _write_system_image_config(charmconfig)
102 _generate_keys(charmconfig)
103 _create_stable_channel(charmconfig)
104
105=== modified file 'charms/precise/webui/unit_tests/test_hooks.py'
106--- charms/precise/webui/unit_tests/test_hooks.py 2014-10-08 15:37:26 +0000
107+++ charms/precise/webui/unit_tests/test_hooks.py 2014-11-25 16:38:40 +0000
108@@ -119,4 +119,3 @@
109
110 with hooks.status_urls() as data:
111 self.assertEqual({}, data)
112-
113
114=== modified file 'cupstream2distro/tests/unit/test_resignpackage.py'
115--- cupstream2distro/tests/unit/test_resignpackage.py 2014-06-17 12:25:23 +0000
116+++ cupstream2distro/tests/unit/test_resignpackage.py 2014-11-25 16:38:40 +0000
117@@ -14,7 +14,7 @@
118 # You should have received a copy of the GNU Affero General Public License
119 # along with this program. If not, see <http://www.gnu.org/licenses/>.
120
121-from . import BaseUnitTestCase, BaseUnitTestCaseWithErrors
122+from . import BaseUnitTestCase
123
124 import subprocess
125 import os
126
127=== modified file 'docs/conf.py'
128--- docs/conf.py 2014-10-07 10:04:01 +0000
129+++ docs/conf.py 2014-11-25 16:38:40 +0000
130@@ -3,28 +3,17 @@
131 # Ubuntu CI Engine documentation build configuration file, created by
132 # sphinx-quickstart on Thu Nov 14 11:38:40 2013.
133 #
134-# This file is execfile()d with the current directory set to its containing dir.
135+# This file is execfile()d with the current directory set to its containing
136+# dir.
137 #
138 # Note that not all possible configuration values are present in this
139 # autogenerated file.
140 #
141-# All configuration values have a default; values that are commented out
142-# serve to show the default.
143-
144-import sys, os
145-
146-# If extensions (or modules to document with autodoc) are in another directory,
147-# add these directories to sys.path here. If the directory is relative to the
148-# documentation root, use os.path.abspath to make it absolute, like shown here.
149-#sys.path.insert(0, os.path.abspath('.'))
150-
151-# -- General configuration -----------------------------------------------------
152-
153-# If your documentation needs a minimal Sphinx version, state it here.
154-#needs_sphinx = '1.0'
155-
156-# Add any Sphinx extension module names here, as strings. They can be extensions
157-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
158+# All configuration values have a default; values that are commented out serve
159+# to show the default.
160+
161+# Add any Sphinx extension module names here, as strings. They can be
162+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
163 extensions = [
164 'sphinx.ext.autodoc',
165 ]
166@@ -35,9 +24,6 @@
167 # The suffix of source filenames.
168 source_suffix = '.rst'
169
170-# The encoding of source files.
171-#source_encoding = 'utf-8-sig'
172-
173 # The master toctree document.
174 master_doc = 'index'
175
176@@ -45,54 +31,15 @@
177 project = u'Ubuntu CI Engine'
178 copyright = u'2013-2014, Canonical Ltd.'
179
180-# The version info for the project you're documenting, acts as replacement for
181-# |version| and |release|, also used in various other places throughout the
182-# built documents.
183-#
184-# The short X.Y version.
185-#version = '0.0'
186-# The full version, including alpha/beta/rc tags.
187-#release = '0.0'
188-
189-# The language for content autogenerated by Sphinx. Refer to documentation
190-# for a list of supported languages.
191-#language = None
192-
193-# There are two options for replacing |today|: either, you set today to some
194-# non-false value, then it is used:
195-#today = ''
196-# Else, today_fmt is used as the format for a strftime call.
197-#today_fmt = '%B %d, %Y'
198-
199 # List of patterns, relative to source directory, that match files and
200 # directories to ignore when looking for source files.
201 exclude_patterns = ['_build']
202
203-# The reST default role (used for this markup: `text`) to use for all documents.
204-#default_role = None
205-
206-# If true, '()' will be appended to :func: etc. cross-reference text.
207-#add_function_parentheses = True
208-
209-# If true, the current module name will be prepended to all description
210-# unit titles (such as .. function::).
211-#add_module_names = True
212-
213-# If true, sectionauthor and moduleauthor directives will be shown in the
214-# output. They are ignored by default.
215-#show_authors = False
216-
217 # The name of the Pygments (syntax highlighting) style to use.
218 pygments_style = 'sphinx'
219
220-# A list of ignored prefixes for module index sorting.
221-#modindex_common_prefix = []
222-
223-
224-# -- Options for HTML output ---------------------------------------------------
225-
226-# The theme to use for HTML and HTML Help pages. See the documentation for
227-# a list of builtin themes.
228+# The theme to use for HTML and HTML Help pages. See the documentation for a
229+# list of builtin themes.
230 try:
231 import sphinx_bootstrap_theme
232 except ImportError:
233@@ -110,150 +57,32 @@
234 'globaltoc_depth': -1,
235 }
236
237-# Theme options are theme-specific and customize the look and feel of a theme
238-# further. For a list of options available for each theme, see the
239-# documentation.
240-#html_theme_options = {}
241-
242-# Add any paths that contain custom themes here, relative to this directory.
243-#html_theme_path = []
244-
245-# The name for this set of Sphinx documents. If None, it defaults to
246-# "<project> v<release> documentation".
247-#html_title = None
248-
249-# A shorter title for the navigation bar. Default is the same as html_title.
250-#html_short_title = None
251-
252-# The name of an image file (relative to this directory) to place at the top
253-# of the sidebar.
254-#html_logo = None
255-
256-# The name of an image file (within the static path) to use as favicon of the
257-# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
258-# pixels large.
259-#html_favicon = None
260-
261 # Add any paths that contain custom static files (such as style sheets) here,
262 # relative to this directory. They are copied after the builtin static files,
263 # so a file named "default.css" will overwrite the builtin "default.css".
264 html_static_path = ['_static']
265
266-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
267-# using the given strftime format.
268-#html_last_updated_fmt = '%b %d, %Y'
269-
270-# If true, SmartyPants will be used to convert quotes and dashes to
271-# typographically correct entities.
272-#html_use_smartypants = True
273-
274-# Custom sidebar templates, maps document names to template names.
275-#html_sidebars = {}
276-
277-# Additional templates that should be rendered to pages, maps page names to
278-# template names.
279-#html_additional_pages = {}
280-
281-# If false, no module index is generated.
282-#html_domain_indices = True
283-
284-# If false, no index is generated.
285-#html_use_index = True
286-
287-# If true, the index is split into individual pages for each letter.
288-#html_split_index = False
289-
290-# If true, links to the reST sources are added to the pages.
291-#html_show_sourcelink = True
292-
293-# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
294-#html_show_sphinx = True
295-
296-# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
297-#html_show_copyright = True
298-
299-# If true, an OpenSearch description file will be output, and all pages will
300-# contain a <link> tag referring to it. The value of this option must be the
301-# base URL from which the finished HTML is served.
302-#html_use_opensearch = ''
303-
304-# This is the file name suffix for HTML files (e.g. ".xhtml").
305-#html_file_suffix = None
306-
307 # Output file base name for HTML help builder.
308 htmlhelp_basename = 'UbuntuCIEnginedoc'
309
310-
311-# -- Options for LaTeX output --------------------------------------------------
312-
313-latex_elements = {
314-# The paper size ('letterpaper' or 'a4paper').
315-#'papersize': 'letterpaper',
316-
317-# The font size ('10pt', '11pt' or '12pt').
318-#'pointsize': '10pt',
319-
320-# Additional stuff for the LaTeX preamble.
321-#'preamble': '',
322-}
323-
324-# Grouping the document tree into LaTeX files. List of tuples
325-# (source start file, target name, title, author, documentclass [howto/manual]).
326+# Grouping the document tree into LaTeX files. List of tuples (source start
327+# file, target name, title, author, documentclass [howto/manual]).
328 latex_documents = [
329- ('index', 'UbuntuCIEngine.tex', u'Ubuntu CI Engine Documentation',
330- u'Canonical CI Engineering Team', 'manual'),
331+ ('index', 'UbuntuCIEngine.tex', u'Ubuntu CI Engine Documentation',
332+ u'Canonical CI Engineering Team', 'manual'),
333 ]
334
335-# The name of an image file (relative to this directory) to place at the top of
336-# the title page.
337-#latex_logo = None
338-
339-# For "manual" documents, if this is true, then toplevel headings are parts,
340-# not chapters.
341-#latex_use_parts = False
342-
343-# If true, show page references after internal links.
344-#latex_show_pagerefs = False
345-
346-# If true, show URL addresses after external links.
347-#latex_show_urls = False
348-
349-# Documents to append as an appendix to all manuals.
350-#latex_appendices = []
351-
352-# If false, no module index is generated.
353-#latex_domain_indices = True
354-
355-
356-# -- Options for manual page output --------------------------------------------
357-
358-# One entry per manual page. List of tuples
359-# (source start file, name, description, authors, manual section).
360+# One entry per manual page. List of tuples (source start file, name,
361+# description, authors, manual section).
362 man_pages = [
363 ('index', 'ubuntuciengine', u'Ubuntu CI Engine Documentation',
364 [u'Canonical CI Engineering Team'], 1)
365 ]
366
367-# If true, show URL addresses after external links.
368-#man_show_urls = False
369-
370-
371-# -- Options for Texinfo output ------------------------------------------------
372-
373-# Grouping the document tree into Texinfo files. List of tuples
374-# (source start file, target name, title, author,
375-# dir menu entry, description, category)
376+# Grouping the document tree into Texinfo files. List of tuples (source start
377+# file, target name, title, author, dir menu entry, description, category)
378 texinfo_documents = [
379- ('index', 'UbuntuCIEngine', u'Ubuntu CI Engine Documentation',
380- u'Canonical CI Engineering Team', 'UbuntuCIEngine', 'One line description of project.',
381- 'Miscellaneous'),
382+ ('index', 'UbuntuCIEngine', u'Ubuntu CI Engine Documentation',
383+ u'Canonical CI Engineering Team', 'UbuntuCIEngine',
384+ 'One line description of project.', 'Miscellaneous'),
385 ]
386-
387-# Documents to append as an appendix to all manuals.
388-#texinfo_appendices = []
389-
390-# If false, no module index is generated.
391-#texinfo_domain_indices = True
392-
393-# How to display URL addresses: 'footnote', 'no', or 'inline'.
394-#texinfo_show_urls = 'footnote'
395
396=== modified file 'image-builder/imagebuilder/run_worker.py'
397--- image-builder/imagebuilder/run_worker.py 2014-10-29 16:43:39 +0000
398+++ image-builder/imagebuilder/run_worker.py 2014-11-25 16:38:40 +0000
399@@ -42,7 +42,7 @@
400 log.info(msg)
401 amqp_utils.progress_update(trigger, {'message': msg})
402
403- #Check API version
404+ # Check API version
405 api = params.get('api_version')
406 if api == '20140721':
407 image_id = get_image(image, status_cb)
408
409=== modified file 'lander/setup.py'
410--- lander/setup.py 2014-10-15 07:10:31 +0000
411+++ lander/setup.py 2014-11-25 16:38:40 +0000
412@@ -18,7 +18,6 @@
413 import sys
414
415
416-
417 HERE = os.path.abspath(os.path.dirname(__file__))
418 # get ci_utils.setuptools on the path
419 sys.path.append(os.path.join(HERE, '..', 'ci-utils'))
420
421=== modified file 'nf-stats-service/nfss/__init__.py'
422--- nf-stats-service/nfss/__init__.py 2014-08-26 14:49:08 +0000
423+++ nf-stats-service/nfss/__init__.py 2014-11-25 16:38:40 +0000
424@@ -36,6 +36,8 @@
425 config.scan()
426 try:
427 import pyramid_debugtoolbar
428+ # Make pyflakes happy with a no-op statement.
429+ pyramid_debugtoolbar
430 config.include('pyramid_debugtoolbar')
431 config.registry.settings['debugtoolbar.hosts'].append('10.0.0.0/16')
432 except ImportError:
433
434=== modified file 'ticket_system/project/tests.py'
435--- ticket_system/project/tests.py 2014-02-15 12:06:40 +0000
436+++ ticket_system/project/tests.py 2014-11-25 16:38:40 +0000
437@@ -173,7 +173,7 @@
438 class TestPep8(styles.TestPep8):
439
440 packages = [project]
441- exclude = ['migrations/']
442+ exclude = ['migrations']
443
444
445 class TestPyflakes(styles.TestPyflakes):
446
447=== modified file 'ticket_system/ticket/tests/test_style.py'
448--- ticket_system/ticket/tests/test_style.py 2014-10-07 10:04:01 +0000
449+++ ticket_system/ticket/tests/test_style.py 2014-11-25 16:38:40 +0000
450@@ -26,7 +26,7 @@
451 class TestPep8(styles.TestPep8):
452
453 packages = [ticket]
454- exclude = ['migrations/']
455+ exclude = ['migrations']
456
457
458 class TestPyflakes(styles.TestPyflakes):
459
460=== modified file 'ticket_system/ticket/tests/test_user_info.py'
461--- ticket_system/ticket/tests/test_user_info.py 2014-11-03 20:50:01 +0000
462+++ ticket_system/ticket/tests/test_user_info.py 2014-11-25 16:38:40 +0000
463@@ -85,7 +85,7 @@
464 self.assertEqual('', self._get_current_username())
465
466 def test_logout_works(self):
467- #'logout' inconditionally logs the user out.
468+ # 'logout' inconditionally logs the user out.
469 self.assertLoggedIn('test')
470
471 # By default the 'logout' page redirects to the (webui) site root
472@@ -97,7 +97,7 @@
473 self.assertNotLoggedIn()
474
475 def test_logout_supports_next(self):
476- #'logout' can optionally redirect users to another page, normally
477+ # 'logout' can optionally redirect users to another page, normally
478 # where they came from, via 'next' GET parameter.
479 self.assertLoggedIn('test')
480
481
482=== modified file 'ticket_system/ticket_system/settings.py'
483--- ticket_system/ticket_system/settings.py 2014-10-07 10:04:01 +0000
484+++ ticket_system/ticket_system/settings.py 2014-11-25 16:38:40 +0000
485@@ -40,8 +40,8 @@
486 with open(path) as f:
487 config = yaml.safe_load(f.read())
488 except:
489- print('Unable to use unit_config(%s), defaulting values' % path,
490- file=sys.stderr)
491+ msg = 'Unable to use unit_config(%s), defaulting values' % path
492+ print(msg, file=sys.stderr)
493 return config
494 _cfg = _unit_config()
495
496@@ -120,7 +120,6 @@
497 STATICFILES_FINDERS = (
498 'django.contrib.staticfiles.finders.FileSystemFinder',
499 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
500- #'django.contrib.staticfiles.finders.DefaultStorageFinder',
501 )
502
503 # Make this unique, and don't share it with anybody.
504@@ -170,7 +169,6 @@
505 )
506
507 LOCAL_APPS = (
508- #'people',
509 'project',
510 'ticket',
511 )

Subscribers

People subscribed via source and target branches

to all changes: