Skip to content

Commit e6e98a6

Browse files
author
Dan Richelson
committed
Address PR comments
1 parent 03278c6 commit e6e98a6

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

ldclient/interfaces.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@ def get(self, key, callback):
1414
:param key: The feature key
1515
:type key: str
1616
:param callback: The function that accepts the feature data and returns the feature value
17-
:type callback: function
18-
:return: The feature value. None if not found
17+
:type callback: Function that processes the feature flag once received.
18+
:return: The result of executing callback.
1919
"""
2020

2121
@abstractmethod
2222
def all(self, callback):
2323
"""
2424
Returns all feature flags and their data
25-
26-
:rtype: dict[str, dict]
25+
:param callback: The function that accepts the feature data and returns the feature value
26+
:type callback: Function that processes the feature flags once received.
27+
:rtype: The result of executing callback.
2728
"""
2829

2930
@abstractmethod

ldclient/redis_feature_store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def all(self, callback):
5656
results[f['key']] = f
5757
return callback(results)
5858

59-
def get(self, key, callback):
59+
def get(self, key, callback=lambda x: x):
6060
f = self._cache.get(key)
6161
if f is not None:
6262
# reset ttl
@@ -112,7 +112,7 @@ def initialized(self):
112112
def upsert(self, key, feature):
113113
r = redis.Redis(connection_pool=self._pool)
114114
r.watch(self._features_key)
115-
old = self.get(key, lambda x: x)
115+
old = self.get(key)
116116
if old:
117117
if old['version'] >= feature['version']:
118118
r.unwatch()

ldclient/twisted_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def cb(result):
3535
def _evaluate_internal(self, flag, user):
3636
def check_prereq_results(result):
3737
prereq_ok = True
38-
for r in result: # r is a tuple of 2 booleans: (error, prereqMatches)
39-
if r[0] is False or r[1] is False:
38+
for (success, prereq_ok) in result:
39+
if success is False or prereq_ok is False:
4040
prereq_ok = False
4141

4242
if prereq_ok is True:

ldclient/twisted_event_consumer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class TwistedEventConsumer(EventConsumer):
1717

1818
def __init__(self, queue, sdk_key, config):
1919
self._queue = queue
20-
""" @type: queue.Queue """
20+
""" :type: queue.Queue """
2121

2222
self._session = CacheControl(txrequests.Session())
2323
""" :type: txrequests.Session """

0 commit comments

Comments
 (0)