Fix unused imports(flake8 F401, F999)
- F401: imported but unused - F999: syntax error in doctest Fixing a couple of the F401's simply required fixing the doctests syntax where the imports were actually in use. Change-Id: If78abbb143daf8d005a71c5ab52836df29c5e0cd
This commit is contained in:
		
				
					committed by
					
						
						Gerrit Code Review
					
				
			
			
				
	
			
			
			
						parent
						
							abcf9db625
						
					
				
				
					commit
					6f27af4a0c
				
			@@ -35,8 +35,8 @@ _logger = logging.getLogger(__name__)
 | 
			
		||||
 | 
			
		||||
def try_import_keyring():
 | 
			
		||||
    try:
 | 
			
		||||
        import keyring
 | 
			
		||||
        import pickle
 | 
			
		||||
        import keyring  # noqa
 | 
			
		||||
        import pickle  # noqa
 | 
			
		||||
        return True
 | 
			
		||||
    except ImportError:
 | 
			
		||||
        if (hasattr(sys.stderr, 'isatty') and sys.stderr.isatty()):
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ def _ensure_subprocess():
 | 
			
		||||
            else:
 | 
			
		||||
                import subprocess
 | 
			
		||||
        except ImportError:
 | 
			
		||||
            import subprocess
 | 
			
		||||
            import subprocess  # noqa
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def cms_verify(formatted, signing_cert_file_name, ca_file_name):
 | 
			
		||||
 
 | 
			
		||||
@@ -1 +1,2 @@
 | 
			
		||||
# flake8: noqa
 | 
			
		||||
from keystoneclient.v2_0.client import Client
 | 
			
		||||
 
 | 
			
		||||
@@ -80,9 +80,9 @@ class Client(client.HTTPClient):
 | 
			
		||||
 | 
			
		||||
        >>> from keystoneclient.v2_0 import client
 | 
			
		||||
        >>> keystone = client.Client(username=USER,
 | 
			
		||||
                                     password=PASS,
 | 
			
		||||
                                     tenant_name=TENANT_NAME,
 | 
			
		||||
                                     auth_url=KEYSTONE_URL)
 | 
			
		||||
        ...                          password=PASS,
 | 
			
		||||
        ...                          tenant_name=TENANT_NAME,
 | 
			
		||||
        ...                          auth_url=KEYSTONE_URL)
 | 
			
		||||
        >>> keystone.tenants.list()
 | 
			
		||||
        ...
 | 
			
		||||
        >>> user = keystone.users.get(USER_ID)
 | 
			
		||||
@@ -95,9 +95,9 @@ class Client(client.HTTPClient):
 | 
			
		||||
 | 
			
		||||
        >>> from keystoneclient.v2_0 import client
 | 
			
		||||
        >>> keystone = client.Client(username=USER,
 | 
			
		||||
                                     password=PASS,
 | 
			
		||||
                                     tenant_name=TENANT_NAME,
 | 
			
		||||
                                     auth_url=KEYSTONE_URL)
 | 
			
		||||
        ...                          password=PASS,
 | 
			
		||||
        ...                          tenant_name=TENANT_NAME,
 | 
			
		||||
        ...                          auth_url=KEYSTONE_URL)
 | 
			
		||||
        >>> auth_ref = keystone.auth_ref
 | 
			
		||||
        >>> # pickle or whatever you like here
 | 
			
		||||
        >>> new_client = client.Client(auth_ref=auth_ref)
 | 
			
		||||
@@ -111,8 +111,8 @@ class Client(client.HTTPClient):
 | 
			
		||||
 | 
			
		||||
        >>> from keystoneclient.v2_0 import client
 | 
			
		||||
        >>> admin_client = client.Client(
 | 
			
		||||
                token='12345secret7890',
 | 
			
		||||
                endpoint='http://localhost:35357/v2.0')
 | 
			
		||||
        ...     token='12345secret7890',
 | 
			
		||||
        ...     endpoint='http://localhost:35357/v2.0')
 | 
			
		||||
        >>> keystone.tenants.list()
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
 
 | 
			
		||||
@@ -1 +1,2 @@
 | 
			
		||||
# flake8: noqa
 | 
			
		||||
from keystoneclient.v3.client import Client
 | 
			
		||||
 
 | 
			
		||||
