Add __gt__ and mkFileStr function to File class.
This commit is contained in:
parent
0ad9ec320a
commit
82e1d2b3af
1 changed files with 9 additions and 2 deletions
11
fck/file.py
11
fck/file.py
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional
|
from typing import Optional, Self
|
||||||
from os import path
|
from os import path
|
||||||
from . import cktype
|
from . import cktype
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ class FILE:
|
||||||
"""
|
"""
|
||||||
Colored checkmark representation.
|
Colored checkmark representation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
CHECKMARK = {
|
CHECKMARK = {
|
||||||
True: "\033[92m✓\033[0m",
|
True: "\033[92m✓\033[0m",
|
||||||
False: "\033[91m❌\033[0m",
|
False: "\033[91m❌\033[0m",
|
||||||
|
@ -19,9 +20,15 @@ class FILE:
|
||||||
# TODO: Move out expected sum calculation
|
# TODO: Move out expected sum calculation
|
||||||
self.csum, self.esum = cktype.resolve(self.fname, esum, cstype)
|
self.csum, self.esum = cktype.resolve(self.fname, esum, cstype)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self) -> str:
|
||||||
return self.fname
|
return self.fname
|
||||||
|
|
||||||
|
def __gt__(self, other: Self) -> bool:
|
||||||
|
return self.__repr__() > other.__repr__()
|
||||||
|
|
||||||
|
def mkFileStr(self) -> str:
|
||||||
|
return f"{self.csum}\t{self.fname}\n"
|
||||||
|
|
||||||
def verify(self) -> Optional[bool]:
|
def verify(self) -> Optional[bool]:
|
||||||
if self.esum is None:
|
if self.esum is None:
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue