Source code for src.checks.interfaces_checked_in_binaries
from __future__ import annotations
from typing import Hashable, Tuple
from pathlib import Path
[docs]
class FileTypeInterface:
"""Represents a recognized file type"""
[docs]
def __init__(self):
pass
[docs]
def _key(self) -> Tuple[Hashable, ...]:
"""Used to decide equality in comparisons and hash based
lookups"""
raise NotImplementedError
[docs]
def __repr__(self) -> str:
return str(self._key())
[docs]
def __str__(self) -> str:
return str(self._key())
[docs]
def __hash__(self) -> int:
return hash(self._key())
[docs]
def __eq__(self, other) -> bool:
if isinstance(other, FileTypeInterface):
return self._key() == other._key()
raise NotImplementedError