specitems 1.7.4__tar.gz → 1.7.5__tar.gz
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.
- {specitems-1.7.4 → specitems-1.7.5}/PKG-INFO +1 -1
- {specitems-1.7.4 → specitems-1.7.5}/pyproject.toml +1 -1
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/items.py +19 -8
- {specitems-1.7.4 → specitems-1.7.5}/README.md +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/__init__.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/cite.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/clangformat.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/clihash.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/clipickle.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/clispecdoc.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/clitypeview.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/cliutil.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/cliverify.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/cliyamlquery.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/content.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/contentcommonmark.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/contentmarkdown.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/contentsphinx.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/contenttext.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/copyrights.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/getvaluesubprocess.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/glossary.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/hashutil.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/itemmapper.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/licenseinfo.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/py.typed +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/spdx.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/spec.pickle +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/specconfig.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/specdoc.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/specformatter.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/specverify.py +0 -0
- {specitems-1.7.4 → specitems-1.7.5}/src/specitems/subprocessaction.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: specitems
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.5
|
|
4
4
|
Summary: Provides interfaces to work with specification items.
|
|
5
5
|
Keywords: certification,documentation,markdown,qualification,requirements-management,traceability
|
|
6
6
|
Author: The specitems Authors
|
|
@@ -37,8 +37,8 @@ import logging
|
|
|
37
37
|
import os
|
|
38
38
|
import pickle
|
|
39
39
|
import re
|
|
40
|
+
import secrets
|
|
40
41
|
import stat
|
|
41
|
-
import tempfile
|
|
42
42
|
from typing import (Any, Callable, Collection, Iterable, Iterator, Match,
|
|
43
43
|
Optional, Union)
|
|
44
44
|
import json
|
|
@@ -753,6 +753,18 @@ def _json_load_data_by_uid(data_by_uid: ItemDataByUID, _cache_dir: str,
|
|
|
753
753
|
path_2)
|
|
754
754
|
|
|
755
755
|
|
|
756
|
+
def _create_temporary_file(directory: str, suffix: str) -> tuple[int, str]:
|
|
757
|
+
while True:
|
|
758
|
+
path = os.path.join(directory, f".tmp-{secrets.token_hex(8)}{suffix}")
|
|
759
|
+
try:
|
|
760
|
+
# The umask applies to this mode, as for a file which open()
|
|
761
|
+
# creates.
|
|
762
|
+
return os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL,
|
|
763
|
+
0o666), path
|
|
764
|
+
except FileExistsError:
|
|
765
|
+
continue
|
|
766
|
+
|
|
767
|
+
|
|
756
768
|
def atomic_dump_to_file(path: str, data: Any,
|
|
757
769
|
dumper: Callable[[Any], str | bytes]) -> None:
|
|
758
770
|
"""
|
|
@@ -765,6 +777,9 @@ def atomic_dump_to_file(path: str, data: Any,
|
|
|
765
777
|
as the path. The temporary file is then renamed to the path. This way, a
|
|
766
778
|
failure while producing the content cannot truncate or corrupt an already
|
|
767
779
|
existing file at the path.
|
|
780
|
+
|
|
781
|
+
A file which exists keeps its permissions. A new file gets the
|
|
782
|
+
permissions which the umask leaves of 0o666.
|
|
768
783
|
"""
|
|
769
784
|
dumped = dumper(data)
|
|
770
785
|
encoding: Optional[str] = None
|
|
@@ -776,13 +791,9 @@ def atomic_dump_to_file(path: str, data: Any,
|
|
|
776
791
|
directory = os.path.dirname(os.path.abspath(path))
|
|
777
792
|
tmp_path: Optional[str] = None
|
|
778
793
|
try:
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
prefix=".tmp-",
|
|
783
|
-
suffix=os.path.basename(path),
|
|
784
|
-
delete=False) as out:
|
|
785
|
-
tmp_path = out.name
|
|
794
|
+
fd, tmp_path = _create_temporary_file(directory,
|
|
795
|
+
os.path.basename(path))
|
|
796
|
+
with os.fdopen(fd, mode, encoding=encoding) as out:
|
|
786
797
|
with suppress(OSError):
|
|
787
798
|
os.chmod(tmp_path, stat.S_IMODE(os.stat(path).st_mode))
|
|
788
799
|
out.write(dumped)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|