safer 4.6.0__py3-none-any.whl → 4.7.0__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.
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
safer.py,sha256=TphbmidXUkig_zXyOpJaWwhLdS6VxsjBUrHtVVVXB1M,21475
|
|
2
|
+
safer-4.7.0.dist-info/LICENSE,sha256=YrPqlE_MughiZSHUT2iVoduqlqmStMop9EEwCTdlzBw,1067
|
|
3
|
+
safer-4.7.0.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
|
|
4
|
+
safer-4.7.0.dist-info/METADATA,sha256=6C3oDd6MQQpETg5KnME82hhQXFUhdlabopB8iXYYKrU,5303
|
|
5
|
+
safer-4.7.0.dist-info/RECORD,,
|
safer.py
CHANGED
|
@@ -63,7 +63,7 @@ or `io.BytesIO`.
|
|
|
63
63
|
|
|
64
64
|
For very large files, `safer.open()` has a `temp_file` argument which
|
|
65
65
|
writes the data to a temporary file on disk, which is moved over using
|
|
66
|
-
`os.
|
|
66
|
+
`os.replace` if the operation completes successfully. This functionality
|
|
67
67
|
does not work on Windows. (In fact, it's unclear if any of this works on
|
|
68
68
|
Windows, but that certainly won't. Windows developer solicted!)
|
|
69
69
|
|
|
@@ -201,7 +201,7 @@ def writer(
|
|
|
201
201
|
closes
|
|
202
202
|
|
|
203
203
|
temp_file: If `temp_file` is truthy, write to a disk file and use
|
|
204
|
-
os.
|
|
204
|
+
os.replace() at the end, otherwise cache the writes in memory.
|
|
205
205
|
|
|
206
206
|
If `temp_file` is a string, use it as the name of the temporary
|
|
207
207
|
file, otherwise select one in the same directory as the target
|
|
@@ -323,7 +323,7 @@ def open(
|
|
|
323
323
|
if there is an exception.
|
|
324
324
|
|
|
325
325
|
temp_file: If `temp_file` is truthy, write to a disk file and use
|
|
326
|
-
os.
|
|
326
|
+
os.replace() at the end, otherwise cache the writes in memory.
|
|
327
327
|
|
|
328
328
|
If `temp_file` is a string, use it as the name of the temporary
|
|
329
329
|
file, otherwise select one in the same directory as the target
|
|
@@ -385,15 +385,11 @@ def open(
|
|
|
385
385
|
os.makedirs(parent)
|
|
386
386
|
|
|
387
387
|
def simple_open():
|
|
388
|
-
print('simple_open', name, mode)
|
|
389
388
|
return __builtins__['open'](name, mode, buffering, **kwargs)
|
|
390
389
|
|
|
391
390
|
def simple_write(value):
|
|
392
|
-
print('simple_write', name, value)
|
|
393
391
|
with simple_open() as fp:
|
|
394
392
|
fp.write(value)
|
|
395
|
-
print('simple_write done')
|
|
396
|
-
print(__builtins__['open'](name).read())
|
|
397
393
|
|
|
398
394
|
if is_read or not enabled:
|
|
399
395
|
return simple_open()
|
|
@@ -647,7 +643,7 @@ class _FileRenameCloser(_FileCloser):
|
|
|
647
643
|
shutil.copymode(self.target_file, self.temp_file)
|
|
648
644
|
else:
|
|
649
645
|
os.chmod(self.temp_file, 0o100644)
|
|
650
|
-
os.
|
|
646
|
+
os.replace(self.temp_file, self.target_file)
|
|
651
647
|
|
|
652
648
|
|
|
653
649
|
class _StreamCloser(_Closer):
|
|
@@ -664,7 +660,6 @@ class _StreamCloser(_Closer):
|
|
|
664
660
|
closer(self.fp.safer_failed)
|
|
665
661
|
|
|
666
662
|
def _write_on_success(self, v):
|
|
667
|
-
print('_StreamCloser._write_on_success', v, self.write)
|
|
668
663
|
while True:
|
|
669
664
|
written = self.write(v)
|
|
670
665
|
v = (written is not None) and v[written:]
|
safer-4.6.0.dist-info/RECORD
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
safer.py,sha256=8YC1nKYc8rAKl0Wp-A_ORdx8zeTEMgOvljrN646q_xc,21703
|
|
2
|
-
safer-4.6.0.dist-info/LICENSE,sha256=YrPqlE_MughiZSHUT2iVoduqlqmStMop9EEwCTdlzBw,1067
|
|
3
|
-
safer-4.6.0.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
|
|
4
|
-
safer-4.6.0.dist-info/METADATA,sha256=PosOBmTXYX61DOrDnHrd-FPaTtll-Oo6R9PKS-LCxec,5303
|
|
5
|
-
safer-4.6.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|