Fix lint.

This commit is contained in:
Itamar Turner-Trauring 2023-03-24 12:06:01 -04:00
parent aea748a890
commit 494a977525

View File

@ -4,7 +4,7 @@ HTTP server for storage.
from __future__ import annotations from __future__ import annotations
from typing import Dict, List, Set, Tuple, Any, Callable, Union, cast from typing import Any, Callable, Union, cast
from functools import wraps from functools import wraps
from base64 import b64decode from base64 import b64decode
import binascii import binascii
@ -67,8 +67,8 @@ class ClientSecretsException(Exception):
def _extract_secrets( def _extract_secrets(
header_values, required_secrets header_values: list[str], required_secrets: set[Secrets]
): # type: (List[str], Set[Secrets]) -> Dict[Secrets, bytes] ) -> dict[Secrets, bytes]:
""" """
Given list of values of ``X-Tahoe-Authorization`` headers, and required Given list of values of ``X-Tahoe-Authorization`` headers, and required
secrets, return dictionary mapping secrets to decoded values. secrets, return dictionary mapping secrets to decoded values.
@ -173,7 +173,7 @@ class UploadsInProgress(object):
_uploads: dict[bytes, StorageIndexUploads] = Factory(dict) _uploads: dict[bytes, StorageIndexUploads] = Factory(dict)
# Map BucketWriter to (storage index, share number) # Map BucketWriter to (storage index, share number)
_bucketwriters: dict[BucketWriter, Tuple[bytes, int]] = Factory(dict) _bucketwriters: dict[BucketWriter, tuple[bytes, int]] = Factory(dict)
def add_write_bucket( def add_write_bucket(
self, self,
@ -798,7 +798,9 @@ class HTTPServer(object):
# The reason can be a string with explanation, so in theory it could be # The reason can be a string with explanation, so in theory it could be
# longish? # longish?
info = await self._read_encoded( info = await self._read_encoded(
request, _SCHEMAS["advise_corrupt_share"], max_size=32768, request,
_SCHEMAS["advise_corrupt_share"],
max_size=32768,
) )
bucket.advise_corrupt_share(info["reason"].encode("utf-8")) bucket.advise_corrupt_share(info["reason"].encode("utf-8"))
return b"" return b""
@ -973,7 +975,7 @@ def listen_tls(
endpoint: IStreamServerEndpoint, endpoint: IStreamServerEndpoint,
private_key_path: FilePath, private_key_path: FilePath,
cert_path: FilePath, cert_path: FilePath,
) -> Deferred[Tuple[DecodedURL, IListeningPort]]: ) -> Deferred[tuple[DecodedURL, IListeningPort]]:
""" """
Start a HTTPS storage server on the given port, return the NURL and the Start a HTTPS storage server on the given port, return the NURL and the
listening port. listening port.