Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Aug 1, 2024
1 parent cb3ff86 commit 3bee031
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 16 deletions.
3 changes: 1 addition & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
from typing import List

from fastapi import APIRouter
from loguru import logger

from lnbits.db import Database
from lnbits.helpers import template_renderer
from lnbits.tasks import create_permanent_unique_task
from loguru import logger

from .nostr.client.client import NostrClient
from .router import NostrRouter
Expand Down
3 changes: 1 addition & 2 deletions crud.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import List, Optional

import json
from typing import List, Optional

from . import db
from .models import Config, Relay
Expand Down
3 changes: 1 addition & 2 deletions models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from sqlite3 import Row
from typing import List, Optional

from pydantic import BaseModel

from lnbits.helpers import urlsafe_short_hash
from pydantic import BaseModel


class RelayStatus(BaseModel):
Expand Down
7 changes: 3 additions & 4 deletions router.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
from typing import Dict, List

from fastapi import WebSocket, WebSocketDisconnect
from loguru import logger

from lnbits.helpers import urlsafe_short_hash
from loguru import logger

from . import nostr_client
from .nostr.message_pool import EndOfStoredEventsMessage, EventMessage, NoticeMessage
Expand Down Expand Up @@ -61,7 +60,7 @@ async def _client_to_nostr(self):
try:
await self._handle_client_to_nostr(json_str)
except Exception as e:
logger.debug(f"Failed to handle client message: '{str(e)}'.")
logger.debug(f"Failed to handle client message: '{e!s}'.")

async def _nostr_to_client(self):
"""Sends responses from relays back to the client."""
Expand All @@ -70,7 +69,7 @@ async def _nostr_to_client(self):
await self._handle_subscriptions()
self._handle_notices()
except Exception as e:
logger.debug(f"Failed to handle response for client: '{str(e)}'.")
logger.debug(f"Failed to handle response for client: '{e!s}'.")
await asyncio.sleep(0.1)

async def _handle_subscriptions(self):
Expand Down
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async def check_relays():
await asyncio.sleep(20)
nostr_client.relay_manager.check_and_restart_relays()
except Exception as e:
logger.warning(f"Cannot restart relays: '{str(e)}'.")
logger.warning(f"Cannot restart relays: '{e!s}'.")


async def subscribe_events():
Expand Down
3 changes: 1 addition & 2 deletions views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from fastapi import Depends, Request
from fastapi.templating import Jinja2Templates
from starlette.responses import HTMLResponse

from lnbits.core.models import User
from lnbits.decorators import check_admin
from starlette.responses import HTMLResponse

from . import nostr_renderer, nostrclient_ext

Expand Down
5 changes: 2 additions & 3 deletions views_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
from typing import List

from fastapi import Depends, WebSocket
from loguru import logger
from starlette.exceptions import HTTPException

from lnbits.decorators import check_admin
from lnbits.helpers import decrypt_internal_message, urlsafe_short_hash
from loguru import logger
from starlette.exceptions import HTTPException

from . import all_routers, nostr_client, nostrclient_ext
from .crud import (
Expand Down

0 comments on commit 3bee031

Please sign in to comment.