Merge pull request #463 from python-zk/jeffwidman-pep8-imports
style: pep8 imports
This commit is contained in:
commit
622604bf2b
|
@ -1,11 +1,11 @@
|
|||
"""Kazoo Zookeeper Client"""
|
||||
import inspect
|
||||
import logging
|
||||
import re
|
||||
import warnings
|
||||
from collections import defaultdict, deque
|
||||
from functools import partial
|
||||
import inspect
|
||||
import logging
|
||||
from os.path import split
|
||||
import re
|
||||
import warnings
|
||||
|
||||
import six
|
||||
|
||||
|
@ -25,8 +25,7 @@ from kazoo.handlers.utils import capture_exceptions, wrap
|
|||
from kazoo.hosts import collect_hosts
|
||||
from kazoo.loggingsupport import BLATHER
|
||||
from kazoo.protocol.connection import ConnectionHandler
|
||||
from kazoo.protocol.paths import normpath
|
||||
from kazoo.protocol.paths import _prefix_root
|
||||
from kazoo.protocol.paths import _prefix_root, normpath
|
||||
from kazoo.protocol.serialization import (
|
||||
Auth,
|
||||
CheckVersion,
|
||||
|
@ -44,33 +43,27 @@ from kazoo.protocol.serialization import (
|
|||
Sync,
|
||||
Transaction
|
||||
)
|
||||
from kazoo.protocol.states import Callback
|
||||
from kazoo.protocol.states import EventType
|
||||
from kazoo.protocol.states import KazooState
|
||||
from kazoo.protocol.states import KeeperState
|
||||
from kazoo.protocol.states import WatchedEvent
|
||||
from kazoo.protocol.states import (
|
||||
Callback,
|
||||
EventType,
|
||||
KazooState,
|
||||
KeeperState,
|
||||
WatchedEvent
|
||||
)
|
||||
from kazoo.retry import KazooRetry
|
||||
from kazoo.security import ACL
|
||||
from kazoo.security import OPEN_ACL_UNSAFE
|
||||
from kazoo.security import ACL, OPEN_ACL_UNSAFE
|
||||
|
||||
# convenience API
|
||||
from kazoo.recipe.barrier import Barrier
|
||||
from kazoo.recipe.barrier import DoubleBarrier
|
||||
from kazoo.recipe.barrier import Barrier, DoubleBarrier
|
||||
from kazoo.recipe.counter import Counter
|
||||
from kazoo.recipe.election import Election
|
||||
from kazoo.recipe.lease import NonBlockingLease
|
||||
from kazoo.recipe.lease import MultiNonBlockingLease
|
||||
from kazoo.recipe.lock import Lock
|
||||
from kazoo.recipe.lock import ReadLock
|
||||
from kazoo.recipe.lock import WriteLock
|
||||
from kazoo.recipe.lock import Semaphore
|
||||
from kazoo.recipe.lease import NonBlockingLease, MultiNonBlockingLease
|
||||
from kazoo.recipe.lock import Lock, ReadLock, WriteLock, Semaphore
|
||||
from kazoo.recipe.partitioner import SetPartitioner
|
||||
from kazoo.recipe.party import Party
|
||||
from kazoo.recipe.party import ShallowParty
|
||||
from kazoo.recipe.queue import Queue
|
||||
from kazoo.recipe.queue import LockingQueue
|
||||
from kazoo.recipe.watchers import ChildrenWatch
|
||||
from kazoo.recipe.watchers import DataWatch
|
||||
from kazoo.recipe.party import Party, ShallowParty
|
||||
from kazoo.recipe.queue import Queue, LockingQueue
|
||||
from kazoo.recipe.watchers import ChildrenWatch, DataWatch
|
||||
|
||||
|
||||
string_types = six.string_types
|
||||
bytes_types = (six.binary_type,)
|
||||
|
|
|
@ -4,8 +4,6 @@ from __future__ import absolute_import
|
|||
import contextlib
|
||||
import logging
|
||||
|
||||
import kazoo.python2atexit as python2atexit
|
||||
|
||||
import eventlet
|
||||
from eventlet.green import select as green_select
|
||||
from eventlet.green import socket as green_socket
|
||||
|
@ -14,6 +12,8 @@ from eventlet.green import threading as green_threading
|
|||
from eventlet import queue as green_queue
|
||||
|
||||
from kazoo.handlers import utils
|
||||
import kazoo.python2atexit as python2atexit
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -4,14 +4,13 @@ from __future__ import absolute_import
|
|||
import logging
|
||||
|
||||
import gevent
|
||||
from gevent import socket
|
||||
import gevent.event
|
||||
import gevent.queue
|
||||
import gevent.select
|
||||
import gevent.thread
|
||||
|
||||
from gevent.queue import Empty
|
||||
from gevent.queue import Queue
|
||||
from gevent import socket
|
||||
import gevent.select
|
||||
import gevent.thread
|
||||
try:
|
||||
from gevent.lock import Semaphore, RLock
|
||||
except ImportError:
|
||||
|
@ -20,6 +19,7 @@ except ImportError:
|
|||
from kazoo.handlers import utils
|
||||
from kazoo import python2atexit
|
||||
|
||||
|
||||
_using_libevent = gevent.__version__.startswith('0.')
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
@ -12,25 +12,25 @@ environments that use threads.
|
|||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from collections import defaultdict
|
||||
import errno
|
||||
from itertools import chain
|
||||
import logging
|
||||
import select
|
||||
import socket
|
||||
import threading
|
||||
import time
|
||||
|
||||
import six
|
||||
|
||||
from collections import defaultdict
|
||||
from itertools import chain
|
||||
|
||||
import kazoo.python2atexit as python2atexit
|
||||
from kazoo.handlers import utils
|
||||
|
||||
try:
|
||||
import Queue
|
||||
except ImportError: # pragma: nocover
|
||||
import queue as Queue
|
||||
|
||||
from kazoo.handlers import utils
|
||||
|
||||
# sentinel objects
|
||||
_STOP = object()
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
"""Zookeeper Protocol Connection Handler"""
|
||||
from binascii import hexlify
|
||||
from contextlib import contextmanager
|
||||
import logging
|
||||
import random
|
||||
import select
|
||||
import socket
|
||||
|
||||
import sys
|
||||
import time
|
||||
from binascii import hexlify
|
||||
from contextlib import contextmanager
|
||||
|
||||
from kazoo.exceptions import (
|
||||
AuthFailedError,
|
||||
|
@ -41,6 +40,7 @@ from kazoo.retry import (
|
|||
RetryFailedError
|
||||
)
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
from collections import namedtuple
|
||||
import struct
|
||||
|
||||
import six
|
||||
|
||||
from kazoo.exceptions import EXCEPTIONS
|
||||
from kazoo.protocol.states import ZnodeStat
|
||||
from kazoo.security import ACL
|
||||
from kazoo.security import Id
|
||||
|
||||
import six
|
||||
|
||||
# Struct objects with formats compiled
|
||||
bool_struct = struct.Struct('B')
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
"""Uses the old atexit with added unregister for python 2.x
|
||||
and the new atexit for python 3.x
|
||||
"""
|
||||
|
||||
import sys
|
||||
import atexit
|
||||
import sys
|
||||
|
||||
|
||||
__all__ = ["register", "unregister"]
|
||||
|
||||
|
|
|
@ -8,10 +8,8 @@ import os
|
|||
import socket
|
||||
import uuid
|
||||
|
||||
from kazoo.exceptions import KazooException, NoNodeError, NodeExistsError
|
||||
from kazoo.protocol.states import EventType
|
||||
from kazoo.exceptions import KazooException
|
||||
from kazoo.exceptions import NoNodeError
|
||||
from kazoo.exceptions import NodeExistsError
|
||||
|
||||
|
||||
class Barrier(object):
|
||||
|
|
|
@ -10,14 +10,13 @@ of a subtree in ZooKeeper and keeps it up-to-date.
|
|||
|
||||
See also: http://curator.apache.org/curator-recipes/tree-cache.html
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
import logging
|
||||
import contextlib
|
||||
import functools
|
||||
import logging
|
||||
import operator
|
||||
import os
|
||||
|
||||
from kazoo.exceptions import NoNodeError, KazooException
|
||||
from kazoo.protocol.states import KazooState, EventType
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
:Status: Unknown
|
||||
|
||||
"""
|
||||
|
||||
from kazoo.exceptions import BadVersionError
|
||||
from kazoo.retry import ForceRetryError
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
:Status: Beta
|
||||
|
||||
"""
|
||||
|
||||
import datetime
|
||||
import json
|
||||
import socket
|
||||
import datetime
|
||||
|
||||
from kazoo.exceptions import CancelledError
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ changes and re-act appropriately. In the event that a
|
|||
and/or the lease has been lost.
|
||||
|
||||
"""
|
||||
|
||||
import sys
|
||||
try:
|
||||
from time import monotonic as now
|
||||
|
@ -24,16 +23,18 @@ import uuid
|
|||
|
||||
import six
|
||||
|
||||
from kazoo.retry import (
|
||||
KazooRetry,
|
||||
RetryFailedError,
|
||||
ForceRetryError
|
||||
from kazoo.exceptions import (
|
||||
CancelledError,
|
||||
KazooException,
|
||||
LockTimeout,
|
||||
NoNodeError
|
||||
)
|
||||
from kazoo.exceptions import CancelledError
|
||||
from kazoo.exceptions import KazooException
|
||||
from kazoo.exceptions import LockTimeout
|
||||
from kazoo.exceptions import NoNodeError
|
||||
from kazoo.protocol.states import KazooState
|
||||
from kazoo.retry import (
|
||||
ForceRetryError,
|
||||
KazooRetry,
|
||||
RetryFailedError
|
||||
)
|
||||
|
||||
|
||||
class _Watch(object):
|
||||
|
|
|
@ -17,15 +17,16 @@ Example Use-Case
|
|||
so that no two workers own the same queue.
|
||||
|
||||
"""
|
||||
from functools import partial
|
||||
import logging
|
||||
import os
|
||||
import socket
|
||||
from functools import partial
|
||||
|
||||
from kazoo.exceptions import KazooException, LockTimeout
|
||||
from kazoo.protocol.states import KazooState
|
||||
from kazoo.recipe.watchers import PatientChildrenWatch
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
See: https://github.com/python-zk/kazoo/issues/175
|
||||
|
||||
"""
|
||||
|
||||
import uuid
|
||||
|
||||
from kazoo.exceptions import NoNodeError, NodeExistsError
|
||||
from kazoo.retry import ForceRetryError
|
||||
from kazoo.protocol.states import EventType
|
||||
from kazoo.retry import ForceRetryError
|
||||
|
||||
|
||||
class BaseQueue(object):
|
||||
|
|
|
@ -10,18 +10,19 @@
|
|||
will result in an exception being thrown.
|
||||
|
||||
"""
|
||||
from functools import partial, wraps
|
||||
import logging
|
||||
import time
|
||||
import warnings
|
||||
from functools import partial, wraps
|
||||
|
||||
from kazoo.retry import KazooRetry
|
||||
from kazoo.exceptions import (
|
||||
ConnectionClosedError,
|
||||
NoNodeError,
|
||||
KazooException
|
||||
)
|
||||
from kazoo.protocol.states import KazooState
|
||||
from kazoo.retry import KazooRetry
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ from kazoo.exceptions import (
|
|||
SessionExpiredError,
|
||||
)
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ class ACL(namedtuple('ACL', 'perms id')):
|
|||
a :class:`Permissions` setting. For convenience,
|
||||
:meth:`make_digest_acl` should be used to create an ACL object with
|
||||
the desired scheme, id, and permissions.
|
||||
|
||||
"""
|
||||
@property
|
||||
def acl_list(self):
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from kazoo.testing.harness import KazooTestCase
|
||||
from kazoo.testing.harness import KazooTestHarness
|
||||
from kazoo.testing.harness import KazooTestCase, KazooTestHarness
|
||||
|
||||
|
||||
__all__ = ('KazooTestHarness', 'KazooTestCase', )
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
|
||||
import code
|
||||
from collections import namedtuple
|
||||
from glob import glob
|
||||
from itertools import chain
|
||||
import logging
|
||||
import os
|
||||
import os.path
|
||||
|
@ -30,10 +33,6 @@ import subprocess
|
|||
import tempfile
|
||||
import traceback
|
||||
|
||||
from itertools import chain
|
||||
from collections import namedtuple
|
||||
from glob import glob
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
"""Kazoo testing harnesses"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import uuid
|
||||
import unittest
|
||||
|
||||
from kazoo import python2atexit as atexit
|
||||
|
||||
from kazoo.client import KazooClient
|
||||
from kazoo.exceptions import KazooException
|
||||
from kazoo.protocol.connection import _CONNECTION_DROP, _SESSION_EXPIRED
|
||||
from kazoo.protocol.states import (
|
||||
KazooState
|
||||
)
|
||||
from kazoo.testing.common import ZookeeperCluster
|
||||
from kazoo.protocol.connection import _CONNECTION_DROP, _SESSION_EXPIRED
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
Loading…
Reference in New Issue