Even more pep8 fixes that the gate is catching

Change-Id: I825621d82bdc4e30a024b639f34e8be0d8593c17
This commit is contained in:
Mark Hamzy 2016-10-27 11:10:31 -05:00
parent 0b641d436e
commit 7efb4ae83a
11 changed files with 55 additions and 49 deletions

View File

@ -29,6 +29,7 @@ This is the MoltenIron server.
from __future__ import print_function
import argparse
import calendar
from datetime import datetime
import json
@ -37,25 +38,24 @@ import sys
import time
import traceback
import yaml
import argparse
from contextlib import contextmanager
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.exc import OperationalError
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.schema import MetaData, Table
from sqlalchemy.sql import insert, update, delete
from sqlalchemy.sql import and_
from sqlalchemy.types import TIMESTAMP
from sqlalchemy.schema import MetaData, Table
import sqlalchemy_utils
from sqlalchemy.exc import OperationalError
import collections # noqa
if (sys.version_info >= (3, 0)):
if sys.version_info >= (3, 0):
from http.server import HTTPServer, BaseHTTPRequestHandler # noqa
else:
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler # noqa
@ -166,7 +166,7 @@ class Nodes(declarative_base()):
# from sqlalchemy.dialects.mysql import INTEGER
# CREATE TABLE `Nodes` (
# id INTEGER NOT NULL AUTO_INCREMENT, #@TODO UNSIGNED
# id INTEGER NOT NULL AUTO_INCREMENT, #@TODO(hamzy) UNSIGNED
# name VARCHAR(50),
# ipmi_ip VARCHAR(50),
# ipmi_user VARCHAR(50),
@ -254,8 +254,9 @@ class IPs(declarative_base()):
__tablename__ = 'IPs'
# CREATE TABLE `IPs` (
# id INTEGER NOT NULL AUTO_INCREMENT, #@TODO INTEGER(unsigned=True)
# node_id INTEGER, #@TODO UNSIGNED
# id INTEGER NOT NULL AUTO_INCREMENT, #@TODO(hamzy) \
# INTEGER(unsigned=True)
# node_id INTEGER, #@TODO(hamzy) UNSIGNED
# ip VARCHAR(50),
# PRIMARY KEY (id),
# FOREIGN KEY(node_id) REFERENCES `Nodes` (id)
@ -293,7 +294,7 @@ TYPE_SQLITE = 3
TYPE_SQLITE_MEMORY = 4
class DataBase():
class DataBase(object):
"""This class may be used access the molten iron database. """
def __init__(self,
@ -546,10 +547,10 @@ class DataBase():
# and ("." in node_id):
check = isinstance(node_id, str)
if (sys.version_info < (3, 0)):
if sys.version_info < (3, 0):
check = check or isinstance(node_id, unicode) # noqa
if (check and ("." in node_id)):
if check and ("." in node_id):
# If an ipmi_ip was passed
query = query.filter_by(ipmi_ip=node_id)
else:
@ -744,11 +745,11 @@ class DataBase():
return {'status': 200}
def cull(self, maxSeconds):
"""If any node has been in use for longer than maxSeconds, deallocate
that node.
"""Deallocate old nodes.
Nodes that are deallocated in this way get their state set to "dirty".
They are also scheduled for cleaning.
If any node has been in use for longer than maxSeconds, deallocate
that node. Nodes that are deallocated in this way get their state set
to "dirty". They are also scheduled for cleaning.
"""
if DEBUG:
@ -845,7 +846,7 @@ class DataBase():
return {'status': 200}
# @TODO shouldn't it return allocation_pool rather than ipmi_ip?
# @TODO(hamzy) shouldn't it return allocation_pool rather than ipmi_ip?
def get_ips(self, owner_name):
"""Return all IPs allocated to a given node owner
@ -953,8 +954,9 @@ class DataBase():
return {'status': 200}
def setup_status(self):
"""Setup the status formatting strings depending on skipped elements,
lengths, and types.
"""Setup the status formatting strings.
Which depends on the skipped elements, lengths, and types.
"""
self.result_separator = "+"

View File

@ -23,11 +23,11 @@ Tests the addBMNode MoltenIron command.
from __future__ import print_function
import sys
import os
import yaml
import argparse
from molteniron import moltenirond
import os
import sys
import yaml
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Molteniron CLI tool")

View File

@ -23,11 +23,11 @@ Tests the MoltenIron allocateBM command.
from __future__ import print_function
import sys
import os
import yaml
import argparse
from molteniron import moltenirond
import os
import sys
import yaml
def compare_provisioned_nodes(lhs, rhs):

View File

@ -10,7 +10,7 @@ Tests the MoltenIron cull command.
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http: //www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@ -23,12 +23,12 @@ Tests the MoltenIron cull command.
from __future__ import print_function
import sys
import os
import yaml
import argparse
import time
from molteniron import moltenirond
import os
import sys
import time
import yaml
def compare_culled_nodes(lhs, rhs):

View File

@ -23,11 +23,11 @@ Tests the MoltenIron deallocateBM command.
from __future__ import print_function
import sys
import os
import yaml
import argparse
from molteniron import moltenirond
import os
import sys
import yaml
def compare_provisioned_nodes(lhs, rhs):

View File

@ -23,11 +23,11 @@ Tests the MoltenIron deallocateOwner command.
from __future__ import print_function
import sys
import os
import yaml
import argparse
from molteniron import moltenirond
import os
import sys
import yaml
def compare_provisioned_nodes(lhs, rhs):

View File

@ -23,11 +23,12 @@ Tests the MoltenIron doClean command.
from __future__ import print_function
import sys
import os
import yaml
import argparse
from molteniron import moltenirond
import os
import sys
import yaml
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Molteniron CLI tool")

View File

@ -23,11 +23,12 @@ Tests the MoltenIron get_field command.
from __future__ import print_function
import sys
import os
import yaml
import argparse
from molteniron import moltenirond
import os
import sys
import yaml
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Molteniron CLI tool")

View File

@ -23,11 +23,12 @@ Tests the MoltenIron get_ips command.
from __future__ import print_function
import sys
import os
import yaml
import argparse
from molteniron import moltenirond
import os
import sys
import yaml
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Molteniron CLI tool")

View File

@ -23,11 +23,12 @@ Tests the MoltenIron removeBMNode command.
from __future__ import print_function
import sys
import os
import yaml
import argparse
from molteniron import moltenirond
import os
import sys
import yaml
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Molteniron CLI tool")

View File

@ -73,7 +73,7 @@ commands = mkdir -p testenv/var/run/
stop
[testenv:pep8]
#commands = flake8 {posargs}
commands = flake8 {posargs}
[testenv:venv]
commands = {posargs}