[docs]classObject:"""Represents a generic AO3 object. This serves as a standin for user items when the full data to form those items isn't available. Parameters ---------- id: :class:`int` | None, optional The ID of the object. This or `name` must be provided. Defaults to None. name: :class:`str` | None, optional The name of the object. This or `id` must be provided. Defaults to None. type: type[:class:`Page`] | None, optional The type of the object, which can be any Page subclasses. Defaults to None, which is substituted with `Object`. Attributes ---------- id: :class:`int` | None, optional The ID of the object. Defaults to None. name: :class:`str` | None, optional The name of the object. Defaults to None. type: type[:class:`ao3.abc.Page`] | type[:class:`Object`] The type of the object, which can be any Page subclasses. Defaults to `Object`. """__slots__=("id","name","type")def__init__(self,*,id:SupportsIntCast|None=None,name:str|None=None,type:type[Page]|None=None,)->None:ifidisNoneandnameisNone:msg="At least one of id and name must be specified."raiseValueError(msg)ifidisnotNone:try:id=int(id)exceptValueError:msg=f"id parameter must be int-compatible, not {id.__class__}"raiseValueError(msg)fromNoneself.id=idself.name=nameself.type=typeorself.__class__def__eq__(self,__value:object)->bool:ifisinstance(__value,self.type):returnself.id==__value.idreturnNotImplementeddef__hash__(self)->int:returnhash(tuple(attrforattrin(self.id,self.name,self.type)ifattrisnotNone))def__repr__(self)->str:attrs_=("id","name","type")resolved=(f"{attr}={val}"forattrinattrs_if(val:=getattr(self,attr))isnotNone)returnf"{type(self).__name__}({' '.join(resolved)})"