Make monasca-common pep8 compatible
Cleaned up test-requirements.txt in order to use the latest hacking package. Removed the ignored pep8 checks and made the code pass all of them. Also removed the OpenStack Foundation copyright notice that was put there accidentally before. Change-Id: I3d287eb71fc2bf0e4d52856c11cbc8a347cac2ed
This commit is contained in:
parent
7d756be916
commit
c98478df18
@ -54,6 +54,7 @@ class KafkaConsumer(object):
|
|||||||
commit_callback=None,
|
commit_callback=None,
|
||||||
commit_timeout=30):
|
commit_timeout=30):
|
||||||
"""Init
|
"""Init
|
||||||
|
|
||||||
kafka_url - Kafka location
|
kafka_url - Kafka location
|
||||||
zookeeper_url - Zookeeper location
|
zookeeper_url - Zookeeper location
|
||||||
zookeeper_path - Zookeeper path used for partition
|
zookeeper_path - Zookeeper path used for partition
|
||||||
@ -151,7 +152,9 @@ class KafkaConsumer(object):
|
|||||||
return not self._set_partitioner.acquired
|
return not self._set_partitioner.acquired
|
||||||
|
|
||||||
def _partition(self):
|
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
|
allow multiple consumer processes to negotiate access to the kafka
|
||||||
partitions
|
partitions
|
||||||
"""
|
"""
|
||||||
|
@ -13,20 +13,23 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
import kafka.client
|
|
||||||
import kafka.producer
|
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import kafka.client
|
||||||
|
import kafka.producer
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class KafkaProducer(object):
|
class KafkaProducer(object):
|
||||||
"""Adds messages to a kafka topic
|
"""Adds messages to a kafka topic
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, url):
|
def __init__(self, url):
|
||||||
"""Init
|
"""Init
|
||||||
|
|
||||||
url - kafka connection details
|
url - kafka connection details
|
||||||
"""
|
"""
|
||||||
self._kafka = kafka.client.KafkaClient(url)
|
self._kafka = kafka.client.KafkaClient(url)
|
||||||
@ -38,6 +41,7 @@ class KafkaProducer(object):
|
|||||||
|
|
||||||
def publish(self, topic, messages, key=None):
|
def publish(self, topic, messages, key=None):
|
||||||
"""Takes messages and puts them on the supplied kafka topic
|
"""Takes messages and puts them on the supplied kafka topic
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not isinstance(messages, list):
|
if not isinstance(messages, list):
|
||||||
|
@ -12,9 +12,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import ujson as json
|
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
import ujson as json
|
||||||
|
|
||||||
from monasca_common.rest import exceptions
|
from monasca_common.rest import exceptions
|
||||||
|
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
# Copyright (c) 2016 OpenStack Foundation
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
# Copyright 2016 OpenStack Foundation
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
# Hacking already pins down pep8, pyflakes and flake8
|
# 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
|
Babel>=1.3
|
||||||
coverage>=3.6
|
coverage>=3.6
|
||||||
discover
|
discover
|
||||||
fixtures>=0.3.14
|
fixtures>=0.3.14
|
||||||
flake8==2.1.0
|
|
||||||
pep8<=1.5.6
|
|
||||||
httplib2>=0.7.5
|
httplib2>=0.7.5
|
||||||
mock>=1.0
|
mock>=1.0
|
||||||
mox>=0.5.3
|
mox>=0.5.3
|
||||||
|
1
tox.ini
1
tox.ini
@ -27,6 +27,5 @@ commands = {posargs}
|
|||||||
max-complexity = 50
|
max-complexity = 50
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
builtins = _
|
builtins = _
|
||||||
ignore = F821,H201,H302,H305,H307,H405,H904
|
|
||||||
exclude=.venv,.git,.tox,dist,*openstack/common*,*egg,build
|
exclude=.venv,.git,.tox,dist,*openstack/common*,*egg,build
|
||||||
show-source = True
|
show-source = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user