Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

big whitespace-focused pep8 update

pep8.py 1.3.3 shows a lot more than 1.1 >_<

Change-Id: I05959084efe1970e1bdd0185583ea681aa115766
Reviewed-on: http://review.couchbase.org/19089
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Benjamin Young <benjamin@couchbase.com>
  • Loading branch information...
commit 3335d9302c0b4f2ce61377439eb8cdfa6eb10e05 1 parent 18a341d
@BigBlueHat BigBlueHat authored BigBlueHat committed
View
2  couchbase/client.py
@@ -98,7 +98,7 @@ def _start_streaming(self):
nodes = data["nodes"]
for node in nodes:
if (node["clusterMembership"] == "active" and
- node["status"] in ["healthy", "warmup"]):
+ node["status"] in ["healthy", "warmup"]):
ip, port = node["hostname"].split(":")
couch_api_base = node.get("couchApiBase")
new_servers.append({"ip": ip,
View
29 couchbase/constants.py
@@ -168,21 +168,20 @@ class MemcachedConstants(object):
# The header sizes don't deviate
assert struct.calcsize(REQ_PKT_FMT) == struct.calcsize(RES_PKT_FMT)
- EXTRA_HDR_FMTS = {
- CMD_SET: SET_PKT_FMT,
- CMD_ADD: SET_PKT_FMT,
- CMD_REPLACE: SET_PKT_FMT,
- CMD_INCR: INCRDECR_PKT_FMT,
- CMD_DECR: INCRDECR_PKT_FMT,
- CMD_DELETE: DEL_PKT_FMT,
- CMD_FLUSH: FLUSH_PKT_FMT,
- CMD_TAP_MUTATION: TAP_MUTATION_PKT_FMT,
- CMD_TAP_DELETE: TAP_GENERAL_PKT_FMT,
- CMD_TAP_FLUSH: TAP_GENERAL_PKT_FMT,
- CMD_TAP_OPAQUE: TAP_GENERAL_PKT_FMT,
- CMD_TAP_VBUCKET_SET: TAP_GENERAL_PKT_FMT,
- CMD_SET_VBUCKET_STATE: VB_SET_PKT_FMT,
- }
+ EXTRA_HDR_FMTS = {CMD_SET: SET_PKT_FMT,
+ CMD_ADD: SET_PKT_FMT,
+ CMD_REPLACE: SET_PKT_FMT,
+ CMD_INCR: INCRDECR_PKT_FMT,
+ CMD_DECR: INCRDECR_PKT_FMT,
+ CMD_DELETE: DEL_PKT_FMT,
+ CMD_FLUSH: FLUSH_PKT_FMT,
+ CMD_TAP_MUTATION: TAP_MUTATION_PKT_FMT,
+ CMD_TAP_DELETE: TAP_GENERAL_PKT_FMT,
+ CMD_TAP_FLUSH: TAP_GENERAL_PKT_FMT,
+ CMD_TAP_OPAQUE: TAP_GENERAL_PKT_FMT,
+ CMD_TAP_VBUCKET_SET: TAP_GENERAL_PKT_FMT,
+ CMD_SET_VBUCKET_STATE: VB_SET_PKT_FMT,
+ }
EXTRA_HDR_SIZES = dict(
[(k, struct.calcsize(v)) for (k, v) in EXTRA_HDR_FMTS.items()])
View
8 couchbase/couchbaseclient.py
@@ -58,7 +58,7 @@ def __init__(self, url, bucket, password="", verbose=False):
raise InvalidArgumentException("url can not be an empty string",
parameters="url")
if (url.find("http://") != -1 and url.rfind(":") != -1 and
- url.find("/pools/default") != -1):
+ url.find("/pools/default") != -1):
server["ip"] = (url[url.find("http://")
+ len("http://"):url.rfind(":")])
server["port"] = url[url.rfind(":") + 1:url.find("/pools/default")]
@@ -125,7 +125,7 @@ def _start_streaming(self):
index = 0
if 'vBucketMapForward' in data['vBucketServerMap']:
for vbucket in\
- data['vBucketServerMap']['vBucketMapForward']:
+ data['vBucketServerMap']['vBucketMapForward']:
vbucketmapfastforward[index] =\
serverlist[vbucket[0]]
index += 1
@@ -151,7 +151,7 @@ def _start_streaming(self):
nodes = data["nodes"]
for node in nodes:
if (node["clusterMembership"] == "active" and
- node["status"] in ["healthy", "warmup"]):
+ node["status"] in ["healthy", "warmup"]):
ip, port = node["hostname"].split(":")
new_servers.append({"ip": ip,
"port": port,
@@ -652,7 +652,7 @@ def direct_client(rest, ip, port, bucket):
int(port))
else:
client = VBucketAwareClient(ip.encode('ascii', 'ignore'),
- int(port))
+ int(port))
client.vbucket_count = vbucket_count
client.sasl_auth_plain(bucket_info.name.encode('ascii'),
bucket_info.saslPassword
View
18 couchbase/memcachedclient.py
@@ -69,18 +69,18 @@ def _recvMsg(self):
- len(response))
if data == '':
raise EOFError("Got empty data (remote died?)."
- " from %s" % (self.host))
+ " from %s" % (self.host))
response += data
assert len(response) == MemcachedConstants.MIN_RECV_PACKET
magic, cmd, keylen, extralen, dtype, errcode, remaining, opaque, cas =\
- struct.unpack(MemcachedConstants.RES_PKT_FMT, response)
+ struct.unpack(MemcachedConstants.RES_PKT_FMT, response)
rv = ""
while remaining > 0:
data = self.s.recv(remaining)
if data == '':
raise EOFError("Got empty data (remote died?)."
- " from %s" % (self.host))
+ " from %s" % (self.host))
rv += data
remaining -= len(data)
@@ -92,7 +92,7 @@ def _recvMsg(self):
def _handleKeyedResponse(self, myopaque):
cmd, errcode, opaque, cas, keylen, extralen, rv = self._recvMsg()
assert myopaque is None or opaque == myopaque, \
- "expected opaque %x, got %x" % (myopaque, opaque)
+ "expected opaque %x, got %x" % (myopaque, opaque)
if errcode:
raise MemcachedError(errcode, rv)
return cmd, opaque, cas, keylen, extralen, rv
@@ -128,7 +128,7 @@ def __incrdecr(self, cmd, key, amt, init, exp):
something, cas, val =\
self._doCmd(cmd, key, '',
struct.pack(MemcachedConstants.INCRDECR_PKT_FMT,
- amt, init, exp))
+ amt, init, exp))
return struct.unpack(MemcachedConstants.INCRDECR_RES_FMT, val)[0], cas
def incr(self, key, amt=1, init=0, exp=0, vbucket=-1):
@@ -379,16 +379,16 @@ def sync_replication(self, numReplicas, keyspecs):
return opaque, cas, self._parse_sync_response(data)
def sync_replication_or_persistence(self, numReplicas, keyspecs):
- payload = self._build_sync_payload(((numReplicas & 0x0f) << 4) |
- 0x8, keyspecs)
+ payload = self._build_sync_payload(((numReplicas & 0x0f) << 4) | 0x8,
+ keyspecs)
opaque, cas, data = self._doCmd(MemcachedConstants.CMD_SYNC, "",
payload)
return opaque, cas, self._parse_sync_response(data)
def sync_replication_and_persistence(self, numReplicas, keyspecs):
- payload = self._build_sync_payload(((numReplicas & 0x0f) << 4) |
- 0xA, keyspecs)
+ payload = self._build_sync_payload(((numReplicas & 0x0f) << 4) | 0xA,
+ keyspecs)
opaque, cas, data = self._doCmd(MemcachedConstants.CMD_SYNC, "",
payload)
View
5 couchbase/migrator/migrator_couchbase.py
@@ -17,8 +17,9 @@
sources = [{'type':'couchbase', 'class':'CouchbaseReader',
'example':'couchbase://bucket:password@example.com:8091/bucket'}]
-destinations = [{'type':'couchbase', 'class':'CouchbaseWriter',\
- 'example': 'couchbase://bucket:password@example.com:8091/bucket'}]
+destinations = [{'type':'couchbase', 'class':'CouchbaseWriter',
+ 'example':
+ 'couchbase://bucket:password@example.com:8091/bucket'}]
from urlparse import urlparse
import urllib
View
22 couchbase/rest_client.py
@@ -256,8 +256,8 @@ def view_results(self, bucket, design_doc, view, params, limit=100):
num_params += 1
if param in ["key", "start_key", "end_key",
"startkey_docid", "endkey_docid"] or \
- params[param] is True or \
- params[param] is False:
+ params[param] is True or \
+ params[param] is False:
api += "%s=%s" % (param, json.dumps(params[param]))
else:
api += "%s=%s" % (param, params[param])
@@ -285,8 +285,8 @@ def _create_headers(self):
authorization = base64.encodestring('%s:%s' % (self.username,
self.password))
return {'Content-Type': 'application/x-www-form-urlencoded',
- 'Authorization': 'Basic %s' % authorization,
- 'Accept': '*/*'}
+ 'Authorization': 'Basic %s' % authorization,
+ 'Accept': '*/*'}
def _http_request(self, api, method='GET', params='', headers=None,
timeout=120):
@@ -336,8 +336,8 @@ def _http_request(self, api, method='GET', params='', headers=None,
#returns otpNode
def add_node(self, user='', password='', remoteIp='', port='8091'):
otpNode = None
- log.info('adding remote node : %s to this cluster @ : %s'\
- % (remoteIp, self.ip))
+ log.info('adding remote node : %s to this cluster @ : %s'
+ % (remoteIp, self.ip))
api = self.baseUrl + 'controller/addNode'
params = urllib.urlencode({'hostname': "%s:%s" % (remoteIp, port),
'user': user,
@@ -883,9 +883,9 @@ def __init__(self):
def __str__(self):
return '%s' % ({'type': self.type,
- 'path': self.path,
- 'quotaMb': self.quotaMb,
- 'state': self.state})
+ 'path': self.path,
+ 'quotaMb': self.quotaMb,
+ 'state': self.state})
class NodeDiskStorage(object):
@@ -993,7 +993,7 @@ def parse_get_nodes_response(self, parsed):
#let's assume there is only one disk in each noce
dict_parsed = parsed['availableStorage']
if 'path' in dict_parsed and 'sizeKBytes' in dict_parsed and\
- 'usagePercent' in dict_parsed:
+ 'usagePercent' in dict_parsed:
diskStorage = NodeDiskStorage()
diskStorage.path = dict_parsed['path']
diskStorage.sizeKBytes = dict_parsed['sizeKBytes']
@@ -1008,7 +1008,7 @@ def parse_get_nodes_response(self, parsed):
disk_storage_list = storage[key]
for dict_parsed in disk_storage_list:
if 'path' in dict_parsed and 'state' in dict_parsed and\
- 'quotaMb' in dict_parsed:
+ 'quotaMb' in dict_parsed:
dataStorage = NodeDataStorage()
dataStorage.path = dict_parsed['path']
dataStorage.quotaMb = dict_parsed['quotaMb']
View
2  couchbase/tests/test_client.py
@@ -113,7 +113,7 @@ class BucketTest(Base):
def setUp(self):
super(BucketTest, self).setUp()
self.cb = Couchbase(self.host + ':' + self.port, self.username,
- self.password)
+ self.password)
self.client = self.cb[self.bucket_name]
@attr(cbv="1.0.0")
View
19 couchbase/tests/test_readme_examples.py
@@ -48,8 +48,8 @@ def test_old_unified_client_example(self):
# connect to a couchbase server
cb = Couchbase(self.host + ':' + self.port,
- username=self.username,
- password=self.password)
+ username=self.username,
+ password=self.password)
# create default bucket if it doesn't exist
#try:
@@ -97,15 +97,14 @@ def test_old_unified_client_example(self):
'$flags': 25})
print doc_id + ' ' + str(newbucket[doc_id])
- design = {
- "_id": "_design/testing",
- "language": "javascript",
- "views": {
- "all": {
- "map": '''function (doc) {\n emit(doc, null);\n}'''
+ design = {"_id": "_design/testing",
+ "language": "javascript",
+ "views":
+ {"all":
+ {"map": '''function (doc) {\n emit(doc, null);\n}'''
},
- },
- }
+ },
+ }
# save a design document
# right now with no _rev, we can only create, we can't update
try:
View
12 couchbase/tests/test_restclient.py
@@ -120,12 +120,12 @@ def setup_create_design_doc(self):
raise SkipTest
ddoc_name = uuid.uuid4()
design_doc = json.dumps({"views":
- {"testing":
- {"map":
- "function(doc) { emit(doc._id, null); }"
- }
- }
- })
+ {"testing":
+ {"map":
+ "function(doc) { emit(doc._id, null); }"
+ }
+ }
+ })
resp = self.rest.create_design_doc(self.bucket_name, ddoc_name,
design_doc)
self.design_docs.append(ddoc_name)
View
19 couchbase/utils/couchbase-migrator.py
@@ -88,16 +88,15 @@ def __init__(self):
def parse_args(argv):
config = Config()
try:
- opts, args = getopt.getopt(argv[1:],
- 'hs:d:ovq', [
- 'help',
- 'source=',
- 'destination=',
- 'overwrite',
- 'dry-run',
- 'verbose',
- 'quiet',
- ])
+ opts, args = getopt.getopt(argv[1:], 'hs:d:ovq',
+ ['help',
+ 'source=',
+ 'destination=',
+ 'overwrite',
+ 'dry-run',
+ 'verbose',
+ 'quiet',
+ ])
for o, a in opts:
if o == '-h' or o == '--help':
usage()
Please sign in to comment.
Something went wrong with that request. Please try again.