Skip to content

Commit c7dfcd9

Browse files
committed
fix naming convention
1 parent 41cef47 commit c7dfcd9

File tree

17 files changed

+232
-232
lines changed

17 files changed

+232
-232
lines changed

redis/commands/bf/__init__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,70 +18,70 @@ class AbstractBloom(object):
1818
"""
1919

2020
@staticmethod
21-
def appendItems(params, items):
21+
def append_items(params, items):
2222
"""Append ITEMS to params."""
2323
params.extend(["ITEMS"])
2424
params += items
2525

2626
@staticmethod
27-
def appendError(params, error):
27+
def append_error(params, error):
2828
"""Append ERROR to params."""
2929
if error is not None:
3030
params.extend(["ERROR", error])
3131

3232
@staticmethod
33-
def appendCapacity(params, capacity):
33+
def append_capacity(params, capacity):
3434
"""Append CAPACITY to params."""
3535
if capacity is not None:
3636
params.extend(["CAPACITY", capacity])
3737

3838
@staticmethod
39-
def appendExpansion(params, expansion):
39+
def append_expansion(params, expansion):
4040
"""Append EXPANSION to params."""
4141
if expansion is not None:
4242
params.extend(["EXPANSION", expansion])
4343

4444
@staticmethod
45-
def appendNoScale(params, noScale):
45+
def append_no_scale(params, noScale):
4646
"""Append NONSCALING tag to params."""
4747
if noScale is not None:
4848
params.extend(["NONSCALING"])
4949

5050
@staticmethod
51-
def appendWeights(params, weights):
51+
def append_weights(params, weights):
5252
"""Append WEIGHTS to params."""
5353
if len(weights) > 0:
5454
params.append("WEIGHTS")
5555
params += weights
5656

5757
@staticmethod
58-
def appendNoCreate(params, noCreate):
58+
def append_no_create(params, noCreate):
5959
"""Append NOCREATE tag to params."""
6060
if noCreate is not None:
6161
params.extend(["NOCREATE"])
6262

6363
@staticmethod
64-
def appendItemsAndIncrements(params, items, increments):
64+
def append_items_and_increments(params, items, increments):
6565
"""Append pairs of items and increments to params."""
6666
for i in range(len(items)):
6767
params.append(items[i])
6868
params.append(increments[i])
6969

7070
@staticmethod
71-
def appendValuesAndWeights(params, items, weights):
71+
def append_values_and_weights(params, items, weights):
7272
"""Append pairs of items and weights to params."""
7373
for i in range(len(items)):
7474
params.append(items[i])
7575
params.append(weights[i])
7676

7777
@staticmethod
78-
def appendMaxIterations(params, max_iterations):
78+
def append_max_iterations(params, max_iterations):
7979
"""Append MAXITERATIONS to params."""
8080
if max_iterations is not None:
8181
params.extend(["MAXITERATIONS", max_iterations])
8282

8383
@staticmethod
84-
def appendBucketSize(params, bucket_size):
84+
def append_bucket_size(params, bucket_size):
8585
"""Append BUCKETSIZE to params."""
8686
if bucket_size is not None:
8787
params.extend(["BUCKETSIZE", bucket_size])

redis/commands/bf/commands.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def create(self, key, errorRate, capacity, expansion=None, noScale=None):
6262
For more information see `BF.RESERVE <https://oss.redis.com/redisbloom/master/Bloom_Commands/#bfreserve>`_.
6363
""" # noqa
6464
params = [key, errorRate, capacity]
65-
self.appendExpansion(params, expansion)
66-
self.appendNoScale(params, noScale)
65+
self.append_expansion(params, expansion)
66+
self.append_no_scale(params, noScale)
6767
return self.execute_command(BF_RESERVE, *params)
6868

