mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Remove unused methods from Resource base class
This commit is contained in:
parent
c7278c73f3
commit
4d6730e3c4
2 changed files with 0 additions and 53 deletions
|
|
@ -37,37 +37,6 @@ class Resource(ABC):
|
|||
"""
|
||||
pass
|
||||
|
||||
def __str__(self) -> str:
|
||||
if self.parent is None and self.child is None:
|
||||
return f"{self.name}:*"
|
||||
elif self.child is None:
|
||||
return f"{self.name}:{self.parent}"
|
||||
else:
|
||||
return f"{self.name}:{self.parent}/{self.child}"
|
||||
|
||||
def __repr__(self) -> str:
|
||||
parts = [f"{self.__class__.__name__}("]
|
||||
args = []
|
||||
if self.parent:
|
||||
args.append(f"{self.parent!r}")
|
||||
if self.child:
|
||||
args.append(f"{self.child!r}")
|
||||
parts.append(", ".join(args))
|
||||
parts.append(")")
|
||||
return "".join(parts)
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, Resource):
|
||||
return False
|
||||
return (
|
||||
self.__class__ == other.__class__
|
||||
and self.parent == other.parent
|
||||
and self.child == other.child
|
||||
)
|
||||
|
||||
def __hash__(self):
|
||||
return hash((self.__class__, self.parent, self.child))
|
||||
|
||||
|
||||
class AllowedResource(NamedTuple):
|
||||
"""A resource with the reason it was allowed (for debugging)."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue