1
0

FileInfo is now a frozen dataclass for efficiency.

This commit is contained in:
Alexander Andreev 2020-11-18 23:48:38 +04:00
parent bb47b50c5f
commit 7754a90313

View File

@ -1,23 +1,23 @@
"""FileInfo object stores all needed information about a file.""" """FileInfo object stores information about a file."""
from dataclasses import dataclass
__all__ = ["FileInfo"] __all__ = ["FileInfo"]
@dataclass(frozen=True)
class FileInfo: class FileInfo:
"""Stores all needed information about a file. """Stores information about a file.
Arguments: Fields:
- `name` -- name of a file; - `name` -- name of a file;
- `size` -- size of a file; - `size` -- size of a file;
- `dlurl` -- full download URL for a file; - `download_url` -- full download URL for a file;
- `hash_value` -- hash sum of a file; - `hash_value` -- hash sum of a file;
- `hash_algo` -- hash algorithm used (e.g. md5). - `hash_algorithm` -- hash algorithm used (e.g. md5).
""" """
def __init__(self, name: str, size: int, dlurl: str, name: str
hash_value: str, hash_algo: str) -> None: size: int
self.name = name download_url: str
self.size = size hash_value: str
self.dlurl = dlurl hash_algorithm: str
self.hash_value = hash_value
self.hash_algo = hash_algo