@@ -52,9 +52,10 @@ class Client(client.Client):
 | 
			
		||||
 | 
			
		||||
        >>> from keystoneclient.v3 import client
 | 
			
		||||
        >>> keystone = client.Client(username=USER,
 | 
			
		||||
                                     password=PASS,
 | 
			
		||||
                                     tenant_name=TENANT_NAME,
 | 
			
		||||
                                     auth_url=KEYSTONE_URL)
 | 
			
		||||
        ...                          password=PASS,
 | 
			
		||||
        ...                          tenant_name=TENANT_NAME,
 | 
			
		||||
        ...                          auth_url=KEYSTONE_URL)
 | 
			
		||||
        ...
 | 
			
		||||
        >>> keystone.tenants.list()
 | 
			
		||||
        ...
 | 
			
		||||
        >>> user = keystone.users.get(USER_ID)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,4 @@
 | 
			
		||||
import mock
 | 
			
		||||
import mox
 | 
			
		||||
 | 
			
		||||
from keystoneclient import base
 | 
			
		||||
from keystoneclient import exceptions
 | 
			
		||||
from keystoneclient.v2_0 import roles
 | 
			
		||||
from tests import utils
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
import copy
 | 
			
		||||
import json
 | 
			
		||||
import mock
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,6 @@ import argparse
 | 
			
		||||
import cStringIO
 | 
			
		||||
import json
 | 
			
		||||
import os
 | 
			
		||||
import requests
 | 
			
		||||
import sys
 | 
			
		||||
import uuid
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -13,11 +13,8 @@
 | 
			
		||||
# See the License for the specific language governing permissions and
 | 
			
		||||
# limitations under the License.
 | 
			
		||||
 | 
			
		||||
from datetime import datetime
 | 
			
		||||
import urlparse
 | 
			
		||||
 | 
			
		||||
from keystoneclient import client as base_client
 | 
			
		||||
from keystoneclient.v2_0 import client
 | 
			
		||||
from tests import fakes
 | 
			
		||||
from tests import utils
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,10 @@
 | 
			
		||||
import cStringIO
 | 
			
		||||
import mock
 | 
			
		||||
import os
 | 
			
		||||
import stubout
 | 
			
		||||
import sys
 | 
			
		||||
from testtools import matchers
 | 
			
		||||
 | 
			
		||||
from keystoneclient import exceptions
 | 
			
		||||
from keystoneclient import client
 | 
			
		||||
from keystoneclient.v2_0 import client as client_v2_0
 | 
			
		||||
 | 
			
		||||
from tests.v2_0 import fakes
 | 
			
		||||
from tests import utils
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
import testtools
 | 
			
		||||
import uuid
 | 
			
		||||
 | 
			
		||||
from keystoneclient.v3 import endpoints
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,6 @@ Installation script for python-keystoneclient's development virtualenv
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
import subprocess
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
import install_venv_common as install_venv
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								tox.ini
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								tox.ini
									
									
									
									
									
								
							@@ -27,11 +27,9 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
 | 
			
		||||
downloadcache = ~/cache/pip
 | 
			
		||||
 | 
			
		||||
[flake8]
 | 
			
		||||
# F401: imported but unused
 | 
			
		||||
# F811: redefinition of unused 'client' from line 81
 | 
			
		||||
# F821: undefined name
 | 
			
		||||
# F841: local variable is assigned to but never used
 | 
			
		||||
# F999: syntax error in doctest
 | 
			
		||||
# H201: no 'except:' at least use 'except Exception:'
 | 
			
		||||
# H202: assertRaises Exception too broad
 | 
			
		||||
# H302: import only modules
 | 
			
		||||
@@ -42,6 +40,6 @@ downloadcache = ~/cache/pip
 | 
			
		||||
# H403: multi line docstring end on new line
 | 
			
		||||
# H404: multi line docstring should start with a summary
 | 
			
		||||
# H802: git commit title
 | 
			
		||||
ignore = F401,F811,F821,F841,F999,H201,H202,H302,H304,H306,H401,H402,H403,H404,H802
 | 
			
		||||
ignore = F811,F821,F841,H201,H202,H302,H304,H306,H401,H402,H403,H404,H802
 | 
			
		||||
show-source = True
 | 
			
		||||
exclude = .venv,.tox,dist,doc,*egg
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user