I hereby claim:
- I am edwardbetts on github.
- I am edwardbetts (https://keybase.io/edwardbetts) on keybase.
- I have a public key whose fingerprint is 26B3 E244 3423 7F38 C93A 73E6 99C8 9075 1BC4 E32B
To claim this, I am signing this object:
from urllib import quote_plus | |
from lxml import etree | |
def untruncate(s): | |
q = s.strip(u' .\u2026') | |
url = 'http://google.com/complete/search?output=toolbar&q=' + quote_plus(q.encode('latin-1')) | |
root = etree.parse(url).getroot() | |
return q + root[0][0].attrib['data'][len(q):] if len(root) else s | |
def demo(): |
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
from pprint import pformat | |
from typing import Any | |
from pygments import highlight | |
from pygments.formatters import Terminal256Formatter | |
from pygments.lexers import PythonLexer | |
def pprint_color(obj: Any) -> None: | |
"""Pretty-print in color.""" |
def getch(): | |
fd = sys.stdin.fileno() | |
old_settings = termios.tcgetattr(fd) | |
try: | |
tty.setraw(fd) | |
ch = sys.stdin.read(1) | |
except KeyboardInterrupt: | |
raise | |
finally: | |
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) |
This is an example of how to locate Wikidata items from a SPARQL query on OpenStreetMap. | |
The overpass_query.py Python code will run a SPARQL query and use the results to generate an OSM Overpass query. | |
The name of a file containing a SPARQL query should be passed to overpass_query.py as the first command line argument. For example: | |
python overpass_query.py query.sparql | |
The query will find matching objects using the OSM wikidata tag. |