chore: code clean-up

This commit is contained in:
Vlad Stan 2023-06-23 10:52:49 +03:00
parent babb58e7e9
commit cd1e830947
3 changed files with 5 additions and 6 deletions

View file

@ -1,5 +1,5 @@
import time
from typing import *
from typing import List
from ..relay_manager import RelayManager

View file

@ -158,7 +158,7 @@ class NostrRouter:
return
if json_data[0] == "CLOSE":
self.handle_client_close(json_data[1])
self._handle_client_close(json_data[1])
return
if json_data[0] == "EVENT":
@ -180,7 +180,7 @@ class NostrRouter:
self.subscriptions.append(subscription_id_rewritten)
nostr.client.relay_manager.publish_message(request_rewritten)
def handle_client_close(self, subscription_id):
def _handle_client_close(self, subscription_id):
subscription_id_rewritten = next((k for k, v in self.original_subscription_ids.items() if v == subscription_id), None)
if subscription_id_rewritten:
nostr.client.relay_manager.close_subscription(subscription_id_rewritten)

View file

@ -1,6 +1,6 @@
import asyncio
from http import HTTPStatus
from typing import List, Optional
from typing import Optional
from fastapi import Depends, WebSocket
from loguru import logger
@ -14,7 +14,6 @@ from .crud import add_relay, delete_relay, get_relays
from .helpers import normalize_public_key
from .models import Relay, RelayList, TestMessage, TestMessageResponse
from .nostr.key import EncryptedDirectMessage, PrivateKey
from .nostr.relay import Relay as NostrRelay
from .services import NostrRouter, nostr
# we keep this in