Slight simplification.

This commit is contained in:
Itamar Turner-Trauring 2022-07-05 11:30:48 -04:00
parent 1e6864ac01
commit 3270d24c45

View File

@ -24,7 +24,7 @@ from twisted.web.server import Site, Request
from twisted.protocols.tls import TLSMemoryBIOFactory from twisted.protocols.tls import TLSMemoryBIOFactory
from twisted.python.filepath import FilePath from twisted.python.filepath import FilePath
from attrs import define, field from attrs import define, field, Factory
from werkzeug.http import ( from werkzeug.http import (
parse_range_header, parse_range_header,
parse_content_range_header, parse_content_range_header,
@ -149,11 +149,11 @@ class StorageIndexUploads(object):
""" """
# Map share number to BucketWriter # Map share number to BucketWriter
shares: dict[int, BucketWriter] = field(factory=dict) shares: dict[int, BucketWriter] = Factory(dict)
# Map share number to the upload secret (different shares might have # Map share number to the upload secret (different shares might have
# different upload secrets). # different upload secrets).
upload_secrets: dict[int, bytes] = field(factory=dict) upload_secrets: dict[int, bytes] = Factory(dict)
@define @define
@ -163,10 +163,10 @@ class UploadsInProgress(object):
""" """
# Map storage index to corresponding uploads-in-progress # Map storage index to corresponding uploads-in-progress
_uploads: dict[bytes, StorageIndexUploads] = field(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]] = field(factory=dict) _bucketwriters: dict[BucketWriter, Tuple[bytes, int]] = Factory(dict)
def add_write_bucket( def add_write_bucket(
self, self,
@ -299,7 +299,7 @@ class _ReadAllProducer:
request: Request request: Request
read_data: ReadData read_data: ReadData
result: Deferred = field(factory=Deferred) result: Deferred = Factory(Deferred)
start: int = field(default=0) start: int = field(default=0)
@classmethod @classmethod