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:
Dolph Mathews
2013-05-28 09:22:03 -05:00
committed by Gerrit Code Review
parent abcf9db625
commit 6f27af4a0c
14 changed files with 18 additions and 31 deletions

View File

@@ -35,8 +35,8 @@ _logger = logging.getLogger(__name__)
def try_import_keyring(): def try_import_keyring():
try: try:
import keyring import keyring # noqa
import pickle import pickle # noqa
return True return True
except ImportError: except ImportError:
if (hasattr(sys.stderr, 'isatty') and sys.stderr.isatty()): if (hasattr(sys.stderr, 'isatty') and sys.stderr.isatty()):

View File

@@ -21,7 +21,7 @@ def _ensure_subprocess():
else: else:
import subprocess import subprocess
except ImportError: except ImportError:
import subprocess import subprocess # noqa
def cms_verify(formatted, signing_cert_file_name, ca_file_name): def cms_verify(formatted, signing_cert_file_name, ca_file_name):

View File

@@ -1 +1,2 @@
# flake8: noqa
from keystoneclient.v2_0.client import Client from keystoneclient.v2_0.client import Client

View File

@@ -80,9 +80,9 @@ class Client(client.HTTPClient):
>>> from keystoneclient.v2_0 import client >>> from keystoneclient.v2_0 import client
>>> keystone = client.Client(username=USER, >>> keystone = client.Client(username=USER,
password=PASS, ... password=PASS,
tenant_name=TENANT_NAME, ... tenant_name=TENANT_NAME,
auth_url=KEYSTONE_URL) ... auth_url=KEYSTONE_URL)
>>> keystone.tenants.list() >>> keystone.tenants.list()
... ...
>>> user = keystone.users.get(USER_ID) >>> user = keystone.users.get(USER_ID)
@@ -95,9 +95,9 @@ class Client(client.HTTPClient):
>>> from keystoneclient.v2_0 import client >>> from keystoneclient.v2_0 import client
>>> keystone = client.Client(username=USER, >>> keystone = client.Client(username=USER,
password=PASS, ... password=PASS,
tenant_name=TENANT_NAME, ... tenant_name=TENANT_NAME,
auth_url=KEYSTONE_URL) ... auth_url=KEYSTONE_URL)
>>> auth_ref = keystone.auth_ref >>> auth_ref = keystone.auth_ref
>>> # pickle or whatever you like here >>> # pickle or whatever you like here
>>> new_client = client.Client(auth_ref=auth_ref) >>> new_client = client.Client(auth_ref=auth_ref)
@@ -111,8 +111,8 @@ class Client(client.HTTPClient):
>>> from keystoneclient.v2_0 import client >>> from keystoneclient.v2_0 import client
>>> admin_client = client.Client( >>> admin_client = client.Client(
token='12345secret7890', ... token='12345secret7890',
endpoint='http://localhost:35357/v2.0') ... endpoint='http://localhost:35357/v2.0')
>>> keystone.tenants.list() >>> keystone.tenants.list()
""" """

View File

@@ -1 +1,2 @@
# flake8: noqa
from keystoneclient.v3.client import Client from keystoneclient.v3.client import Client

View File

@@ -52,9 +52,10 @@ class Client(client.Client):
>>> from keystoneclient.v3 import client >>> from keystoneclient.v3 import client
>>> keystone = client.Client(username=USER, >>> keystone = client.Client(username=USER,
password=PASS, ... password=PASS,
tenant_name=TENANT_NAME, ... tenant_name=TENANT_NAME,
auth_url=KEYSTONE_URL) ... auth_url=KEYSTONE_URL)
...
>>> keystone.tenants.list() >>> keystone.tenants.list()
... ...
>>> user = keystone.users.get(USER_ID) >>> user = keystone.users.get(USER_ID)

View File

@@ -1,8 +1,4 @@
import mock
import mox
from keystoneclient import base from keystoneclient import base
from keystoneclient import exceptions
from keystoneclient.v2_0 import roles from keystoneclient.v2_0 import roles
from tests import utils from tests import utils

View File

@@ -1,4 +1,3 @@
import copy
import json import json
import mock import mock

View File

@@ -2,7 +2,6 @@ import argparse
import cStringIO import cStringIO
import json import json
import os import os
import requests
import sys import sys
import uuid import uuid

View File

@@ -13,11 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from datetime import datetime
import urlparse import urlparse
from keystoneclient import client as base_client
from keystoneclient.v2_0 import client
from tests import fakes from tests import fakes
from tests import utils from tests import utils

View File

@@ -1,13 +1,10 @@
import cStringIO import cStringIO
import mock
import os import os
import stubout import stubout
import sys import sys
from testtools import matchers from testtools import matchers
from keystoneclient import exceptions
from keystoneclient import client from keystoneclient import client
from keystoneclient.v2_0 import client as client_v2_0
from tests.v2_0 import fakes from tests.v2_0 import fakes
from tests import utils from tests import utils

View File

@@ -1,4 +1,3 @@
import testtools
import uuid import uuid
from keystoneclient.v3 import endpoints from keystoneclient.v3 import endpoints

View File

@@ -24,7 +24,6 @@ Installation script for python-keystoneclient's development virtualenv
""" """
import os import os
import subprocess
import sys import sys
import install_venv_common as install_venv import install_venv_common as install_venv

View File

@@ -27,11 +27,9 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
downloadcache = ~/cache/pip downloadcache = ~/cache/pip
[flake8] [flake8]
# F401: imported but unused
# F811: redefinition of unused 'client' from line 81 # F811: redefinition of unused 'client' from line 81
# F821: undefined name # F821: undefined name
# F841: local variable is assigned to but never used # F841: local variable is assigned to but never used
# F999: syntax error in doctest
# H201: no 'except:' at least use 'except Exception:' # H201: no 'except:' at least use 'except Exception:'
# H202: assertRaises Exception too broad # H202: assertRaises Exception too broad
# H302: import only modules # H302: import only modules
@@ -42,6 +40,6 @@ downloadcache = ~/cache/pip
# H403: multi line docstring end on new line # H403: multi line docstring end on new line
# H404: multi line docstring should start with a summary # H404: multi line docstring should start with a summary
# H802: git commit title # 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 show-source = True
exclude = .venv,.tox,dist,doc,*egg exclude = .venv,.tox,dist,doc,*egg