pyjelly 0.6.0__py3-none-any.whl → 0.6.1__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 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) == 3 and ( # noqa: PLR2004
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
- is_delimited = delimited_jelly_hint(bytes_read := inp.read(3))
81
- inp.seek(-len(bytes_read), os.SEEK_CUR)
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyjelly
3
- Version: 0.6.0
3
+ Version: 0.6.1
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
@@ -17,7 +17,7 @@ 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=O3wRtL5tf1WyIZ1LTfHjHwjKEGrhIWqFisOWjYmspNg,3434
20
+ pyjelly/parse/ioutils.py,sha256=0eqLmY1lpxRT5PZjx93g8FGfvpfDsXOkZBq2Ag8vptw,3808
21
21
  pyjelly/parse/lookup.py,sha256=1AbdZEycLC4tRfh3fgF5hv5PrhwhdWvCUC53iHt-E4c,2193
22
22
  pyjelly/serialize/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  pyjelly/serialize/encode.py,sha256=_ACdaxYAoh7z5ND77ceJikKF_AGlZ-P69XPsnl7Fmsg,12664
@@ -25,8 +25,8 @@ pyjelly/serialize/flows.py,sha256=0C2soigJKyHr3xoR-7v0kc1RL8COwnuCRd4iVZpukFU,55
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.0.dist-info/METADATA,sha256=c2BD1jdHBcFMne7uIaWO6uqIq9BE51b79_tbCZwIVM0,4753
29
- pyjelly-0.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
- pyjelly-0.6.0.dist-info/entry_points.txt,sha256=kUG0p9zso7HpitdMaQaXEj_KSqgOGsL0Ky9ARbecN1g,339
31
- pyjelly-0.6.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
32
- pyjelly-0.6.0.dist-info/RECORD,,
28
+ pyjelly-0.6.1.dist-info/METADATA,sha256=scN1jhC-58MfUscg9VcgWRCBPW4Y9h2_RjlOsxuS6uw,4753
29
+ pyjelly-0.6.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
+ pyjelly-0.6.1.dist-info/entry_points.txt,sha256=kUG0p9zso7HpitdMaQaXEj_KSqgOGsL0Ky9ARbecN1g,339
31
+ pyjelly-0.6.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
32
+ pyjelly-0.6.1.dist-info/RECORD,,