Additional flake8 cleanup

The flake8 command was identifying several warnings and errors. This change
addresses the flake8 warnings and updates the setup.cfg with additional
exclusions. If accepted, jenkins will be updated to use the flake8 command,
rather than using the django_jenkins plugin. This will expedite jenkins
testing.
This commit is contained in:
James Laska
2015-05-20 15:26:44 -04:00
parent 71fc2320d0
commit 7064c9bed4
12 changed files with 77 additions and 104 deletions

View File

@@ -36,11 +36,8 @@ import json
import logging
import os
import pwd
import sys
import urllib
import urlparse
import time
from contextlib import closing
# Requests
import requests

View File

@@ -32,7 +32,6 @@
import sys
import time
import datetime
import json
from copy import deepcopy
from ansible import constants as C
from ansible.cache.base import BaseCacheModule

View File

@@ -4,10 +4,10 @@
# This file is a utility script that is not part of the AWX or Ansible
# packages. It does not import any code from either package, nor does its
# license apply to Ansible or AWX.
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
@@ -61,7 +61,7 @@ class TokenAuth(requests.auth.AuthBase):
return request
class InventoryScript(object):
def __init__(self, **options):
self.options = options
@@ -95,11 +95,11 @@ class InventoryScript(object):
def run(self):
try:
self.base_url = self.options.get('base_url', '') or \
os.getenv('REST_API_URL', '')
os.getenv('REST_API_URL', '')
if not self.base_url:
raise ValueError('No REST API URL specified')
self.auth_token = self.options.get('authtoken', '') or \
os.getenv('REST_API_TOKEN', '')
os.getenv('REST_API_TOKEN', '')
parts = urlparse.urlsplit(self.base_url)
if not (parts.username and parts.password) and not self.auth_token:
raise ValueError('No username/password specified in REST API '
@@ -107,7 +107,7 @@ class InventoryScript(object):
try:
# Command line argument takes precedence over environment
# variable.
self.inventory_id = int(self.options.get('inventory_id', 0) or \
self.inventory_id = int(self.options.get('inventory_id', 0) or
os.getenv('INVENTORY_ID', 0))
except ValueError:
raise ValueError('Inventory ID must be an integer')

View File

@@ -84,7 +84,7 @@ class ServiceScanService(BaseService):
else:
pid = None
else:
pid = None
pid = None # NOQA
payload = {"name": service_name, "state": service_state, "goal": service_goal, "source": "upstart"}
services.append(payload)
@@ -104,7 +104,7 @@ class ServiceScanService(BaseService):
service_state = "dead"
elif len(line_data) == 3:
service_name = line_data[0]
service_pid = None
service_pid = None # NOQA
service_state = "stopped"
else:
continue