1
0
Fork 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
1 changed files with 16 additions and 16 deletions

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"]
@dataclass(frozen=True)
class FileInfo:
"""Stores all needed information about a file.
"""Stores information about a file.
Arguments:
- `name` -- name of a file;
- `size` -- size of a file;
- `dlurl` -- full download URL for a file;
- `hash_value` -- hash sum of a file;
- `hash_algo` -- hash algorithm used (e.g. md5).
"""
def __init__(self, name: str, size: int, dlurl: str,
hash_value: str, hash_algo: str) -> None:
self.name = name
self.size = size
self.dlurl = dlurl
self.hash_value = hash_value
self.hash_algo = hash_algo
Fields:
- `name` -- name of a file;
- `size` -- size of a file;
- `download_url` -- full download URL for a file;
- `hash_value` -- hash sum of a file;
- `hash_algorithm` -- hash algorithm used (e.g. md5).
"""
name: str
size: int
download_url: str
hash_value: str
hash_algorithm: str