6969
def add(self, key, item):
@@ -102,12 +102,12 @@ def insert(
102102
For more information see `BF.INSERT <https://oss.redis.com/redisbloom/master/Bloom_Commands/#bfinsert>`_.
103103
""" # noqa
104104
params = [key]
105-
self.appendCapacity(params, capacity)
106-
self.appendError(params, error)
107-
self.appendExpansion(params, expansion)
108-
self.appendNoCreate(params, noCreate)
109-
self.appendNoScale(params, noScale)
110-
self.appendItems(params, items)
105+
self.append_capacity(params, capacity)
106+
self.append_error(params, error)
107+
self.append_expansion(params, expansion)
108+
self.append_no_create(params, noCreate)
109+
self.append_no_scale(params, noScale)
110+
self.append_items(params, items)
111111

112112
return self.execute_command(BF_INSERT, *params)
113113

@@ -177,9 +177,9 @@ def create(
177177
For more information see `CF.RESERVE <https://oss.redis.com/redisbloom/master/Cuckoo_Commands/#cfreserve>`_.
178178
""" # noqa
179179
params = [key, capacity]
180-
self.appendExpansion(params, expansion)
181-
self.appendBucketSize(params, bucket_size)
182-
self.appendMaxIterations(params, max_iterations)
180+
self.append_expansion(params, expansion)
181+
self.append_bucket_size(params, bucket_size)
182+
self.append_max_iterations(params, max_iterations)
183183
return self.execute_command(CF_RESERVE, *params)
184184

185185
def add(self, key, item):
@@ -207,9 +207,9 @@ def insert(self, key, items, capacity=None, nocreate=None):
207207
For more information see `CF.INSERT <https://oss.redis.com/redisbloom/master/Cuckoo_Commands/#cfinsert>`_.
208208
""" # noqa
209209
params = [key]
210-
self.appendCapacity(params, capacity)
211-
self.appendNoCreate(params, nocreate)
212-
self.appendItems(params, items)
210+
self.append_capacity(params, capacity)
211+
self.append_no_create(params, nocreate)
212+
self.append_items(params, items)
213213
return self.execute_command(CF_INSERT, *params)
214214

215215
def insertnx(self, key, items, capacity=None, nocreate=None):
@@ -220,9 +220,9 @@ def insertnx(self, key, items, capacity=None, nocreate=None):
220220
For more information see `CF.INSERTNX <https://oss.redis.com/redisbloom/master/Cuckoo_Commands/#cfinsertnx>`_.
221221
""" # noqa
222222
params = [key]
223-
self.appendCapacity(params, capacity)
224-
self.appendNoCreate(params, nocreate)
225-
self.appendItems(params, items)
223+
self.append_capacity(params, capacity)
224+
self.append_no_create(params, nocreate)
225+
self.append_items(params, items)
226226
return self.execute_command(CF_INSERTNX, *params)
227227

228228
def exists(self, key, item):
@@ -315,7 +315,7 @@ def incrby(self, key, items, increments):
315315
>>> topkincrby('A', ['foo'], [1])
316316
""" # noqa
317317
params = [key]
318-
self.appendItemsAndIncrements(params, items, increments)
318+
self.append_items_and_increments(params, items, increments)
319319
return self.execute_command(TOPK_INCRBY, *params)
320320

321321
def query(self, key, *items):
@@ -383,7 +383,7 @@ def add(self, key, values, weights):
383383
>>> tdigestadd('A', [1500.0], [1.0])
384384
""" # noqa
385385
params = [key]
386-
self.appendValuesAndWeights(params, values, weights)
386+
self.append_values_and_weights(params, values, weights)
387387
return self.execute_command(TDIGEST_ADD, *params)
388388

389389
def merge(self, toKey, fromKey):
@@ -465,7 +465,7 @@ def incrby(self, key, items, increments):
465465
>>> cmsincrby('A', ['foo'], [1])
466466
""" # noqa
467467
params = [key]
468-
self.appendItemsAndIncrements(params, items, increments)
468+
self.append_items_and_increments(params, items, increments)
469469
return self.execute_command(CMS_INCRBY, *params)
470470

471471
def query(self, key, *items):
@@ -487,7 +487,7 @@ def merge(self, destKey, numKeys, srcKeys, weights=[]):
487487
""" # noqa
488488
params = [destKey, numKeys]
489489
params += srcKeys
490-
self.appendWeights(params, weights)
490+
self.append_weights(params, weights)
491491
return self.execute_command(CMS_MERGE, *params)
492492

493493
def info(self, key):

redis/commands/graph/__init__.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self, client, name=random_string()):
2222
self.edges = []
2323
self._labels = [] # List of node labels.
2424
self._properties = [] # List of properties.
25-
self._relationshipTypes = [] # List of relation types.
25+
self._relationship_types = [] # List of relation types.
2626
self.version = 0 # Graph version
2727

