kopia lustrzana https://github.com/ihabunek/toot
Porównaj commity
5 Commity
1d48e64853
...
07ad41960f
Autor | SHA1 | Data |
---|---|---|
Ivan Habunek | 07ad41960f | |
Sandra Snan | 07beba8c68 | |
Sandra Snan | 7244b2718f | |
Ivan Habunek | 968a516f76 | |
Ivan Habunek | 38eca67905 |
|
@ -3,28 +3,13 @@ Helpers for testing.
|
|||
"""
|
||||
|
||||
import time
|
||||
from typing import Any, Callable
|
||||
from typing import Callable, TypeVar
|
||||
|
||||
|
||||
class MockResponse:
|
||||
def __init__(self, response_data={}, ok=True, is_redirect=False):
|
||||
self.response_data = response_data
|
||||
self.content = response_data
|
||||
self.ok = ok
|
||||
self.is_redirect = is_redirect
|
||||
|
||||
def raise_for_status(self):
|
||||
pass
|
||||
|
||||
def json(self):
|
||||
return self.response_data
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
def retval(val):
|
||||
return lambda *args, **kwargs: val
|
||||
|
||||
|
||||
def run_with_retries(fn: Callable[..., Any]):
|
||||
def run_with_retries(fn: Callable[..., T]) -> T:
|
||||
"""
|
||||
Run the the given function repeatedly until it finishes without raising an
|
||||
AssertionError. Sleep a bit between attempts. If the function doesn't
|
||||
|
@ -41,4 +26,4 @@ def run_with_retries(fn: Callable[..., Any]):
|
|||
except AssertionError:
|
||||
time.sleep(delay)
|
||||
|
||||
fn()
|
||||
return fn()
|
||||
|
|
|
@ -111,7 +111,10 @@ def bookmarks(
|
|||
|
||||
|
||||
@cli.command()
|
||||
@click.option("--clear", help="Dismiss all notifications and exit")
|
||||
@click.option(
|
||||
"--clear", is_flag=True,
|
||||
help="Dismiss all notifications and exit"
|
||||
)
|
||||
@click.option(
|
||||
"--reverse", "-r", is_flag=True,
|
||||
help="Reverse the order of the shown notifications (newest on top)"
|
||||
|
|
|
@ -219,7 +219,7 @@ def status_lines(status: Status) -> t.Generator[str, None, None]:
|
|||
|
||||
reply = f"↲ In reply to {yellow(in_reply_to_id)} " if in_reply_to_id else ""
|
||||
boost = f"↻ {blue(reblogged_by_acct)} boosted " if reblogged_by else ""
|
||||
yield f"ID {yellow(status_id)} {reply} {boost}"
|
||||
yield f"ID {yellow(status_id)} Visibility: {status.visibility} {reply} {boost}"
|
||||
|
||||
|
||||
def html_lines(html: str, width: int) -> t.Generator[str, None, None]:
|
||||
|
|
Ładowanie…
Reference in New Issue