From 9363607553911122607181fabb3dd17b3c6daf71 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Tue, 31 Jan 2017 17:24:47 -0500 Subject: [PATCH] pep8 cleanups Signed-off-by: Doug Hellmann --- aerostat/app.py | 9 ++------- aerostat/download.py | 4 +++- aerostat/export.py | 21 +-------------------- aerostat/query.py | 2 +- aerostat/resolver.py | 2 -- tox.ini | 3 ++- 6 files changed, 9 insertions(+), 32 deletions(-) diff --git a/aerostat/app.py b/aerostat/app.py index 92a0a6d..44b1af7 100644 --- a/aerostat/app.py +++ b/aerostat/app.py @@ -16,20 +16,14 @@ # under the License. import argparse -import os.path -import pprint +import logging import sys import os_client_config -import progressbar import shade -import yaml -from aerostat import download from aerostat import export from aerostat import query -from aerostat import resolver -from aerostat import resources def main(): @@ -84,3 +78,4 @@ def main(): args = parser.parse_args(sys.argv[1:]) return args.func(config, args) + return args.func(cloud, config, args) diff --git a/aerostat/download.py b/aerostat/download.py index f32f1c7..45d3f2a 100644 --- a/aerostat/download.py +++ b/aerostat/download.py @@ -79,7 +79,9 @@ class Downloader: # FIXME(dhellmann): start downloads in a separate thread or process for resource_type, resource, output_path in self._tasks: if os.path.exists(output_path): - print('output file {} already exists, skipping download'.format(output_path)) + print( + 'output file {} already exists, skipping download'.format( + output_path)) continue if resource_type == 'image': print('downloading image {} to {}'.format( diff --git a/aerostat/export.py b/aerostat/export.py index c59e502..c2f6539 100644 --- a/aerostat/export.py +++ b/aerostat/export.py @@ -15,27 +15,18 @@ # License for the specific language governing permissions and limitations # under the License. -import argparse import os.path -import pprint -import sys -import os_client_config -import progressbar -import shade import yaml from aerostat import download -from aerostat import export from aerostat import resolver from aerostat import resources -def export_data(config, args): +def export_data(cloud, config, args): output_path = args.output_path - cloud_config = config.get_one_cloud(options=(args, [])) - cloud = shade.OpenStackCloud(cloud_config=cloud_config) downloader = download.Downloader(output_path, cloud) res = resolver.Resolver(cloud, downloader) tasks = [] @@ -70,13 +61,3 @@ def export_data(config, args): print('wrote playbook to {}'.format(playbook_filename)) downloader.start() - - # print('downloading volume snapshot') - # snapshot = cloud.get_volume_snapshot('testvol1-sn1') - # pprint.pprint(snapshot) - # # with download.ProgressBarDownloader('testvol1-sn1.dat', snapshot.size) as out: - # # cloud.download_image('dev1-sn1', output_file=out) - - # for volume in dev1.volumes: - # vol = cloud.get_volume(volume.id) - # pprint.pprint(vol) diff --git a/aerostat/query.py b/aerostat/query.py index 1e129e0..7410853 100644 --- a/aerostat/query.py +++ b/aerostat/query.py @@ -16,5 +16,5 @@ # under the License. -def query_data(config, args): +def query_data(cloud, config, args): raise NotImplementedError('query not implemented') diff --git a/aerostat/resolver.py b/aerostat/resolver.py index 8eae859..353be83 100644 --- a/aerostat/resolver.py +++ b/aerostat/resolver.py @@ -15,8 +15,6 @@ # License for the specific language governing permissions and limitations # under the License. -import pprint - class Resolver: diff --git a/tox.ini b/tox.ini index c402297..3678ce2 100644 --- a/tox.ini +++ b/tox.ini @@ -37,6 +37,7 @@ commands = oslo_debug_helper {posargs} # E123, E125 skipped as they are invalid PEP-8. show-source = True -ignore = E123,E125 +ignore = E123,E125,H238 builtins = _ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build +max-line-length = 90 \ No newline at end of file