mirror of
https://github.com/element-hq/synapse
synced 2024-08-19 08:00:53 +00:00
PEP8 tweaks.
This commit is contained in:
parent
47519cd8c2
commit
77a255c7c3
5 changed files with 12 additions and 10 deletions
|
@ -59,7 +59,6 @@ class EventStreamHandler(BaseHandler):
|
|||
)
|
||||
self._streams_per_user[auth_user] += 1
|
||||
|
||||
|
||||
if pagin_config.from_token is None:
|
||||
pagin_config.from_token = None
|
||||
|
||||
|
|
|
@ -311,12 +311,18 @@ class MessageHandler(BaseHandler):
|
|||
"end": token[1],
|
||||
}
|
||||
|
||||
current_state = yield self.store.get_current_state(event.room_id)
|
||||
current_state = yield self.store.get_current_state(
|
||||
event.room_id
|
||||
)
|
||||
d["state"] = [c.get_dict() for c in current_state]
|
||||
except:
|
||||
logger.exception("Failed to get snapshot")
|
||||
|
||||
ret = {"rooms": rooms_ret, "presence": presence, "end": now_token.to_string()}
|
||||
ret = {
|
||||
"rooms": rooms_ret,
|
||||
"presence": presence,
|
||||
"end": now_token.to_string()
|
||||
}
|
||||
|
||||
defer.returnValue(ret)
|
||||
|
||||
|
@ -499,7 +505,7 @@ class RoomMemberHandler(BaseHandler):
|
|||
for entry in member_list
|
||||
]
|
||||
chunk_data = {
|
||||
"start": "START", # FIXME (erikj): START is no longer a valid value
|
||||
"start": "START", # FIXME (erikj): START is no longer valid
|
||||
"end": "END",
|
||||
"chunk": event_list
|
||||
}
|
||||
|
|
|
@ -27,7 +27,9 @@ class PaginationConfig(object):
|
|||
"""A configuration object which stores pagination parameters."""
|
||||
|
||||
def __init__(self, from_tok=None, to_tok=None, direction='f', limit=0):
|
||||
self.from_token = StreamToken.from_string(from_tok) if from_tok else None
|
||||
self.from_token = (
|
||||
StreamToken.from_string(from_tok) if from_tok else None
|
||||
)
|
||||
self.to_token = StreamToken.from_string(to_tok) if to_tok else None
|
||||
self.direction = 'f' if direction == 'f' else 'b'
|
||||
self.limit = int(limit)
|
||||
|
@ -67,6 +69,3 @@ class PaginationConfig(object):
|
|||
"<PaginationConfig from_tok=%s, to_tok=%s, "
|
||||
"direction=%s, limit=%s>"
|
||||
) % (self.from_tok, self.to_tok, self.direction, self.limit)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -171,4 +171,3 @@ class StreamSource(object):
|
|||
class PaginationSource(object):
|
||||
def get_pagination_rows(self, user, from_token, to_token, limit, key):
|
||||
raise NotImplementedError("get_rows")
|
||||
|
||||
|
|
|
@ -121,7 +121,6 @@ class StreamToken(
|
|||
str(self.presence_key),
|
||||
])
|
||||
|
||||
|
||||
def copy_and_replace(self, key, new_value):
|
||||
d = self._asdict()
|
||||
d[key] = new_value
|
||||
|
|
Loading…
Reference in a new issue