From 37692b5b0027c4490b9273d2748c177cb577b856 Mon Sep 17 00:00:00 2001 From: Randy Barlow Date: Wed, 20 May 2015 12:13:04 -0400 Subject: [PATCH] PEP-8 client_consumer/. --- client_consumer/pulp/__init__.py | 14 --- .../pulp/client/consumer/config.py | 95 ++++++------------- client_consumer/test/unit/test_config.py | 2 - run-tests.py | 2 +- 4 files changed, 31 insertions(+), 82 deletions(-) diff --git a/client_consumer/pulp/__init__.py b/client_consumer/pulp/__init__.py index 51b898b8ab..3ad9513f40 100644 --- a/client_consumer/pulp/__init__.py +++ b/client_consumer/pulp/__init__.py @@ -1,16 +1,2 @@ -# -*- coding: utf-8 -*- -# -# Copyright © 2013 Red Hat, Inc. -# -# This software is licensed to you under the GNU General Public -# License as published by the Free Software Foundation; either version -# 2 of the License (GPLv2) or (at your option) any later version. -# There is NO WARRANTY for this software, express or implied, -# including the implied warranties of MERCHANTABILITY, -# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should -# have received a copy of GPLv2 along with this software; if not, see -# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - from pkgutil import extend_path __path__ = extend_path(__path__, __name__) - diff --git a/client_consumer/pulp/client/consumer/config.py b/client_consumer/pulp/client/consumer/config.py index 837d57b804..908be04dc9 100644 --- a/client_consumer/pulp/client/consumer/config.py +++ b/client_consumer/pulp/client/consumer/config.py @@ -1,19 +1,9 @@ -# Copyright (c) 2014 Red Hat, Inc. -# -# This software is licensed to you under the GNU General Public -# License as published by the Free Software Foundation; either version -# 2 of the License (GPLv2) or (at your option) any later version. -# There is NO WARRANTY for this software, express or implied, -# including the implied warranties of MERCHANTABILITY, -# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should -# have received a copy of GPLv2 along with this software; if not, see -# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - import os import socket from pulp.common.config import Config, REQUIRED, ANY, NUMBER, BOOL, OPTIONAL + DEFAULT = { 'server': { 'host': socket.gethostname(), @@ -65,67 +55,42 @@ SCHEMA = ( ('server', REQUIRED, - ( - ('host', REQUIRED, ANY), - ('port', REQUIRED, NUMBER), - ('api_prefix', REQUIRED, ANY), - ('verify_ssl', REQUIRED, BOOL), - ('ca_path', REQUIRED, ANY), - ('rsa_pub', REQUIRED, ANY), - ) - ), + (('host', REQUIRED, ANY), + ('port', REQUIRED, NUMBER), + ('api_prefix', REQUIRED, ANY), + ('verify_ssl', REQUIRED, BOOL), + ('ca_path', REQUIRED, ANY), + ('rsa_pub', REQUIRED, ANY))), ('authentication', REQUIRED, - ( - ('rsa_key', REQUIRED, ANY), - ('rsa_pub', REQUIRED, ANY), - ) - ), + (('rsa_key', REQUIRED, ANY), + ('rsa_pub', REQUIRED, ANY))), ('client', REQUIRED, - ( - ('role', REQUIRED, r'consumer'), - ) - ), + (('role', REQUIRED, r'consumer'),),), ('filesystem', REQUIRED, - ( - ('extensions_dir', REQUIRED, ANY), - ('repo_file', REQUIRED, ANY), - ('mirror_list_dir', REQUIRED, ANY), - ('gpg_keys_dir', REQUIRED, ANY), - ('cert_dir', REQUIRED, ANY), - ('id_cert_dir', REQUIRED, ANY), - ('id_cert_filename', REQUIRED, ANY), - ) - ), + (('extensions_dir', REQUIRED, ANY), + ('repo_file', REQUIRED, ANY), + ('mirror_list_dir', REQUIRED, ANY), + ('gpg_keys_dir', REQUIRED, ANY), + ('cert_dir', REQUIRED, ANY), + ('id_cert_dir', REQUIRED, ANY), + ('id_cert_filename', REQUIRED, ANY))), ('reboot', REQUIRED, - ( - ('permit', REQUIRED, BOOL), - ('delay', REQUIRED, NUMBER), - ) - ), + (('permit', REQUIRED, BOOL), + ('delay', REQUIRED, NUMBER))), ('output', REQUIRED, - ( - ('poll_frequency_in_seconds', REQUIRED, NUMBER), - ('enable_color', REQUIRED, BOOL), - ('wrap_to_terminal', REQUIRED, BOOL), - ('wrap_width', REQUIRED, NUMBER) - ) - ), + (('poll_frequency_in_seconds', REQUIRED, NUMBER), + ('enable_color', REQUIRED, BOOL), + ('wrap_to_terminal', REQUIRED, BOOL), + ('wrap_width', REQUIRED, NUMBER))), ('messaging', REQUIRED, - ( - ('scheme', REQUIRED, r'(tcp|ssl|amqp|amqps)'), - ('host', OPTIONAL, ANY), - ('port', REQUIRED, NUMBER), - ('transport', REQUIRED, ANY), - ('cacert', OPTIONAL, ANY), - ('clientcert', OPTIONAL, ANY) - ) - ), + (('scheme', REQUIRED, r'(tcp|ssl|amqp|amqps)'), + ('host', OPTIONAL, ANY), + ('port', REQUIRED, NUMBER), + ('transport', REQUIRED, ANY), + ('cacert', OPTIONAL, ANY), + ('clientcert', OPTIONAL, ANY))), ('profile', REQUIRED, - ( - ('minutes', REQUIRED, NUMBER), - ) - ), -) + (('minutes', REQUIRED, NUMBER),))) def read_config(paths=None, validate=True): diff --git a/client_consumer/test/unit/test_config.py b/client_consumer/test/unit/test_config.py index 29c1b592d6..5cdf9e12db 100644 --- a/client_consumer/test/unit/test_config.py +++ b/client_consumer/test/unit/test_config.py @@ -1,4 +1,3 @@ - from unittest import TestCase from mock import patch, Mock @@ -38,7 +37,6 @@ def test_default(self): msg = '[%s].%s has default but not found in the schema' % (section, key) self.assertTrue(self.schema_has_property(section, key), msg=msg) - @patch('os.listdir') @patch('os.path.expanduser') @patch('os.path.exists', Mock(return_value=False)) diff --git a/run-tests.py b/run-tests.py index 51b11e6c11..bc905cf0cb 100755 --- a/run-tests.py +++ b/run-tests.py @@ -15,7 +15,7 @@ paths_to_check = [ 'agent', 'bindings', - 'client_consumer/pulp/client/consumer/cli.py', + 'client_consumer', 'client_lib', 'repoauth/', 'server/pulp/plugins',