Modernise
This commit is contained in:
parent
4c6441182b
commit
8faee98ec6
44 changed files with 214 additions and 201 deletions
|
|
@ -28,7 +28,9 @@ class cached_property:
|
|||
)
|
||||
try:
|
||||
cache = instance.__dict__
|
||||
except AttributeError: # not all objects have __dict__ (e.g. class defines slots)
|
||||
except (
|
||||
AttributeError
|
||||
): # not all objects have __dict__ (e.g. class defines slots)
|
||||
msg = (
|
||||
f"No '__dict__' attribute on {type(instance).__name__!r} "
|
||||
f"instance to cache {self.attrname!r} property."
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@ import re
|
|||
from pathlib import Path
|
||||
from typing import Any, List
|
||||
|
||||
from gridfs import DEFAULT_CHUNK_SIZE, Database, GridFSBucket
|
||||
from gridfs import DEFAULT_CHUNK_SIZE, GridFSBucket
|
||||
from pymongo import MongoClient
|
||||
from pymongo.database import Database
|
||||
|
||||
from ...utilities import get_logger
|
||||
from ..helper import DownloadProgressBar, UploadProgressBar, cached_property
|
||||
|
|
@ -60,7 +61,6 @@ class LargeFileMongo(LargeFileBase):
|
|||
),
|
||||
version=int(f.name.split(MONGO_NAME_VERSION_SEPARATOR)[-1]),
|
||||
remote_path=(f._id, f.length),
|
||||
origin="mongodb",
|
||||
)
|
||||
for f in self._client.find(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -100,9 +100,13 @@ class LargeFileS3(LargeFileBase):
|
|||
Bucket=self.bucket_name,
|
||||
Key=remote_path,
|
||||
Filename=str(local_path),
|
||||
Callback=None
|
||||
if hide_progress
|
||||
else DownloadProgressBar(name=str(remote_path), size=size, logger=logger),
|
||||
Callback=(
|
||||
None
|
||||
if hide_progress
|
||||
else DownloadProgressBar(
|
||||
name=str(remote_path), size=size, logger=logger
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
def _upload(self, local_path: Path, hide_progress: bool) -> None:
|
||||
|
|
@ -113,9 +117,11 @@ class LargeFileS3(LargeFileBase):
|
|||
Filename=str(local_path),
|
||||
Bucket=self.bucket_name,
|
||||
Key=key,
|
||||
Callback=None
|
||||
if hide_progress
|
||||
else UploadProgressBar(path=local_path, logger=logger),
|
||||
Callback=(
|
||||
None
|
||||
if hide_progress
|
||||
else UploadProgressBar(path=local_path, logger=logger)
|
||||
),
|
||||
)
|
||||
|
||||
def _delete_old_remote_versions(self) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue