remove unused imports, don't use format string when not needed
This commit is contained in:
parent
eb443902c2
commit
30150c4561
5 changed files with 7 additions and 19 deletions
|
|
@ -1,5 +1,3 @@
|
||||||
import asyncio
|
|
||||||
|
|
||||||
from fastapi import APIRouter
|
from fastapi import APIRouter
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
|
|
||||||
|
|
|
||||||
9
crud.py
9
crud.py
|
|
@ -1,5 +1,4 @@
|
||||||
import json
|
import json
|
||||||
import re
|
|
||||||
from typing import Any, List, Optional
|
from typing import Any, List, Optional
|
||||||
|
|
||||||
from . import db
|
from . import db
|
||||||
|
|
@ -31,7 +30,6 @@ async def create_event(relay_id: str, e: NostrEvent):
|
||||||
await create_event_tags(relay_id, e.id, name, value, extra)
|
await create_event_tags(relay_id, e.id, name, value, extra)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def get_events(relay_id: str, filter: NostrFilter) -> List[NostrEvent]:
|
async def get_events(relay_id: str, filter: NostrFilter) -> List[NostrEvent]:
|
||||||
values: List[Any] = []
|
values: List[Any] = []
|
||||||
query = "SELECT id, pubkey, created_at, kind, content, sig FROM nostrrelay.events"
|
query = "SELECT id, pubkey, created_at, kind, content, sig FROM nostrrelay.events"
|
||||||
|
|
@ -66,10 +64,10 @@ async def get_events(relay_id: str, filter: NostrFilter) -> List[NostrEvent]:
|
||||||
query += f" AND kind IN ({kinds})"
|
query += f" AND kind IN ({kinds})"
|
||||||
values += filter.kinds
|
values += filter.kinds
|
||||||
if filter.since:
|
if filter.since:
|
||||||
query += f" AND created_at >= ?"
|
query += " AND created_at >= ?"
|
||||||
values += [filter.since]
|
values += [filter.since]
|
||||||
if filter.until:
|
if filter.until:
|
||||||
query += f" AND created_at <= ?"
|
query += " AND created_at <= ?"
|
||||||
values += [filter.until]
|
values += [filter.until]
|
||||||
|
|
||||||
query += " ORDER BY created_at DESC"
|
query += " ORDER BY created_at DESC"
|
||||||
|
|
@ -87,7 +85,6 @@ async def get_events(relay_id: str, filter: NostrFilter) -> List[NostrEvent]:
|
||||||
return events
|
return events
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def create_event_tags(
|
async def create_event_tags(
|
||||||
relay_id: str, event_id: str, tag_name: str, tag_value: str, extra_values: Optional[str]
|
relay_id: str, event_id: str, tag_name: str, tag_value: str, extra_values: Optional[str]
|
||||||
):
|
):
|
||||||
|
|
@ -105,6 +102,7 @@ async def create_event_tags(
|
||||||
(relay_id, event_id, tag_name, tag_value, extra_values),
|
(relay_id, event_id, tag_name, tag_value, extra_values),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def get_event_tags(
|
async def get_event_tags(
|
||||||
relay_id: str, event_id: str
|
relay_id: str, event_id: str
|
||||||
) -> List[List[str]]:
|
) -> List[List[str]]:
|
||||||
|
|
@ -122,4 +120,3 @@ async def get_event_tags(
|
||||||
tags.append(tag)
|
tags.append(tag)
|
||||||
|
|
||||||
return tags
|
return tags
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,6 @@ class NostrFilter(BaseModel):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class NostrEventType(str, Enum):
|
class NostrEventType(str, Enum):
|
||||||
EVENT = "EVENT"
|
EVENT = "EVENT"
|
||||||
REQ = "REQ"
|
REQ = "REQ"
|
||||||
|
|
|
||||||
3
views.py
3
views.py
|
|
@ -1,8 +1,5 @@
|
||||||
from http import HTTPStatus
|
|
||||||
|
|
||||||
from fastapi import Depends, Request
|
from fastapi import Depends, Request
|
||||||
from fastapi.templating import Jinja2Templates
|
from fastapi.templating import Jinja2Templates
|
||||||
from starlette.exceptions import HTTPException
|
|
||||||
from starlette.responses import HTMLResponse
|
from starlette.responses import HTMLResponse
|
||||||
|
|
||||||
from lnbits.core.models import User
|
from lnbits.core.models import User
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
from fastapi import Depends, Query, WebSocket
|
from fastapi import Query, WebSocket
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from starlette.exceptions import HTTPException
|
|
||||||
|
|
||||||
from lnbits.decorators import WalletTypeInfo, get_key_type, require_admin_key
|
|
||||||
|
|
||||||
from . import nostrrelay_ext
|
from . import nostrrelay_ext
|
||||||
from .client_manager import NostrClientConnection, NostrClientManager
|
from .client_manager import NostrClientConnection, NostrClientManager
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue