"""Objects representing obsolete MediaWiki sites."""## (C) Pywikibot team, 2019-2022## Distributed under the terms of the MIT license.#from__future__importannotationsimportpywikibotfrompywikibot.exceptionsimportNoPageErrorfrompywikibot.site._apisiteimportAPISitefrompywikibot.site._basesiteimportBaseSite
[docs]classRemovedSite(BaseSite):"""Site removed from a family."""
[docs]classClosedSite(APISite):"""Site closed to read-only mode."""def_closed_error(self,notice:str='')->None:"""An error instead of pointless API call."""pywikibot.error(f'Site {self.sitename} has been closed. {notice}')
[docs]defpage_restrictions(self,page:pywikibot.Page)->dict[str,tuple[str,str]]:"""Return a dictionary reflecting page protections."""ifnotpage.exists():raiseNoPageError(page)ifnothasattr(page,'_protection'):page._protection=dict.fromkeys(('create','delete','edit','move','upload'),('steward','infinity'))returnpage._protection
[docs]defrecentchanges(self,**kwargs)->None:"""An error instead of pointless API call."""self._closed_error('No recent changes can be returned.')
[docs]defis_uploaddisabled(self)->bool:"""Upload is disabled on site."""returnTrue
[docs]defnewpages(self,**kwargs)->None:"""An error instead of pointless API call."""self._closed_error('No new pages can be returned.')