pyjelly 0.6.0__py3-none-any.whl → 0.6.2__py3-none-any.whl
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.
Potentially problematic release.
This version of pyjelly might be problematic. Click here for more details.
- pyjelly/parse/ioutils.py +11 -3
- pyjelly/parse/lookup.py +1 -1
- {pyjelly-0.6.0.dist-info → pyjelly-0.6.2.dist-info}/METADATA +17 -4
- {pyjelly-0.6.0.dist-info → pyjelly-0.6.2.dist-info}/RECORD +7 -7
- {pyjelly-0.6.0.dist-info → pyjelly-0.6.2.dist-info}/WHEEL +0 -0
- {pyjelly-0.6.0.dist-info → pyjelly-0.6.2.dist-info}/entry_points.txt +0 -0
- {pyjelly-0.6.0.dist-info → pyjelly-0.6.2.dist-info}/licenses/LICENSE +0 -0
pyjelly/parse/ioutils.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import io
|
|
1
2
|
import os
|
|
2
3
|
from collections.abc import Generator, Iterator
|
|
3
4
|
from itertools import chain
|
|
@@ -48,7 +49,7 @@ def delimited_jelly_hint(header: bytes) -> bool:
|
|
|
48
49
|
False
|
|
49
50
|
"""
|
|
50
51
|
magic = 0x0A
|
|
51
|
-
return len(header)
|
|
52
|
+
return len(header) >= 3 and ( # noqa: PLR2004
|
|
52
53
|
header[0] != magic or (header[1] == magic and header[2] != magic)
|
|
53
54
|
)
|
|
54
55
|
|
|
@@ -77,8 +78,15 @@ def get_options_and_frames(
|
|
|
77
78
|
stream types, lookup presets and other stream options
|
|
78
79
|
|
|
79
80
|
"""
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
if not inp.seekable():
|
|
82
|
+
# Input may not be seekable (e.g. a network stream) -- then we need to buffer
|
|
83
|
+
# it to determine if it's delimited.
|
|
84
|
+
# See also: https://github.com/Jelly-RDF/pyjelly/issues/298
|
|
85
|
+
inp = io.BufferedReader(inp) # type: ignore[arg-type]
|
|
86
|
+
is_delimited = delimited_jelly_hint(inp.peek(3))
|
|
87
|
+
else:
|
|
88
|
+
is_delimited = delimited_jelly_hint(bytes_read := inp.read(3))
|
|
89
|
+
inp.seek(-len(bytes_read), os.SEEK_CUR)
|
|
82
90
|
|
|
83
91
|
if is_delimited:
|
|
84
92
|
first_frame = None
|
pyjelly/parse/lookup.py
CHANGED
|
@@ -26,7 +26,7 @@ class LookupDecoder:
|
|
|
26
26
|
|
|
27
27
|
def __init__(self, *, lookup_size: int) -> None:
|
|
28
28
|
if lookup_size > MAX_LOOKUP_SIZE:
|
|
29
|
-
msg = f"lookup size
|
|
29
|
+
msg = f"lookup size cannot be larger than {MAX_LOOKUP_SIZE}"
|
|
30
30
|
raise JellyAssertionError(msg)
|
|
31
31
|
self.lookup_size = lookup_size
|
|
32
32
|
placeholders = (None,) * lookup_size
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyjelly
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: Jelly-RDF implementation for Python
|
|
5
5
|
Project-URL: Homepage, https://w3id.org/jelly/pyjelly
|
|
6
6
|
Project-URL: Documentation, https://w3id.org/jelly/pyjelly
|
|
@@ -44,9 +44,22 @@ Description-Content-Type: text/markdown
|
|
|
44
44
|
|
|
45
45
|
## Features
|
|
46
46
|
|
|
47
|
-
- **Fast reading and writing** of RDF knowledge graphs in the [Jelly format](http://w3id.org/jelly)
|
|
48
|
-
- **
|
|
49
|
-
-
|
|
47
|
+
- **Fast reading and writing** of RDF knowledge graphs in the [Jelly format](http://w3id.org/jelly).
|
|
48
|
+
- **Standalone [generic API](https://w3id.org/jelly/pyjelly/dev/generic-sink)** with no third-party dependencies, allowing for:
|
|
49
|
+
- Serialization and parsing of statements to and from Jelly files.
|
|
50
|
+
- Parsing and serializing streams of graphs and statements.
|
|
51
|
+
- Precise control over **serialization options, framing and compression**.
|
|
52
|
+
- **Seamless** integration with:
|
|
53
|
+
- **[rdflib](https://w3id.org/jelly/pyjelly/dev/getting-started)**
|
|
54
|
+
- **[RDFLib-Neo4j](https://w3id.org/jelly/pyjelly/dev/rdflib-neo4j-integration)**
|
|
55
|
+
- **[NetworkX](https://w3id.org/jelly/pyjelly/dev/networkx-integration)**
|
|
56
|
+
- **Stream processing support** for large datasets or streams of all [physical stream types](https://w3id.org/jelly/dev/specification/reference/#physicalstreamtype).
|
|
57
|
+
|
|
58
|
+
**pyjelly** is useful when dealing with (see [full description](https://w3id.org/jelly/pyjelly/dev/overview/#use-cases)):
|
|
59
|
+
|
|
60
|
+
- Dumping and loading **large RDF datasets**.
|
|
61
|
+
- **Client-server communication**.
|
|
62
|
+
- Workflows, where **streaming** is required.
|
|
50
63
|
|
|
51
64
|
## Getting started
|
|
52
65
|
|
|
@@ -17,16 +17,16 @@ pyjelly/jelly/rdf_pb2.py,sha256=qjgS3kQnCJqoOmgzvgk1BeYxGbeDX2zygJPc2vDjRts,8952
|
|
|
17
17
|
pyjelly/jelly/rdf_pb2.pyi,sha256=-gxZO-r2wyN68l83XomySz60c82SZmoPKh1HxamBjZs,11816
|
|
18
18
|
pyjelly/parse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
pyjelly/parse/decode.py,sha256=ze1u7xDz_ySxs4tTqaNN_mpd7GCRN6_Tuz9-xZOwCt8,14381
|
|
20
|
-
pyjelly/parse/ioutils.py,sha256=
|
|
21
|
-
pyjelly/parse/lookup.py,sha256=
|
|
20
|
+
pyjelly/parse/ioutils.py,sha256=0eqLmY1lpxRT5PZjx93g8FGfvpfDsXOkZBq2Ag8vptw,3808
|
|
21
|
+
pyjelly/parse/lookup.py,sha256=_E9sg4p5X8INeeqAZqmLH_HENpONr3IF-GqWVV6TeJc,2197
|
|
22
22
|
pyjelly/serialize/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
23
|
pyjelly/serialize/encode.py,sha256=_ACdaxYAoh7z5ND77ceJikKF_AGlZ-P69XPsnl7Fmsg,12664
|
|
24
24
|
pyjelly/serialize/flows.py,sha256=0C2soigJKyHr3xoR-7v0kc1RL8COwnuCRd4iVZpukFU,5524
|
|
25
25
|
pyjelly/serialize/ioutils.py,sha256=2_NaadLfHO3jKR1ZV7aK6jQ09sPKBar9iLFHYwourz8,400
|
|
26
26
|
pyjelly/serialize/lookup.py,sha256=h0lYFjdB6CIuN2DzAW6EE4ILJFUuto3paAK6DG1DZYg,4091
|
|
27
27
|
pyjelly/serialize/streams.py,sha256=p4RTQ750C4mT64vDxiK0KcUwD0qaAy-rZ7vwwvV_Cy8,8339
|
|
28
|
-
pyjelly-0.6.
|
|
29
|
-
pyjelly-0.6.
|
|
30
|
-
pyjelly-0.6.
|
|
31
|
-
pyjelly-0.6.
|
|
32
|
-
pyjelly-0.6.
|
|
28
|
+
pyjelly-0.6.2.dist-info/METADATA,sha256=5JVdbuV6KtIdSaXABcfSVwHDD8s6g2bykjWx3w-U2iU,5615
|
|
29
|
+
pyjelly-0.6.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
30
|
+
pyjelly-0.6.2.dist-info/entry_points.txt,sha256=kUG0p9zso7HpitdMaQaXEj_KSqgOGsL0Ky9ARbecN1g,339
|
|
31
|
+
pyjelly-0.6.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
32
|
+
pyjelly-0.6.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|