mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-12-28 05:21:09 +00:00
fix linter issues
This commit is contained in:
parent
cd43aae535
commit
6f03e2ad4c
|
@ -2,10 +2,7 @@ from __future__ import annotations
|
|||
|
||||
import asyncio
|
||||
import multiprocessing
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
import typing
|
||||
|
@ -127,10 +124,15 @@ class Application(web.Application):
|
|||
if self["running"]:
|
||||
return
|
||||
|
||||
if not check_open_port(self.config.listen, self.config.port):
|
||||
return logging.error(f'A server is already running on port {self.config.port}')
|
||||
domain = self.config.domain
|
||||
host = self.config.listen
|
||||
port = self.config.port
|
||||
|
||||
logging.info(f'Starting webserver at {self.config.domain} ({self.config.listen}:{self.config.port})')
|
||||
if not check_open_port(host, port):
|
||||
logging.error(f'A server is already running on {host}:{port}')
|
||||
return
|
||||
|
||||
logging.info(f'Starting webserver at {domain} ({host}:{port})')
|
||||
asyncio.run(self.handle_run())
|
||||
|
||||
|
||||
|
@ -158,7 +160,7 @@ class Application(web.Application):
|
|||
self['cleanup_thread'] = CacheCleanupThread(self)
|
||||
self['cleanup_thread'].start()
|
||||
|
||||
for i in range(self.config.workers):
|
||||
for _ in range(self.config.workers):
|
||||
worker = PushWorker(self['push_queue'])
|
||||
worker.start()
|
||||
|
||||
|
@ -181,7 +183,7 @@ class Application(web.Application):
|
|||
|
||||
await site.stop()
|
||||
|
||||
for worker in self['workers']:
|
||||
for worker in self['workers']: # pylint: disable=not-an-iterable
|
||||
worker.stop()
|
||||
|
||||
self.set_signal_handler(False)
|
||||
|
|
|
@ -18,7 +18,7 @@ from .config import (
|
|||
)
|
||||
|
||||
from .. import logger as logging
|
||||
from ..misc import get_app
|
||||
from ..misc import boolean, get_app
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from collections.abc import Iterator
|
||||
|
|
|
@ -5,8 +5,6 @@ import asyncio
|
|||
import click
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
import typing
|
||||
|
||||
from aputils.signer import Signer
|
||||
|
|
|
@ -88,11 +88,11 @@ def get_resource(path: str) -> Path:
|
|||
|
||||
|
||||
class JsonEncoder(json.JSONEncoder):
|
||||
def default(self, obj: Any) -> str:
|
||||
if isinstance(obj, datetime):
|
||||
return obj.isoformat()
|
||||
def default(self, o: Any) -> str:
|
||||
if isinstance(o, datetime):
|
||||
return o.isoformat()
|
||||
|
||||
return JSONEncoder.default(self, obj)
|
||||
return json.JSONEncoder.default(self, o)
|
||||
|
||||
|
||||
class Message(ApMessage):
|
||||
|
|
|
@ -5,8 +5,6 @@ import typing
|
|||
from hamlish_jinja.extension import HamlishExtension
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from .database.config import THEMES
|
||||
from .misc import get_resource
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import typing
|
|||
|
||||
from aiohttp import web
|
||||
from argon2.exceptions import VerifyMismatchError
|
||||
from datetime import datetime, timezone
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from .base import View, register_route
|
||||
|
|
Loading…
Reference in a new issue