mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 03:54:52 -04:00
Run Black. (#5482)
This commit is contained in:
parent
7dcf984075
commit
32e7c9e7f2
376 changed files with 9142 additions and 10388 deletions
|
@ -30,34 +30,34 @@ class SourcePaginationConfig(object):
|
|||
"""A configuration object which stores pagination parameters for a
|
||||
specific event source."""
|
||||
|
||||
def __init__(self, from_key=None, to_key=None, direction='f',
|
||||
limit=None):
|
||||
def __init__(self, from_key=None, to_key=None, direction="f", limit=None):
|
||||
self.from_key = from_key
|
||||
self.to_key = to_key
|
||||
self.direction = 'f' if direction == 'f' else 'b'
|
||||
self.direction = "f" if direction == "f" else "b"
|
||||
self.limit = min(int(limit), MAX_LIMIT) if limit is not None else None
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
"StreamConfig(from_key=%r, to_key=%r, direction=%r, limit=%r)"
|
||||
) % (self.from_key, self.to_key, self.direction, self.limit)
|
||||
return ("StreamConfig(from_key=%r, to_key=%r, direction=%r, limit=%r)") % (
|
||||
self.from_key,
|
||||
self.to_key,
|
||||
self.direction,
|
||||
self.limit,
|
||||
)
|
||||
|
||||
|
||||
class PaginationConfig(object):
|
||||
|
||||
"""A configuration object which stores pagination parameters."""
|
||||
|
||||
def __init__(self, from_token=None, to_token=None, direction='f',
|
||||
limit=None):
|
||||
def __init__(self, from_token=None, to_token=None, direction="f", limit=None):
|
||||
self.from_token = from_token
|
||||
self.to_token = to_token
|
||||
self.direction = 'f' if direction == 'f' else 'b'
|
||||
self.direction = "f" if direction == "f" else "b"
|
||||
self.limit = min(int(limit), MAX_LIMIT) if limit is not None else None
|
||||
|
||||
@classmethod
|
||||
def from_request(cls, request, raise_invalid_params=True,
|
||||
default_limit=None):
|
||||
direction = parse_string(request, "dir", default='f', allowed_values=['f', 'b'])
|
||||
def from_request(cls, request, raise_invalid_params=True, default_limit=None):
|
||||
direction = parse_string(request, "dir", default="f", allowed_values=["f", "b"])
|
||||
|
||||
from_tok = parse_string(request, "from")
|
||||
to_tok = parse_string(request, "to")
|
||||
|
@ -89,8 +89,7 @@ class PaginationConfig(object):
|
|||
|
||||
def __repr__(self):
|
||||
return (
|
||||
"PaginationConfig(from_tok=%r, to_tok=%r,"
|
||||
" direction=%r, limit=%r)"
|
||||
"PaginationConfig(from_tok=%r, to_tok=%r," " direction=%r, limit=%r)"
|
||||
) % (self.from_token, self.to_token, self.direction, self.limit)
|
||||
|
||||
def get_source_config(self, source_name):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue