/usr/lib/python3/dist-packages/SPARQLWrapper/KeyCaseInsensitiveDict.py is in python3-sparqlwrapper 1.7.6-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # -*- coding: utf-8 -*-
"""
A simple implementation of a key case-insensitive dictionary.
@authors: U{Ivan Herman<http://www.ivan-herman.net>}, U{Sergio Fernández<http://www.wikier.org>}, U{Carlos Tejo Alonso<http://www.dayures.net>}
@organization: U{World Wide Web Consortium<http://www.w3.org>} and U{Foundation CTIC<http://www.fundacionctic.org/>}.
@license: U{W3C® SOFTWARE NOTICE AND LICENSE<href="http://www.w3.org/Consortium/Legal/copyright-software">}
"""
class KeyCaseInsensitiveDict(dict):
"""
A simple implementation of a key case-insensitive dictionary
"""
def __init__(self, d={}):
for k, v in list(d.items()):
self[k] = v
def __setitem__(self, key, value):
if (hasattr(key, "lower")):
key = key.lower()
dict.__setitem__(self, key, value)
def __getitem__(self, key):
if (hasattr(key, "lower")):
key = key.lower()
return dict.__getitem__(self, key)
def __delitem__(self, key):
if hasattr(key, "lower"):
key = key.lower()
dict.__delitem__(self, key)
|