ryaml 0.5.0__cp310-cp310-win_amd64.whl → 0.5.1__cp310-cp310-win_amd64.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.
- ryaml/__init__.py +34 -1
- ryaml/_ryaml.cp310-win_amd64.pyd +0 -0
- ryaml/_ryaml.pyi +1 -6
- {ryaml-0.5.0.dist-info → ryaml-0.5.1.dist-info}/METADATA +4 -18
- ryaml-0.5.1.dist-info/RECORD +8 -0
- {ryaml-0.5.0.dist-info → ryaml-0.5.1.dist-info}/WHEEL +1 -1
- ryaml-0.5.0.dist-info/RECORD +0 -8
- {ryaml-0.5.0.dist-info → ryaml-0.5.1.dist-info}/licenses/LICENSE +0 -0
ryaml/__init__.py
CHANGED
|
@@ -1 +1,34 @@
|
|
|
1
|
-
from ._ryaml import InvalidYamlError,
|
|
1
|
+
from ._ryaml import InvalidYamlError, loads, loads_all, dumps
|
|
2
|
+
|
|
3
|
+
from typing import IO, AnyStr, Any
|
|
4
|
+
import io
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def _read_file(fp: IO[AnyStr]) -> str:
|
|
8
|
+
data = fp.read()
|
|
9
|
+
if isinstance(data, str):
|
|
10
|
+
return data
|
|
11
|
+
elif isinstance(data, bytes):
|
|
12
|
+
return data.decode("utf8")
|
|
13
|
+
else:
|
|
14
|
+
return bytes(data).decode('utf8')
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def load(fp: IO[AnyStr]) -> Any:
|
|
18
|
+
if not isinstance(fp, io.IOBase):
|
|
19
|
+
raise TypeError("fp must be a file-like object")
|
|
20
|
+
return loads(_read_file(fp))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def load_all(fp: IO[AnyStr]) -> list[Any]:
|
|
24
|
+
if not isinstance(fp, io.IOBase):
|
|
25
|
+
raise TypeError("fp must be a file-like object")
|
|
26
|
+
return loads_all(_read_file(fp))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def dump(fp: IO[AnyStr], obj: Any) -> None:
|
|
30
|
+
yaml = dumps(obj)
|
|
31
|
+
if isinstance(fp, io.TextIOBase):
|
|
32
|
+
fp.write(yaml) # type: ignore
|
|
33
|
+
else:
|
|
34
|
+
fp.write(yaml.encode('utf8')) # type: ignore
|
ryaml/_ryaml.cp310-win_amd64.pyd
CHANGED
|
Binary file
|
ryaml/_ryaml.pyi
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
# pyright: strict
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any
|
|
3
3
|
|
|
4
4
|
class InvalidYamlError(ValueError): ...
|
|
5
5
|
|
|
6
|
-
def load(fp: IO[AnyStr]) -> Any: ...
|
|
7
|
-
def load_all(fp: IO[AnyStr]) -> list[Any]: ...
|
|
8
|
-
|
|
9
6
|
def loads(s: str) -> Any: ...
|
|
10
7
|
def loads_all(s: str) -> list[Any]: ...
|
|
11
|
-
|
|
12
|
-
def dump(fp: IO[AnyStr], obj: Any) -> None: ...
|
|
13
8
|
def dumps(obj: Any) -> str: ...
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ryaml
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Classifier: Programming Language :: Python
|
|
5
5
|
Classifier: Programming Language :: Rust
|
|
6
6
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -32,23 +32,11 @@ ryaml
|
|
|
32
32
|
|
|
33
33
|
ryaml is a Python library that wraps a Rust yaml parser, [serde-yaml](https://github.com/dtolnay/serde-yaml), to quickly and safely parse and dump yaml to and from Python objects.
|
|
34
34
|
|
|
35
|
-
It is *not* compatible with PyYAML, and it has a similar design to the `json` module.
|
|
36
|
-
|
|
37
|
-
Notable differences between version 1.1 and 1.2 are
|
|
38
|
-
|
|
39
|
-
- YAML 1.2 dropped support for several features unquoted `Yes`,
|
|
40
|
-
`No`, `On`, `Off`
|
|
41
|
-
- YAML 1.2 no longer accepts strings that start with a `0` and solely
|
|
42
|
-
consist of number characters as octal, you need to specify such strings with
|
|
43
|
-
`0o[0-7]+` (zero + lower-case o for octal + one or more octal characters).
|
|
44
|
-
- YAML 1.2 no longer supports `sexagesimals
|
|
45
|
-
<https://en.wikipedia.org/wiki/Sexagesimal>`_, so the string scalar
|
|
46
|
-
`12:34:56` doesn't need quoting.
|
|
47
|
-
- `\/` escape for JSON compatibility
|
|
48
|
-
- correct parsing of floating point scalars with exponentials
|
|
49
|
-
|
|
35
|
+
It is *not* fully compatible with PyYAML, and it has a similar design to the `json` module.
|
|
50
36
|
The hope is this will be used as a safe and fast yaml parser in lieu of PyYAML.
|
|
51
37
|
|
|
38
|
+
Like PyYAML, this library implements the YAML 1.1 specification.
|
|
39
|
+
|
|
52
40
|
## Installation
|
|
53
41
|
|
|
54
42
|
We ship binary wheels for Windows, Linux, and macOS, so as long as you are using Python 3.10+,
|
|
@@ -143,7 +131,5 @@ This project is standing on the shoulders of giants, and would not be possible w
|
|
|
143
131
|
|
|
144
132
|
[yaml-rust](https://github.com/chyh1990/yaml-rust)
|
|
145
133
|
|
|
146
|
-
[pyo3-file](https://github.com/omerbenamram/pyo3-file)
|
|
147
|
-
|
|
148
134
|
[pythonize](https://github.com/davidhewitt/pythonize)
|
|
149
135
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
ryaml\__init__.py,sha256=SoCu5_8xZjcD2tf9Q2N2-sQhpoI7_xslV_4k2EQ8kbQ,922
|
|
2
|
+
ryaml\_ryaml.cp310-win_amd64.pyd,sha256=43gz5CPztYiIe3KOEqySERAAfV7SocYzm42_uLffjec,528896
|
|
3
|
+
ryaml\_ryaml.pyi,sha256=zitmJlENhJDrHVqQi3EPA20lwW9m2QTz-UsuayokvQQ,193
|
|
4
|
+
ryaml\py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
ryaml-0.5.1.dist-info\METADATA,sha256=d7BTjgQCKqtyycuYFa5kVvK4fzEm0lclZ9ay59auT48,3652
|
|
6
|
+
ryaml-0.5.1.dist-info\WHEEL,sha256=L_nHnx2hhpjVM_Xfu45p0kXGA_F4gVVL8EpDS6M9jpM,97
|
|
7
|
+
ryaml-0.5.1.dist-info\licenses\LICENSE,sha256=WJcwKGmnAx7xHrrgLP8BNnLnkR6spwbigreSGuXkYuw,1058
|
|
8
|
+
ryaml-0.5.1.dist-info\RECORD,,
|
ryaml-0.5.0.dist-info/RECORD
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
ryaml-0.5.0.dist-info/METADATA,sha256=NoYzBzCXABx1TVFSqmCPI6vd5uaJxvBA_XfG9Irry3g,4372
|
|
2
|
-
ryaml-0.5.0.dist-info/WHEEL,sha256=diOBRAksuY94NOBHQsE7IIvZ4t9p1N5ocYOeLLhP3Ts,97
|
|
3
|
-
ryaml-0.5.0.dist-info/licenses/LICENSE,sha256=WJcwKGmnAx7xHrrgLP8BNnLnkR6spwbigreSGuXkYuw,1058
|
|
4
|
-
ryaml/__init__.py,sha256=d2syd4DmRWHZ5fMdf2JQJ-lRstvW0KXlDQqA694FzMk,85
|
|
5
|
-
ryaml/_ryaml.cp310-win_amd64.pyd,sha256=JQHQk7cFqYVffCZo4wT5XoLOgkeJwDRZA72AX6RMQ4E,582144
|
|
6
|
-
ryaml/_ryaml.pyi,sha256=ZX7S4jcyirh42s3AWivVBceGSOWpBBmqIrLlj4Rwizk,344
|
|
7
|
-
ryaml/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
ryaml-0.5.0.dist-info/RECORD,,
|
|
File without changes
|