summaryrefslogtreecommitdiff
path: root/test/lib/ansible_test/_internal/io.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/ansible_test/_internal/io.py')
-rw-r--r--test/lib/ansible_test/_internal/io.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/lib/ansible_test/_internal/io.py b/test/lib/ansible_test/_internal/io.py
index 80d4769931..eb745be4c0 100644
--- a/test/lib/ansible_test/_internal/io.py
+++ b/test/lib/ansible_test/_internal/io.py
@@ -34,12 +34,13 @@ def make_dirs(path: str) -> None:
os.makedirs(to_bytes(path), exist_ok=True)
-def write_json_file(path: str,
- content: t.Any,
- create_directories: bool = False,
- formatted: bool = True,
- encoder: t.Optional[t.Type[json.JSONEncoder]] = None,
- ) -> str:
+def write_json_file(
+ path: str,
+ content: t.Any,
+ create_directories: bool = False,
+ formatted: bool = True,
+ encoder: t.Optional[t.Type[json.JSONEncoder]] = None,
+) -> str:
"""Write the given json content to the specified path, optionally creating missing directories."""
text_content = json.dumps(content,
sort_keys=formatted,
@@ -80,6 +81,7 @@ def open_binary_file(path: str, mode: str = 'rb') -> t.IO[bytes]:
class SortedSetEncoder(json.JSONEncoder):
"""Encode sets as sorted lists."""
+
def default(self, o: t.Any) -> t.Any:
"""Return a serialized version of the `o` object."""
if isinstance(o, set):