jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/513305 )
Change subject: Revert "A BaseSite subclass for non MW sites." ......................................................................
Revert "A BaseSite subclass for non MW sites."
A Site that does nothing except raising exceptions is not an appropriate implementation. Refer PEP20: Now is better than never. Although never is often better than *right* now. Pretty sure the last fits here since 4 years
This reverts commit 46a3a8525e59218c371af7f77366ed831427b7f4.
Change-Id: Idfe3add9d80a10cde060fbbb4273a1df004a6525 --- M pywikibot/site.py M tests/site_tests.py 2 files changed, 0 insertions(+), 40 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py index d074b6c..47ccc63 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -1820,25 +1820,6 @@ super(RemovedSite, self).__init__(code, fam, user, sysop)
-class NonMWAPISite(BaseSite): - - """API interface to non MediaWiki sites.""" - - def __init__(self, url): - """Initializer.""" - self.netloc = urlparse(url).netloc - - def __getattribute__(self, attr): - """Return attribute if present else raise NotImplementedError.""" - whitelist = ['__getattribute__', 'netloc'] - if attr in whitelist: - return super(NonMWAPISite, self).__getattribute__(attr) - else: - raise NotImplementedError('The attribute %s has not been on ' - 'site %s implemented yet.' - % (attr, self.netloc)) - - class APISite(BaseSite):
""" diff --git a/tests/site_tests.py b/tests/site_tests.py index dd8f68f..d4baea1 100644 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -3531,27 +3531,6 @@ pywikibot.Site, 'en', 'wikidata')
-class TestNonMWAPISite(TestCase): - - """Test the BaseSite subclass, site.NonMWAPISite.""" - - net = False - - def test_non_mw_sites(self): - """Test NonMWAPISite for sites not using MediaWiki.""" - self._run_test('http://moinmo.in/$1') - self._run_test('http://twiki.org/cgi-bin/view/$1') - self._run_test('http://www.usemod.com/cgi-bin/wiki.pl?$1') - self._run_test('https://developer.mozilla.org/en/docs/$1') - self._run_test('http://www.tvtropes.org/pmwiki/pmwiki.php/Main/$1') - - def _run_test(self, url): - """Run test method.""" - site = pywikibot.site.NonMWAPISite(url) - with self.assertRaises(NotImplementedError): - site.attr - - class TestSiteProofreadinfo(DefaultSiteTestCase):
"""Test proofreadinfo information."""
pywikibot-commits@lists.wikimedia.org