jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1100493?usp=email )
Change subject: cleanup: Desupport MW < 1.31 ......................................................................
cleanup: Desupport MW < 1.31
- update documentation - update SparqlQuery - update sparql_endpoint and concept_base_uri of DataSite
Bug: T378984 Change-Id: Ic07573ccb474eb8dabcfb4122043b65488cb1df0 --- M README.rst M docs/index.rst M pywikibot/data/sparql.py M pywikibot/site/_datasite.py 4 files changed, 17 insertions(+), 23 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/README.rst b/README.rst index 5105d06..b63a5d7 100644 --- a/README.rst +++ b/README.rst @@ -35,7 +35,7 @@
The Pywikibot framework is a Python library that interfaces with the `MediaWiki API https://www.mediawiki.org/wiki/API:Main_page`_ -version 1.27 or higher. +version 1.31 or higher.
Also included are various general function scripts that can be adapted for different tasks. diff --git a/docs/index.rst b/docs/index.rst index 228bc7b..8ee6069 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,7 +12,7 @@ The project started in 2003 and is currently on core version |version|. It features full API usage and is up-to-date with new MediaWiki features and a Pythonic package layout. But it also works with older installations of -MediaWiki 1.27 or higher. For older MediaWiki versions you have to use older +MediaWiki 1.31 or higher. For older MediaWiki versions you have to use older Pywikibot releases; refer :manpage:`Compatibility`.
Pywikibot supports Microsoft Windows, macOS and Linux when used with a diff --git a/pywikibot/data/sparql.py b/pywikibot/data/sparql.py index d217e8b..622c012 100644 --- a/pywikibot/data/sparql.py +++ b/pywikibot/data/sparql.py @@ -46,31 +46,27 @@ """Create endpoint.
:param endpoint: SPARQL endpoint URL - :param entity_url: URL prefix for any entities returned in a query. - :param repo: The Wikibase site which we want to run queries on. If - provided this overrides any value in endpoint and entity_url. - Defaults to Wikidata. + :param entity_url: URL prefix for any entities returned in a + query. + :param repo: The Wikibase site which we want to run queries on. + If provided this overrides any value in endpoint and + entity_url. Defaults to Wikidata. :type repo: pywikibot.site.DataSite - :param max_retries: (optional) Maximum number of times to retry after - errors, defaults to config.max_retries. - :param retry_wait: (optional) Minimum time in seconds to wait after an - error, defaults to config.retry_wait seconds (doubles each retry - until config.retry_max is reached). + :param max_retries: (optional) Maximum number of times to retry + after errors, defaults to config.max_retries. + :param retry_wait: (optional) Minimum time in seconds to wait + after an error, defaults to config.retry_wait seconds + (doubles each retry until config.retry_max is reached). + :raises Error: The site does not provide a sparql endpoint or if + initialised with an endpoint the entity_url must be provided. """ # default to Wikidata if not repo and not endpoint: repo = Site('wikidata')
if repo: - try: - self.endpoint = repo.sparql_endpoint - self.entity_url = repo.concept_base_uri - except NotImplementedError: - raise NotImplementedError( - 'Wiki version must be 1.28-wmf.23 or newer to ' - 'automatically extract the sparql endpoint. ' - 'Please provide the endpoint and entity_url ' - 'parameters instead of a repo.') + self.endpoint = repo.sparql_endpoint + self.entity_url = repo.concept_base_uri if not self.endpoint: raise Error( f'The site {repo} does not provide a sparql endpoint.') diff --git a/pywikibot/site/_datasite.py b/pywikibot/site/_datasite.py index 8568485..5d61f1b 100644 --- a/pywikibot/site/_datasite.py +++ b/pywikibot/site/_datasite.py @@ -24,7 +24,7 @@ NoWikibaseEntityError, ) from pywikibot.site._apisite import APISite -from pywikibot.site._decorators import need_extension, need_right, need_version +from pywikibot.site._decorators import need_extension, need_right from pywikibot.tools import deprecated, merge_unique_dicts, remove_last_args
@@ -138,7 +138,6 @@ raise NoWikibaseEntityError(entity)
@property - @need_version('1.28-wmf.3') def sparql_endpoint(self): """Return the sparql endpoint url, if any has been set.
@@ -148,7 +147,6 @@ return self.siteinfo['general'].get('wikibase-sparql')
@property - @need_version('1.28-wmf.23') def concept_base_uri(self): """Return the base uri for concepts/entities.
pywikibot-commits@lists.wikimedia.org