Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
5bc41c9b
Commit
5bc41c9b
authored
Feb 28, 2013
by
Marius Gedminas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use with open() in more places
parent
08a93058
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
22 deletions
+21
-22
src/ZODB/scripts/fstest.py
src/ZODB/scripts/fstest.py
+19
-20
src/ZODB/tests/blob_layout.txt
src/ZODB/tests/blob_layout.txt
+2
-2
No files found.
src/ZODB/scripts/fstest.py
View file @
5bc41c9b
...
@@ -76,26 +76,25 @@ def U64(v):
...
@@ -76,26 +76,25 @@ def U64(v):
return
l
return
l
def
check
(
path
):
def
check
(
path
):
file
=
open
(
path
,
'rb'
)
with
open
(
path
,
'rb'
)
as
file
:
file
.
seek
(
0
,
2
)
file
.
seek
(
0
,
2
)
file_size
=
file
.
tell
()
file_size
=
file
.
tell
()
if
file_size
==
0
:
if
file_size
==
0
:
raise
FormatError
(
"empty file"
)
raise
FormatError
(
"empty file"
)
file
.
seek
(
0
)
file
.
seek
(
0
)
if
file
.
read
(
4
)
!=
packed_version
:
if
file
.
read
(
4
)
!=
packed_version
:
raise
FormatError
(
"invalid file header"
)
raise
FormatError
(
"invalid file header"
)
pos
=
4
pos
=
4
tid
=
b'
\
000
'
*
8
# lowest possible tid to start
tid
=
b'
\
000
'
*
8
# lowest possible tid to start
i
=
0
i
=
0
while
pos
:
while
pos
:
_pos
=
pos
_pos
=
pos
pos
,
tid
=
check_trec
(
path
,
file
,
pos
,
tid
,
file_size
)
pos
,
tid
=
check_trec
(
path
,
file
,
pos
,
tid
,
file_size
)
if
tid
is
not
None
:
if
tid
is
not
None
:
chatter
(
"%10d: transaction tid %s #%d
\
n
"
%
chatter
(
"%10d: transaction tid %s #%d
\
n
"
%
(
_pos
,
hexify
(
tid
),
i
))
(
_pos
,
hexify
(
tid
),
i
))
i
=
i
+
1
i
=
i
+
1
def
check_trec
(
path
,
file
,
pos
,
ltid
,
file_size
):
def
check_trec
(
path
,
file
,
pos
,
ltid
,
file_size
):
...
...
src/ZODB/tests/blob_layout.txt
View file @
5bc41c9b
...
@@ -141,7 +141,7 @@ it will leave a marker with the choosen layout if no marker exists yet:
...
@@ -141,7 +141,7 @@ it will leave a marker with the choosen layout if no marker exists yet:
>>> fsh.layout_name
>>> fsh.layout_name
'bushy'
'bushy'
>>> fsh.create()
>>> fsh.create()
>>>
open(os.path.join(blobs, LAYOUT_MARKER), 'rb')
.read()
>>>
with open(os.path.join(blobs, LAYOUT_MARKER), 'rb') as fp: fp
.read()
'bushy'
'bushy'
If the FSH finds a marker, then it verifies whether its content matches the
If the FSH finds a marker, then it verifies whether its content matches the
...
@@ -171,7 +171,7 @@ the marker will be used in the future:
...
@@ -171,7 +171,7 @@ the marker will be used in the future:
>>> blob_storage = BlobStorage(blobs, base_storage)
>>> blob_storage = BlobStorage(blobs, base_storage)
>>> blob_storage.fshelper.layout_name
>>> blob_storage.fshelper.layout_name
'lawn'
'lawn'
>>>
open(os.path.join(blobs, LAYOUT_MARKER), 'rb')
.read()
>>>
with open(os.path.join(blobs, LAYOUT_MARKER), 'rb') as fp: fp
.read()
'lawn'
'lawn'
>>> blob_storage = BlobStorage('blobs', base_storage, layout='bushy')
>>> blob_storage = BlobStorage('blobs', base_storage, layout='bushy')
... # doctest: +ELLIPSIS
... # doctest: +ELLIPSIS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment