Update keystoneclient code to account for hacking 0.9.2
Fixed most of the errors reported back from hacking 0.9.2. Specifically: - E128 continuation line under-indented for visual indent - E251 unexpected spaces around keyword / parameter equals - E265 block comment should start with '# ' - H305 imports not grouped correctly - H307 like imports should be grouped together - H402 one line docstring needs punctuation - H904 Wrap long lines in parentheses instead of a backslash But opted to ignore the following for now: - E122: continuation line missing indentation or outdented - H405: multi line docstring summary not separated with an empty line Change-Id: Ib8e698d85fd598fa91435538657361a1f695ce89
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from keystoneclient.auth import base
|
from keystoneclient.auth import base
|
||||||
|
@@ -24,8 +24,9 @@ import logging
|
|||||||
from six.moves.urllib import parse as urlparse
|
from six.moves.urllib import parse as urlparse
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import keyring
|
|
||||||
import pickle
|
import pickle
|
||||||
|
|
||||||
|
import keyring
|
||||||
except ImportError:
|
except ImportError:
|
||||||
keyring = None
|
keyring = None
|
||||||
pickle = None
|
pickle = None
|
||||||
|
@@ -149,13 +149,13 @@ import contextlib
|
|||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import requests
|
|
||||||
import stat
|
import stat
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
import requests
|
||||||
import six
|
import six
|
||||||
from six.moves import urllib
|
from six.moves import urllib
|
||||||
|
|
||||||
|
@@ -33,9 +33,10 @@ import hashlib
|
|||||||
import hmac
|
import hmac
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import six
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
# make sure pycrypto is available
|
# make sure pycrypto is available
|
||||||
try:
|
try:
|
||||||
from Crypto.Cipher import AES
|
from Crypto.Cipher import AES
|
||||||
|
@@ -32,11 +32,11 @@ This WSGI component:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import webob
|
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import six
|
import six
|
||||||
from six.moves import urllib
|
from six.moves import urllib
|
||||||
|
import webob
|
||||||
|
|
||||||
from keystoneclient.openstack.common import jsonutils
|
from keystoneclient.openstack.common import jsonutils
|
||||||
|
|
||||||
|
@@ -1443,10 +1443,10 @@ class v2AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest,
|
|||||||
self.examples.UUID_TOKEN_UNKNOWN_BIND,
|
self.examples.UUID_TOKEN_UNKNOWN_BIND,
|
||||||
self.examples.UUID_TOKEN_NO_SERVICE_CATALOG,
|
self.examples.UUID_TOKEN_NO_SERVICE_CATALOG,
|
||||||
self.examples.SIGNED_TOKEN_SCOPED_KEY,):
|
self.examples.SIGNED_TOKEN_SCOPED_KEY,):
|
||||||
|
response_body = self.examples.JSON_TOKEN_RESPONSES[token]
|
||||||
httpretty.register_uri(httpretty.GET,
|
httpretty.register_uri(httpretty.GET,
|
||||||
"%s/v2.0/tokens/%s" % (BASE_URI, token),
|
"%s/v2.0/tokens/%s" % (BASE_URI, token),
|
||||||
body=
|
body=response_body)
|
||||||
self.examples.JSON_TOKEN_RESPONSES[token])
|
|
||||||
|
|
||||||
httpretty.register_uri(httpretty.GET,
|
httpretty.register_uri(httpretty.GET,
|
||||||
'%s/v2.0/tokens/%s' % (BASE_URI, ERROR_TOKEN),
|
'%s/v2.0/tokens/%s' % (BASE_URI, ERROR_TOKEN),
|
||||||
@@ -1537,10 +1537,10 @@ class CrossVersionAuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest,
|
|||||||
body=FAKE_ADMIN_TOKEN)
|
body=FAKE_ADMIN_TOKEN)
|
||||||
|
|
||||||
token = self.examples.UUID_TOKEN_DEFAULT
|
token = self.examples.UUID_TOKEN_DEFAULT
|
||||||
|
response_body = self.examples.JSON_TOKEN_RESPONSES[token]
|
||||||
httpretty.register_uri(httpretty.GET,
|
httpretty.register_uri(httpretty.GET,
|
||||||
"%s/v2.0/tokens/%s" % (BASE_URI, token),
|
"%s/v2.0/tokens/%s" % (BASE_URI, token),
|
||||||
body=
|
body=response_body)
|
||||||
self.examples.JSON_TOKEN_RESPONSES[token])
|
|
||||||
|
|
||||||
self.set_middleware(conf=conf)
|
self.set_middleware(conf=conf)
|
||||||
|
|
||||||
|
@@ -90,8 +90,8 @@ class KeyringTest(utils.TestCase):
|
|||||||
tenant_id=TENANT_ID, auth_url=AUTH_URL)
|
tenant_id=TENANT_ID, auth_url=AUTH_URL)
|
||||||
|
|
||||||
# stub and check that a new token is received
|
# stub and check that a new token is received
|
||||||
with mock.patch.object(cl, 'get_raw_token_from_identity_service') \
|
method = 'get_raw_token_from_identity_service'
|
||||||
as meth:
|
with mock.patch.object(cl, method) as meth:
|
||||||
meth.return_value = (True, PROJECT_SCOPED_TOKEN)
|
meth.return_value = (True, PROJECT_SCOPED_TOKEN)
|
||||||
|
|
||||||
self.assertTrue(cl.authenticate())
|
self.assertTrue(cl.authenticate())
|
||||||
@@ -128,8 +128,8 @@ class KeyringTest(utils.TestCase):
|
|||||||
self.memory_keyring.password = pickle.dumps(auth_ref)
|
self.memory_keyring.password = pickle.dumps(auth_ref)
|
||||||
|
|
||||||
# stub and check that a new token is received, so not using expired
|
# stub and check that a new token is received, so not using expired
|
||||||
with mock.patch.object(cl, 'get_raw_token_from_identity_service') \
|
method = 'get_raw_token_from_identity_service'
|
||||||
as meth:
|
with mock.patch.object(cl, method) as meth:
|
||||||
meth.return_value = (True, PROJECT_SCOPED_TOKEN)
|
meth.return_value = (True, PROJECT_SCOPED_TOKEN)
|
||||||
|
|
||||||
self.assertTrue(cl.authenticate())
|
self.assertTrue(cl.authenticate())
|
||||||
@@ -166,8 +166,8 @@ class KeyringTest(utils.TestCase):
|
|||||||
use_keyring=True)
|
use_keyring=True)
|
||||||
|
|
||||||
# stub and check that a new token is received
|
# stub and check that a new token is received
|
||||||
with mock.patch.object(cl, 'get_raw_token_from_identity_service') \
|
method = 'get_raw_token_from_identity_service'
|
||||||
as meth:
|
with mock.patch.object(cl, method) as meth:
|
||||||
meth.return_value = (True, PROJECT_SCOPED_TOKEN)
|
meth.return_value = (True, PROJECT_SCOPED_TOKEN)
|
||||||
|
|
||||||
self.assertTrue(cl.authenticate())
|
self.assertTrue(cl.authenticate())
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import uuid
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
import httpretty
|
import httpretty
|
||||||
@@ -22,7 +23,6 @@ import requests
|
|||||||
import six
|
import six
|
||||||
from six.moves.urllib import parse as urlparse
|
from six.moves.urllib import parse as urlparse
|
||||||
import testtools
|
import testtools
|
||||||
import uuid
|
|
||||||
|
|
||||||
from keystoneclient.openstack.common import jsonutils
|
from keystoneclient.openstack.common import jsonutils
|
||||||
|
|
||||||
|
@@ -87,7 +87,7 @@ def do_user_get(kc, args):
|
|||||||
@utils.arg('--enabled', metavar='<true|false>', default=True,
|
@utils.arg('--enabled', metavar='<true|false>', default=True,
|
||||||
help='Initial user enabled status. Default is true.')
|
help='Initial user enabled status. Default is true.')
|
||||||
def do_user_create(kc, args):
|
def do_user_create(kc, args):
|
||||||
"""Create new user"""
|
"""Create new user."""
|
||||||
if args.tenant:
|
if args.tenant:
|
||||||
tenant_id = utils.find_resource(kc.tenants, args.tenant).id
|
tenant_id = utils.find_resource(kc.tenants, args.tenant).id
|
||||||
elif args.tenant_id:
|
elif args.tenant_id:
|
||||||
|
@@ -20,7 +20,7 @@ from keystoneclient import base
|
|||||||
|
|
||||||
|
|
||||||
class User(base.Resource):
|
class User(base.Resource):
|
||||||
"""Represents a Keystone user"""
|
"""Represents a Keystone user."""
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<User %s>" % self._info
|
return "<User %s>" % self._info
|
||||||
|
|
||||||
|
4
tox.ini
4
tox.ini
@@ -36,7 +36,9 @@ commands =
|
|||||||
# F821: undefined name
|
# F821: undefined name
|
||||||
# H304: no relative imports
|
# H304: no relative imports
|
||||||
# H803 Commit message should not end with a period (do not remove per list discussion)
|
# H803 Commit message should not end with a period (do not remove per list discussion)
|
||||||
ignore = F821,H304,H803
|
# H405: multi line docstring summary not separated with an empty line
|
||||||
|
# E122: continuation line missing indentation or outdented
|
||||||
|
ignore = F821,H304,H803,H405,E122
|
||||||
show-source = True
|
show-source = True
|
||||||
exclude = .venv,.tox,dist,doc,*egg,build,*openstack/common*
|
exclude = .venv,.tox,dist,doc,*egg,build,*openstack/common*
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user