linked-data-python 0.6.3__tar.gz → 0.6.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/PKG-INFO +1 -1
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/transpiler/core.py +16 -1
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/linked_data_python.egg-info/PKG-INFO +1 -1
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/pyproject.toml +1 -1
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_prefix_scoping.py +21 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/LICENSE.md +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/README.md +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/__init__.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/__main__.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/backend.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/build.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/console.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/debug.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/formatter.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/importer.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/lsp/__init__.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/lsp/__main__.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/lsp/backend.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/lsp/hover.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/lsp/islanddoc.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/lsp/rpc.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/lsp/server.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/lsp/translate.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/pygments_lexer.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/runtime.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/sparql.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/transpiler/__init__.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/transpiler/errors.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/ldpy/transpiler/linemap.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/linked_data_python.egg-info/SOURCES.txt +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/linked_data_python.egg-info/dependency_links.txt +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/linked_data_python.egg-info/entry_points.txt +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/linked_data_python.egg-info/requires.txt +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/linked_data_python.egg-info/top_level.txt +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/setup.cfg +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_bench.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_bindings.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_build.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_call_suffix.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_charsets.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_coercion.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_console.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_current_graph.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_debug.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_debug_stepping.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_disambiguation.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_docs.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_docstrings.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_examples.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_formatter.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_generator.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_graphs.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_hover_parts.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_identity.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_import_hook.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_islanddoc.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_islands_terms.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_lexing.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_linemap.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_lsp_rpc.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_lsp_server.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_lsp_translate.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_match_island.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_micropython_subset.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_prefix_import.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_pygments_lexer.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_scope_modifiers.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_semantics.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_sourcemap_v3.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_sparql_expr.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_sparql_island.py +0 -0
- {linked_data_python-0.6.3 → linked_data_python-0.6.4}/tests/test_target_micropython.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: linked-data-python
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.4
|
|
4
4
|
Summary: Python extended with Semantic Web primitives: IRIs, RDF literals and Turtle-notation graphs as expressions, transpiled by island parsing.
|
|
5
5
|
Author-email: Maxime Lefrançois <maxime.lefrancois@emse.fr>
|
|
6
6
|
License: MIT
|
|
@@ -1392,6 +1392,10 @@ class Transpiler:
|
|
|
1392
1392
|
self._take(j - self.i) # '@prefix p:' + blancs
|
|
1393
1393
|
parts = self._take_firi_parts()
|
|
1394
1394
|
self._g_ws()
|
|
1395
|
+
as_name, k = self._prefix_as_clause(self.i)
|
|
1396
|
+
if as_name:
|
|
1397
|
+
self._take(k - self.i)
|
|
1398
|
+
self._g_ws()
|
|
1395
1399
|
if self._peek() != ".":
|
|
1396
1400
|
self._error("'.' attendu pour clore la déclaration @prefix")
|
|
1397
1401
|
self._take(1)
|
|
@@ -1411,6 +1415,11 @@ class Transpiler:
|
|
|
1411
1415
|
scope_mode)
|
|
1412
1416
|
gen = "__namespaces__[%r] = %s.Namespace(%r)" % (
|
|
1413
1417
|
prefix, RUNTIME_ALIAS, resolved)
|
|
1418
|
+
if as_name:
|
|
1419
|
+
gen = "__namespaces__[%r] = %s = %s.Namespace(%r)" % (
|
|
1420
|
+
prefix, as_name, RUNTIME_ALIAS, resolved)
|
|
1421
|
+
if scope_mode:
|
|
1422
|
+
gen = "%s %s; %s" % (scope_mode, as_name, gen)
|
|
1414
1423
|
else:
|
|
1415
1424
|
# global/nonlocal : réutiliser la variable de la liaison cible si
|
|
1416
1425
|
# elle est dynamique — c'est elle que les usages du dehors lisent
|
|
@@ -1424,8 +1433,14 @@ class Transpiler:
|
|
|
1424
1433
|
gen = "%s = %s.Namespace(%s.firi(%s)); __namespaces__[%r] = %s" % (
|
|
1425
1434
|
var, RUNTIME_ALIAS, RUNTIME_ALIAS,
|
|
1426
1435
|
self._firi_args(parts), prefix, var)
|
|
1436
|
+
if as_name:
|
|
1437
|
+
# `as EX` on a DYNAMIC prefix binds the Namespace built from
|
|
1438
|
+
# the IRI resolved at that point — the same object the
|
|
1439
|
+
# prefix itself uses, so the two can never disagree.
|
|
1440
|
+
gen += "; %s = %s" % (as_name, var)
|
|
1427
1441
|
if scope_mode:
|
|
1428
|
-
|
|
1442
|
+
names = var if not as_name else "%s, %s" % (var, as_name)
|
|
1443
|
+
gen = "%s %s; %s" % (scope_mode, names, gen)
|
|
1429
1444
|
self._end_island("prefix", mark, gen)
|
|
1430
1445
|
return True
|
|
1431
1446
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: linked-data-python
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.4
|
|
4
4
|
Summary: Python extended with Semantic Web primitives: IRIs, RDF literals and Turtle-notation graphs as expressions, transpiled by island parsing.
|
|
5
5
|
Author-email: Maxime Lefrançois <maxime.lefrancois@emse.fr>
|
|
6
6
|
License: MIT
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "linked-data-python"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.4"
|
|
8
8
|
description = "Python extended with Semantic Web primitives: IRIs, RDF literals and Turtle-notation graphs as expressions, transpiled by island parsing."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -347,3 +347,24 @@ def test_a_prefix_named_as_something_is_not_an_as_clause(run):
|
|
|
347
347
|
ns, _ = run("@prefix ex: <http://example.org/ns#> as assets .\n"
|
|
348
348
|
"t = ex:Thing\n")
|
|
349
349
|
assert str(ns["assets"]) == "http://example.org/ns#"
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
def test_as_works_on_a_dynamic_prefix_too(run):
|
|
353
|
+
"""`@prefix p: f<…> as P .` — the form the corpus actually needed first.
|
|
354
|
+
Every IRI of the region that motivated `as` is computed at run time, so
|
|
355
|
+
`as` on the static form alone would not have covered its own use case."""
|
|
356
|
+
ns, _ = run("host = 'example.org'\n"
|
|
357
|
+
"@prefix dyn: f<http://{host}/ns#> as DYN .\n"
|
|
358
|
+
"a = DYN['x']\n"
|
|
359
|
+
"b = dyn:x\n")
|
|
360
|
+
assert str(ns["DYN"]) == "http://example.org/ns#"
|
|
361
|
+
assert ns["a"] == ns["b"]
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
def test_a_dynamic_as_name_follows_the_scope_modifier(run):
|
|
365
|
+
ns, _ = run("host = 'example.org'\n"
|
|
366
|
+
"def f():\n"
|
|
367
|
+
" global @prefix dyn: f<http://{host}/ns#> as DYN .\n"
|
|
368
|
+
"f()\n"
|
|
369
|
+
"seen = str(DYN)\n")
|
|
370
|
+
assert ns["seen"] == "http://example.org/ns#"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{linked_data_python-0.6.3 → linked_data_python-0.6.4}/linked_data_python.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{linked_data_python-0.6.3 → linked_data_python-0.6.4}/linked_data_python.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{linked_data_python-0.6.3 → linked_data_python-0.6.4}/linked_data_python.egg-info/requires.txt
RENAMED
|
File without changes
|
{linked_data_python-0.6.3 → linked_data_python-0.6.4}/linked_data_python.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|