Merge "Fix hacking rules: H302,H305,H307,H402"

This commit is contained in:
Jenkins
2014-06-14 07:41:09 +00:00
committed by Gerrit Code Review
11 changed files with 18 additions and 21 deletions

View File

@@ -31,7 +31,7 @@ except ImportError:
import six import six
from six.moves import http_client as httplib # noqa from six.moves import http_client as httplib # noqa
from six.moves.urllib import parse from six.moves import urllib
from ceilometerclient import exc from ceilometerclient import exc
@@ -51,7 +51,7 @@ class HTTPClient(object):
@staticmethod @staticmethod
def get_connection_params(endpoint, **kwargs): def get_connection_params(endpoint, **kwargs):
parts = parse.urlparse(endpoint) parts = urllib.parse.urlparse(endpoint)
_args = (parts.hostname, parts.port, parts.path) _args = (parts.hostname, parts.port, parts.path)
_kwargs = {'timeout': (float(kwargs.get('timeout')) _kwargs = {'timeout': (float(kwargs.get('timeout'))
@@ -75,7 +75,7 @@ class HTTPClient(object):
_class = self.connection_params[0] _class = self.connection_params[0]
try: try:
if self.proxy_url: if self.proxy_url:
proxy_parts = parse.urlparse(self.proxy_url) proxy_parts = urllib.parse.urlparse(self.proxy_url)
return _class(proxy_parts.hostname, proxy_parts.port, return _class(proxy_parts.hostname, proxy_parts.port,
**self.connection_params[2]) **self.connection_params[2])
else: else:
@@ -212,7 +212,7 @@ class HTTPClient(object):
return self._http_request(url, method, **kwargs) return self._http_request(url, method, **kwargs)
def get_proxy_url(self): def get_proxy_url(self):
scheme = parse.urlparse(self.endpoint).scheme scheme = urllib.parse.urlparse(self.endpoint).scheme
if scheme == 'https': if scheme == 'https':
return os.environ.get('https_proxy') return os.environ.get('https_proxy')
elif scheme == 'http': elif scheme == 'http':

View File

@@ -14,12 +14,13 @@
# under the License. # under the License.
from __future__ import print_function from __future__ import print_function
import six
import sys import sys
import textwrap import textwrap
import uuid import uuid
import prettytable import prettytable
import six
from ceilometerclient import exc from ceilometerclient import exc
from ceilometerclient.openstack.common import cliutils from ceilometerclient.openstack.common import cliutils

View File

@@ -16,7 +16,6 @@
import json import json
from ceilometerclient import exc from ceilometerclient import exc
from ceilometerclient.tests import utils from ceilometerclient.tests import utils
HTTPEXCEPTIONS = {'HTTPBadRequest': exc.HTTPBadRequest, HTTPEXCEPTIONS = {'HTTPBadRequest': exc.HTTPBadRequest,

View File

@@ -11,14 +11,13 @@
# under the License. # under the License.
import re import re
import six
import sys import sys
import fixtures import fixtures
import mock
from testtools import matchers
from keystoneclient.v2_0 import client as ksclient from keystoneclient.v2_0 import client as ksclient
import mock
import six
from testtools import matchers
from ceilometerclient import exc from ceilometerclient import exc
from ceilometerclient import shell as ceilometer_shell from ceilometerclient import shell as ceilometer_shell

View File

@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import itertools import itertools
import mock import mock
import six import six

View File

@@ -14,6 +14,7 @@
# under the License. # under the License.
import copy import copy
import fixtures import fixtures
import six import six
import testtools import testtools

View File

@@ -15,11 +15,11 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock
import re import re
import six
import sys import sys
import mock
import six
from testtools import matchers from testtools import matchers
from ceilometerclient import shell as base_shell from ceilometerclient import shell as base_shell

View File

@@ -68,7 +68,7 @@ def do_sample_list(cc, args):
@utils.arg('-p', '--project_id', metavar='<PROJECT_ID>', @utils.arg('-p', '--project_id', metavar='<PROJECT_ID>',
help='ID of the project to show samples for.') help='ID of the project to show samples for.')
def do_meter_list(cc, args={}): def do_meter_list(cc, args={}):
'''List the user's meter''' '''List the user's meter.'''
fields = {'resource_id': args.resource_id, fields = {'resource_id': args.resource_id,
'user_id': args.user_id, 'user_id': args.user_id,
'project_id': args.project_id, 'project_id': args.project_id,

View File

@@ -13,7 +13,7 @@
import re import re
from six.moves.urllib import parse from six.moves import urllib
OP_LOOKUP = {'!=': 'ne', OP_LOOKUP = {'!=': 'ne',
'>=': 'ge', '>=': 'ge',
@@ -54,7 +54,7 @@ def build_url(path, q, params=None):
# Transform the dict to a sequence of two-element tuples in fixed # Transform the dict to a sequence of two-element tuples in fixed
# order, then the encoded string will be consistent in Python 2&3. # order, then the encoded string will be consistent in Python 2&3.
new_qparams = sorted(query_params.items(), key=lambda x: x[0]) new_qparams = sorted(query_params.items(), key=lambda x: x[0])
path += "?" + parse.urlencode(new_qparams, doseq=True) path += "?" + urllib.parse.urlencode(new_qparams, doseq=True)
if params: if params:
for p in params: for p in params:

View File

@@ -20,6 +20,7 @@
import functools import functools
import json import json
import six import six
from ceilometerclient.common import utils from ceilometerclient.common import utils

View File

@@ -25,12 +25,8 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
commands = {posargs} commands = {posargs}
[flake8] [flake8]
# H302 import only modules
# H305 imports not grouped correctly
# H307 like imports should be grouped together
# H402 one line docstring needs punctuation
# H405 multi line docstring summary not separated with an empty line # H405 multi line docstring summary not separated with an empty line
# H904 Wrap long lines in parentheses instead of a backslash # H904 Wrap long lines in parentheses instead of a backslash
ignore = H302,H305,H307,H402,H405,H904 ignore = H405,H904
show-source = True show-source = True
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools