Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
| 1 |
from rdflib.graph import Graph, QuotedGraph |
| 2 |
from rdflib.term import Node |
| 3 |
from six import text_type |
| 4 |
from sqlalchemy import types |
| 5 |
|
| 6 |
|
| 7 |
class TermType(types.TypeDecorator): |
| 8 |
"""Term typology.""" |
| 9 |
|
| 10 |
impl = types.Text() |
| 11 |
cache_ok = True |
| 12 |
|
| 13 |
def process_bind_param(self, value, dialect): |
| 14 |
"""Process bound parameters.""" |
| 15 |
if isinstance(value, (QuotedGraph, Graph)): |
| 16 |
return text_type(value.identifier) |
| 17 |
elif isinstance(value, Node): |
| 18 |
return text_type(value) |
| 19 |
else: |
| 20 |
return value |