mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-10-08 10:18:25 -04:00
Use ParamSpec
in type hints for synapse.logging.context
(#12150)
Signed-off-by: Sean Quah <seanq@element.io>
This commit is contained in:
parent
0dc9c5653c
commit
5627182788
5 changed files with 37 additions and 25 deletions
|
@ -16,7 +16,7 @@ import abc
|
|||
import logging
|
||||
import os
|
||||
import shutil
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from typing import TYPE_CHECKING, Callable, Optional
|
||||
|
||||
from synapse.config._base import Config
|
||||
from synapse.logging.context import defer_to_thread, run_in_background
|
||||
|
@ -150,8 +150,13 @@ class FileStorageProviderBackend(StorageProvider):
|
|||
dirname = os.path.dirname(backup_fname)
|
||||
os.makedirs(dirname, exist_ok=True)
|
||||
|
||||
# mypy needs help inferring the type of the second parameter, which is generic
|
||||
shutil_copyfile: Callable[[str, str], str] = shutil.copyfile
|
||||
await defer_to_thread(
|
||||
self.hs.get_reactor(), shutil.copyfile, primary_fname, backup_fname
|
||||
self.hs.get_reactor(),
|
||||
shutil_copyfile,
|
||||
primary_fname,
|
||||
backup_fname,
|
||||
)
|
||||
|
||||
async def fetch(self, path: str, file_info: FileInfo) -> Optional[Responder]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue