check.py
Command line tool for testing SPARQl queries against an endpoint.
- scribe_data.wikidata.check_query.check.ping(url: str, timeout: int) bool[source]
Test if a URL is reachable.
- Parameters:
- urlstr
The URL to test.
- timeoutint
The maximum number of seconds to wait for a reply.
- Returns:
- bool
True if connectivity is established, False otherwise.
- scribe_data.wikidata.check_query.check.all_queries() list[QueryFile][source]
All the SPARQL queries in, and below, ‘Scribe-Data/’.
- Returns:
- list[QueryFile]
List of SPARQL query files.
- scribe_data.wikidata.check_query.check.changed_queries() list[QueryFile] | None[source]
Find all the SPARQL queries that have changed.
Includes new queries.
- Returns:
- Optional[list[QueryFile]]
List of changed/new SPARQL queries, or None if there’s an error.
- scribe_data.wikidata.check_query.check.check_sparql_file(fpath: str) Path[source]
Check meta information of SPARQL query file.
- Parameters:
- fpathstr
The file to validate.
- Returns:
- Path
The validated file path.
- scribe_data.wikidata.check_query.check.check_positive_int(value: str, err_msg: str) int[source]
Ensure ‘value’ is a positive number.
- Parameters:
- valuestr
The value to be validated.
- err_msgstr
Used when value fails validation.
- Returns:
- int
The validated number.
- Raises:
- argparse.ArgumentTypeError
- scribe_data.wikidata.check_query.check.check_limit(limit: str) int[source]
Validate the ‘limit’ argument.
- Parameters:
- limitstr
The LIMIT to be validated.
- Returns:
- int
The validated LIMIT.
- Raises:
- argparse.ArgumentTypeError
- scribe_data.wikidata.check_query.check.check_timeout(timeout: str) int[source]
Validate the ‘timeout’ argument.
- Parameters:
- timeoutstr
The timeout to be validated.
- Returns:
- int
The validated timeout.
- Raises:
- argparse.ArgumentTypeError
- scribe_data.wikidata.check_query.check.main(argv=None) int[source]
The main function.
- Parameters:
- argvNone (default=None)
If set to None then argparse will use sys.argv as the arguments.
- Returns:
- int
The exit status - 0 - success; any other value - failure.
- scribe_data.wikidata.check_query.check.error_report(failures: list[QueryExecutionException]) None[source]
Report failed queries.
- Parameters:
- failureslist[QueryExecutionException]
Failed queries.