Fix Formatting
This commit is contained in:
parent
b19cf6a105
commit
e020574d65
|
@ -52,10 +52,10 @@ class RoomSyncResult(collections.namedtuple("RoomSyncResult", [
|
||||||
|
|
||||||
|
|
||||||
class SyncResult(collections.namedtuple("SyncResult", [
|
class SyncResult(collections.namedtuple("SyncResult", [
|
||||||
"next_batch", # Token for the next sync
|
"next_batch", # Token for the next sync
|
||||||
"private_user_data", # List of private events for the user.
|
"private_user_data", # List of private events for the user.
|
||||||
"public_user_data", # List of public events for all users.
|
"public_user_data", # List of public events for all users.
|
||||||
"rooms", # RoomSyncResult for each room.
|
"rooms", # RoomSyncResult for each room.
|
||||||
])):
|
])):
|
||||||
__slots__ = []
|
__slots__ = []
|
||||||
|
|
||||||
|
@ -181,7 +181,6 @@ class SyncHandler(BaseHandler):
|
||||||
limited=True,
|
limited=True,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def incremental_sync_with_gap(self, sync_config, since_token):
|
def incremental_sync_with_gap(self, sync_config, since_token):
|
||||||
""" Get the incremental delta needed to bring the client up to
|
""" Get the incremental delta needed to bring the client up to
|
||||||
|
@ -231,7 +230,6 @@ class SyncHandler(BaseHandler):
|
||||||
next_batch=now_token,
|
next_batch=now_token,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def incremental_sync_with_gap_for_room(self, room_id, sync_config,
|
def incremental_sync_with_gap_for_room(self, room_id, sync_config,
|
||||||
since_token, now_token,
|
since_token, now_token,
|
||||||
|
@ -316,7 +314,6 @@ class SyncHandler(BaseHandler):
|
||||||
state = ()
|
state = ()
|
||||||
defer.returnValue(state)
|
defer.returnValue(state)
|
||||||
|
|
||||||
|
|
||||||
def compute_state_delta(self, since_token, previous_state, current_state):
|
def compute_state_delta(self, since_token, previous_state, current_state):
|
||||||
""" Works out the differnce in state between the current state and the
|
""" Works out the differnce in state between the current state and the
|
||||||
state the client got when it last performed a sync.
|
state the client got when it last performed a sync.
|
||||||
|
@ -327,7 +324,7 @@ class SyncHandler(BaseHandler):
|
||||||
# after the previous sync, since we need to include those state
|
# after the previous sync, since we need to include those state
|
||||||
# updates even if they occured logically before the previous event.
|
# updates even if they occured logically before the previous event.
|
||||||
# TODO(mjark) Check for new redactions in the state events.
|
# TODO(mjark) Check for new redactions in the state events.
|
||||||
previous_dict = {event.event_id:event for event in previous_state}
|
previous_dict = {event.event_id: event for event in previous_state}
|
||||||
state_delta = []
|
state_delta = []
|
||||||
for event in current_state:
|
for event in current_state:
|
||||||
if event.event_id not in previous_dict:
|
if event.event_id not in previous_dict:
|
||||||
|
|
|
@ -214,7 +214,7 @@ class Notifier(object):
|
||||||
|
|
||||||
deferred = defer.Deferred()
|
deferred = defer.Deferred()
|
||||||
|
|
||||||
from_token=StreamToken("s0","0","0")
|
from_token = StreamToken("s0", "0", "0")
|
||||||
|
|
||||||
listener = [_NotificationListener(
|
listener = [_NotificationListener(
|
||||||
user=user,
|
user=user,
|
||||||
|
@ -231,6 +231,7 @@ class Notifier(object):
|
||||||
result = yield callback()
|
result = yield callback()
|
||||||
if timeout:
|
if timeout:
|
||||||
timed_out = [False]
|
timed_out = [False]
|
||||||
|
|
||||||
def _timeout_listener():
|
def _timeout_listener():
|
||||||
timed_out[0] = True
|
timed_out[0] = True
|
||||||
listener[0].notify(self, [], from_token, from_token)
|
listener[0].notify(self, [], from_token, from_token)
|
||||||
|
@ -252,7 +253,6 @@ class Notifier(object):
|
||||||
|
|
||||||
defer.returnValue(result)
|
defer.returnValue(result)
|
||||||
|
|
||||||
|
|
||||||
def get_events_for(self, user, rooms, pagination_config, timeout):
|
def get_events_for(self, user, rooms, pagination_config, timeout):
|
||||||
""" For the given user and rooms, return any new events for them. If
|
""" For the given user and rooms, return any new events for them. If
|
||||||
there are no new events wait for up to `timeout` milliseconds for any
|
there are no new events wait for up to `timeout` milliseconds for any
|
||||||
|
|
|
@ -68,7 +68,6 @@ class SyncRestServlet(RestServlet):
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
PATTERN = client_v2_pattern("/sync$")
|
PATTERN = client_v2_pattern("/sync$")
|
||||||
ALLOWED_SORT = set(["timeline,asc", "timeline,desc"])
|
ALLOWED_SORT = set(["timeline,asc", "timeline,desc"])
|
||||||
ALLOWED_PRESENCE = set(["online", "offline", "idle"])
|
ALLOWED_PRESENCE = set(["online", "offline", "idle"])
|
||||||
|
@ -114,12 +113,12 @@ class SyncRestServlet(RestServlet):
|
||||||
|
|
||||||
sync_config = SyncConfig(
|
sync_config = SyncConfig(
|
||||||
user=user,
|
user=user,
|
||||||
device="TODO", # TODO(mjark) Get the device_id from access_token
|
device="TODO", # TODO(mjark) Get the device_id from access_token
|
||||||
gap=gap,
|
gap=gap,
|
||||||
limit=limit,
|
limit=limit,
|
||||||
sort=sort,
|
sort=sort,
|
||||||
backfill=backfill,
|
backfill=backfill,
|
||||||
filter="TODO", # TODO(mjark) Add the filter to the config.
|
filter="TODO", # TODO(mjark) Add the filter to the config.
|
||||||
)
|
)
|
||||||
|
|
||||||
if since is not None:
|
if since is not None:
|
||||||
|
|
|
@ -289,7 +289,6 @@ class StreamStore(SQLBaseStore):
|
||||||
" LIMIT ?"
|
" LIMIT ?"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_recent_events_for_room_txn(txn):
|
def get_recent_events_for_room_txn(txn):
|
||||||
if from_token is None:
|
if from_token is None:
|
||||||
txn.execute(sql, (room_id, end_token.stream, limit,))
|
txn.execute(sql, (room_id, end_token.stream, limit,))
|
||||||
|
|
Loading…
Reference in New Issue