• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zopefoundation / ZODB / 6920335661

10 Oct 2023 06:43AM UTC coverage: 83.729% (+0.005%) from 83.724%
6920335661

push

github

web-flow
scripts/space.py: fix sorting dict items (#392)

Co-authored-by: Jens Vagelpohl <jens@plyp.com>
Co-authored-by: Michael Howitz <icemac@gmx.net>

2877 of 4048 branches covered (0.0%)

0 of 2 new or added lines in 1 file covered. (0.0%)

13323 of 15912 relevant lines covered (83.73%)

0.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/ZODB/scripts/fsoids.py
1
#!/usr/bin/python
2

3
##############################################################################
4
#
5
# Copyright (c) 2004 Zope Foundation and Contributors.
6
# All Rights Reserved.
7
#
8
# This software is subject to the provisions of the Zope Public License,
9
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
10
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
11
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
12
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
13
# FOR A PARTICULAR PURPOSE
14
#
15
##############################################################################
16

17
"""FileStorage oid-tracer.
×
18

19
usage: fsoids.py [-f oid_file] Data.fs [oid]...
20

21
Display information about all occurrences of specified oids in a FileStorage.
22
This is meant for heavy debugging.
23

24
This includes all revisions of the oids, all objects referenced by the
25
oids, and all revisions of all objects referring to the oids.
26

27
If specified, oid_file is an input text file, containing one oid per
28
line.  oids are specified as integers, in any of Python's integer
29
notations (typically like 0x341a).  One or more oids can also be specified
30
on the command line.
31

32
The output is grouped by oid, from smallest to largest, and sub-grouped
33
by transaction, from oldest to newest.
34

35
This will not alter the FileStorage, but running against a live FileStorage
36
is not recommended (spurious error messages may result).
37

38
See testfsoids.py for a tutorial doctest.
39
"""
40

41
import sys
×
42

43
from ZODB.FileStorage.fsoids import Tracer
×
44

45

46
def usage():
×
47
    print(__doc__)
×
48

49

50
def main():
×
51
    import getopt
×
52

53
    try:
×
54
        opts, args = getopt.getopt(sys.argv[1:], 'f:')
×
55
        if not args:
×
56
            usage()
×
57
            raise ValueError("Must specify a FileStorage")
×
58
        path = None
×
59
        for k, v in opts:
×
60
            if k == '-f':
×
61
                path = v
×
62
    except (getopt.error, ValueError):
×
63
        usage()
×
64
        raise
×
65

66
    c = Tracer(args[0])
×
67
    for oid in args[1:]:
×
68
        as_int = int(oid, 0)  # 0 == auto-detect base
×
69
        c.register_oids(as_int)
×
70
    if path is not None:
×
71
        for line in open(path):
×
72
            as_int = int(line, 0)
×
73
            c.register_oids(as_int)
×
74
    if not c.oids:
×
75
        raise ValueError("no oids specified")
×
76
    c.run()
×
77
    c.report()
×
78

79

80
if __name__ == "__main__":
×
81
    main()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc