Merge "Make monasca-common pep8 compatible"

This commit is contained in:
Jenkins 2016-06-16 23:13:56 +00:00 committed by Gerrit Code Review
commit 3e27d3fea4
7 changed files with 21 additions and 23 deletions

View File

@ -54,6 +54,7 @@ class KafkaConsumer(object):
commit_callback=None,
commit_timeout=30):
"""Init
kafka_url - Kafka location
zookeeper_url - Zookeeper location
zookeeper_path - Zookeeper path used for partition
@ -151,7 +152,9 @@ class KafkaConsumer(object):
return not self._set_partitioner.acquired
def _partition(self):
"""Consume messages from kafka using the Kazoo SetPartitioner to
"""Consume messages from kafka
Consume messages from kafka using the Kazoo SetPartitioner to
allow multiple consumer processes to negotiate access to the kafka
partitions
"""

View File

@ -13,20 +13,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import kafka.client
import kafka.producer
import logging
import time
import kafka.client
import kafka.producer
log = logging.getLogger(__name__)
class KafkaProducer(object):
"""Adds messages to a kafka topic
"""
def __init__(self, url):
"""Init
url - kafka connection details
"""
self._kafka = kafka.client.KafkaClient(url)
@ -38,6 +41,7 @@ class KafkaProducer(object):
def publish(self, topic, messages, key=None):
"""Takes messages and puts them on the supplied kafka topic
"""
if not isinstance(messages, list):

View File

@ -12,9 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import ujson as json
import six
import ujson as json
from monasca_common.rest import exceptions

View File

@ -1,17 +1,14 @@
# Copyright (c) 2016 OpenStack Foundation
# All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# Licensed under the Apache License, Version 2.0 (the "License"); 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, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import mock
import unittest

View File

@ -1,5 +1,3 @@
# Copyright 2016 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at

View File

@ -1,11 +1,9 @@
# Hacking already pins down pep8, pyflakes and flake8
hacking>=0.9.2,<0.10
hacking>=0.11.0,<0.12 # Apache-2.0
Babel>=1.3
coverage>=3.6
discover
fixtures>=0.3.14
flake8==2.1.0
pep8<=1.5.6
httplib2>=0.7.5
mock>=1.0
mox>=0.5.3

View File

@ -27,6 +27,5 @@ commands = {posargs}
max-complexity = 50
max-line-length = 120
builtins = _
ignore = F821,H201,H302,H305,H307,H405,H904
exclude=.venv,.git,.tox,dist,*openstack/common*,*egg,build
show-source = True