2828
@property
@@ -32,7 +32,7 @@ def name(self):
3232
def _clear_schema(self):
3333
self._labels = []
3434
self._properties = []
35-
self._relationshipTypes = []
35+
self._relationship_types = []
3636

3737
def _refresh_schema(self):
3838
self._clear_schema()
@@ -49,15 +49,15 @@ def _refresh_labels(self):
4949
self._labels[i] = l[0]
5050

5151
def _refresh_relations(self):
52-
rels = self.relationshipTypes()
52+
rels = self.relationship_types()
5353

5454
# Unpack data.
55-
self._relationshipTypes = [None] * len(rels)
55+
self._relationship_types = [None] * len(rels)
5656
for i, r in enumerate(rels):
57-
self._relationshipTypes[i] = r[0]
57+
self._relationship_types[i] = r[0]
5858

5959
def _refresh_attributes(self):
60-
props = self.propertyKeys()
60+
props = self.property_keys()
6161

6262
# Unpack data.
6363
self._properties = [None] * len(props)
@@ -91,11 +91,11 @@ def get_relation(self, idx):
9191
The index of the relation
9292
"""
9393
try:
94-
relationship_type = self._relationshipTypes[idx]
94+
relationship_type = self._relationship_types[idx]
9595
except IndexError:
9696
# Refresh relationship types.
9797
self._refresh_relations()
98-
relationship_type = self._relationshipTypes[idx]
98+
relationship_type = self._relationship_types[idx]
9999
return relationship_type
100100

101101
def get_property(self, idx):
@@ -155,8 +155,8 @@ def call_procedure(self, procedure, *args, read_only=False, **kwagrs):
155155
def labels(self):
156156
return self.call_procedure("db.labels", read_only=True).result_set
157157

158-
def relationshipTypes(self):
159-
return self.call_procedure("db.relationshipTypes", read_only=True).result_set
158+
def relationship_types(self):
159+
return self.call_procedure("db.relationship_types", read_only=True).result_set
160160

161-
def propertyKeys(self):
162-
return self.call_procedure("db.propertyKeys", read_only=True).result_set
161+
def property_keys(self):
162+
return self.call_procedure("db.property_keys", read_only=True).result_set

redis/commands/graph/edge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self, src_node, relation, dest_node, edge_id=None, properties=None)
2222
self.src_node = src_node
2323
self.dest_node = dest_node
2424

25-
def toString(self):
25+
def to_string(self):
2626
res = ""
2727
if self.properties:
2828
props = ",".join(

redis/commands/graph/node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(self, node_id=None, alias=None, label=None, properties=None):
3737

3838
self.properties = properties or {}
3939

40-
def toString(self):
40+
def to_string(self):
4141
res = ""
4242
if self.properties:
4343
props = ",".join(

redis/commands/graph/query_result.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,9 @@ def parse_profile(self, response):
292292
# record = []
293293
# for idx, cell in enumerate(row):
294294
# if type(cell) is Node:
295-
# record.append(cell.toString())
295+
# record.append(cell.to_string())
296296
# elif type(cell) is Edge:
297-
# record.append(cell.toString())
297+
# record.append(cell.to_string())
298298
# else:
299299
# record.append(cell)
300300
# tbl.add_row(record)

redis/commands/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def quote_string(v):
117117
return f'"{v}"'
118118

119119

120-
def decodeDictKeys(obj):
120+
def decode_dict_keys(obj):
121121
"""Decode the keys of the given dictionary with utf-8."""
122122
newobj = copy.copy(obj)
123123
for k in obj.keys():

0 commit comments

Comments
 (0)