Final pep8 fixes.

This commit is contained in:
Pino de Candia 2017-12-08 22:21:25 +00:00
parent b494661ad8
commit 4597a67e0c
9 changed files with 24 additions and 24 deletions

View File

@ -10,11 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from Crypto.PublicKey import RSA
import falcon
import json
import logging
import uuid
from Crypto.PublicKey import RSA
from tatu.db import models as db

View File

@ -91,6 +91,7 @@ castellan library, it is not meant for direct usage within tatu.
class TatuKeyManager(KeyManager):
"""Tatu specific key manager
This manager is a thin wrapper around the secret being stored. It is
intended for backward compatible use only. It will not store keys
or generate UUIDs but instead return the secret that is being stored.

View File

@ -10,13 +10,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from Crypto.PublicKey import RSA
from datetime import datetime
import falcon
import sqlalchemy as sa
import sshpubkeys
from Crypto.PublicKey import RSA
from datetime import datetime
from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.declarative import declarative_base
import sshpubkeys
from tatu.castellano import get_secret, store_secret
from tatu.utils import generateCert, random_uuid

View File

@ -23,9 +23,6 @@ def get_url():
class SQLAlchemySessionManager(object):
"""
Create scoped session for every request and close it when the request ends
"""
def __init__(self):
self.engine = create_engine(get_url())
@ -33,10 +30,12 @@ class SQLAlchemySessionManager(object):
self.Session = scoped_session(sessionmaker(self.engine))
def process_resource(self, req, resp, resource, params):
# Create a scoped session for every request
resource.session = self.Session()
def process_response(self, req, resp, resource, req_succeeded):
if hasattr(resource, 'session'):
if not req_succeeded:
resource.session.rollback()
# Close the scoped session when the request ends
self.Session.remove()

View File

@ -10,11 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from Crypto.PublicKey import RSA
import json
import requests
import sshpubkeys
import uuid
from Crypto.PublicKey import RSA
from tatu.utils import random_uuid

View File

@ -10,15 +10,15 @@
# License for the specific language governing permissions and limitations
# under the License.
import oslo_messaging
import sys
import time
import uuid
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging
from oslo_serialization import jsonutils
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
import sys
import time
import uuid
from tatu.db.models import createAuthority
from tatu.db.persistence import get_url
@ -65,7 +65,7 @@ class NotificationEndpoint(object):
def main():
logging.register_options(CONF)
log_levels = logging.get_default_log_levels() + \
['tatu=DEBUG', '__main__=DEBUG']
['tatu=DEBUG', '__main__=DEBUG']
logging.set_defaults(default_log_levels=log_levels)
logging.setup(CONF, DOMAIN)

View File

@ -9,14 +9,15 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from Crypto.PublicKey import RSA
import falcon
from falcon import testing
import json
import pytest
import sshpubkeys
import time
import uuid
from Crypto.PublicKey import RSA
from falcon import testing
from tatu.api.app import create_app
from tatu.db.persistence import SQLAlchemySessionManager

View File

@ -12,6 +12,7 @@
import os
import subprocess
from tempfile import NamedTemporaryFile
import uuid
@ -46,8 +47,6 @@ def generateCert(auth_key, entity_key, hostname=None, principals='root'):
cert = ''
with open(cert_file, 'r') as text_file:
cert = text_file.read()
#except Exception as e:
# print e
finally:
# Delete temporary files
for file in [ca_file, pub_file, cert_file]:

14
tox.ini
View File

@ -33,12 +33,16 @@ commands =
python setup.py testr --coverage --testr-args='{posargs}'
coverage report
[testenv:bandit]
# Skip B104 hardcoded_bind_all_interfaces
deps = -r{toxinidir}/test-requirements.txt
commands = bandit -r tatu -n5 -x tests -ll -s B104
[flake8]
# Following checks are ignored on purpose.
#
# H301 one import per line
# E251 unexpected spaces around keyword / parameter equals
# reason: no improvement in readability
ignore = E251,D100,D101,D102,D202,D208
ignore = E251,D100,D101,D102,D202,D208,H301
exclude = .git,.venv,.tox,dist,tools,doc,*egg,build
max-complexity=30
@ -48,7 +52,3 @@ deps =
pylint
commands =
pylint --rcfile=pylintrc --output-format=colorized
[hacking]
import_exceptions = dragonflow._i18n
local-check-factory = neutron_lib.hacking.checks.factory