7
7
- Checking paths
8
8
"""
9
9
10
- from io import TextIOWrapper
11
10
import json
12
11
import logging
13
12
import os
14
13
import pkgutil
15
14
import tomllib
16
15
import typing
17
16
from collections .abc import Iterable
17
+ from io import TextIOWrapper
18
18
from pathlib import Path
19
19
20
20
import jsonschema
@@ -69,7 +69,7 @@ def valid_path(path: os.PathLike[str]) -> bool:
69
69
"""
70
70
Check if a given file path is valid.
71
71
72
- This function ensures that the file path does not contain
72
+ This function ensures that the file path does not contain
73
73
potentially dangerous characters such as null bytes (`\x00 `)
74
74
or carriage returns/line feeds (`\n `, `\r `). These characters
75
75
can pose security risks, particularly in file handling operations.
@@ -82,12 +82,12 @@ def valid_path(path: os.PathLike[str]) -> bool:
82
82
Returns
83
83
-------
84
84
bool
85
- A boolean value indicating whether the path is valid
85
+ A boolean value indicating whether the path is valid
86
86
(`True`) or invalid (`False`).
87
87
88
88
Notes
89
89
-----
90
- - This function is useful for validating file paths before performing
90
+ - This function is useful for validating file paths before performing
91
91
file I/O operations to prevent security vulnerabilities.
92
92
93
93
Examples
@@ -229,7 +229,10 @@ def _load_json(file_object: typing.TextIO, schema_name: str) -> object:
229
229
return json_object
230
230
231
231
232
- def _load_toml (file_object : typing .TextIO , schema_name : str ) -> dict [str , typing .Any ]:
232
+ def _load_toml (
233
+ file_object : typing .TextIO ,
234
+ schema_name : str ,
235
+ ) -> dict [str , typing .Any ]:
233
236
"""
234
237
Load TOML from file and validate it against a schema.
235
238
0 commit comments