Exemplo n.º 1
0
def demo_dfxml_time_bug(filename):
    parser = OptionParser()
    parser.usage = '%prog% [options] xmlfile '
    (options, args) = parser.parse_args()
    for fi in fiwalk.fileobjects_using_sax(xmlfile=open(filename, "rb")):
        fsize = fi.filesize()
        try:
            mt = fi.mtime()
            print('Type of mt:', type(mt))
            print('Normal mtime:')
            print(mt)
        except KeyboardInterrupt:
            raise
        except:
            raise
            print('Abnormal mtime for file with size', fsize)
Exemplo n.º 2
0
def demo_dfxml_time_bug(filename):
    parser = OptionParser()
    parser.usage = '%prog% [options] xmlfile '
    (options,args) = parser.parse_args()
    for fi in fiwalk.fileobjects_using_sax(xmlfile=open(filename,"rb")):
        fsize = fi.filesize()
        try:
            mt = fi.mtime()
            print('Type of mt:',type(mt))
            print('Normal mtime:')
            print(mt)
        except KeyboardInterrupt:
            raise
        except:
            raise
            print('Abnormal mtime for file with size',fsize)
Exemplo n.º 3
0
    parser.add_option("-x","--xmlfile",help="XML file (required)")
    parser.add_option("-i","--imagefile",help="image file (required)")
    parser.usage = '%prog [options] xmlfile diskimage'
    (options,args) = parser.parse_args()

    if not options.xmlfile or not options.imagefile:
        parser.print_help()
        sys.exit(1)

    # Read the redaction configuration file
    imagefile = open(options.imagefile,"r")
    xmlfile   = open(options.xmlfile,"r")

    t0 = time.time()
    
    fis = fiwalk.fileobjects_using_sax(imagefile=imagefile,xmlfile=xmlfile)
    t1 = time.time()
    print "Time to read %s: %g seconds" % (xmlfile.name,t1-t0)

    # Create a new array with just those that we can read
    def resident_file(fi):
        if len(fi.byte_runs())==0: return False
        if len(fi.byte_runs())>2: return False
        if hasattr(fi.byte_runs()[0],"uncompressed_len"): return False
        if not hasattr(fi.byte_runs()[0],"img_offset"): return False
        return True

    fis = filter(resident_file,fis)

    print "Native order: "
    calc_jumps(fis,"Native Order")
Exemplo n.º 4
0
    # rotates and right aligns the x labels, and moves the bottom of the
    # axes up to make room for them
    fig.autofmt_xdate()
    plt.savefig("hist.pdf",format='pdf')
                
    print("dates:",dates)
    print("num dates:",len(dates))

    
    
if __name__=="__main__":
    import sys
    from optparse import OptionParser
    from sys import stdout

    parser = OptionParser()
    parser.usage = '%prog [options] xmlfile '
    (options,args) = parser.parse_args()

    import time
    times = []
    for fi in fiwalk.fileobjects_using_sax(xmlfile=open(args[0])):
        try:
            times.append(fi.mtime())
        except KeyError:
            pass

    version3(times)

    
Exemplo n.º 5
0
    parser.usage = '%prog [options] xmlfile diskimage'
    (options,args) = parser.parse_args()

    if not options.xmlfile or not options.imagefile:
        parser.print_help()
        sys.exit(1)

    # Read the redaction configuration file
    imagefile = open(options.imagefile,"r")
    if options.xmlfile:
        xmlfile   = open(options.xmlfile,"r")
    else:
        xmlfile   = None

    t0  = time.time()
    fis = fiwalk.fileobjects_using_sax(imagefile=imagefile,xmlfile=xmlfile)
    t1  = time.time()
    print("Time to read file objects: {} seconds".format(t1-t0))

    # Create a new array with just those that we can read
    def resident_file(fi):
        if len(fi.byte_runs())==0: return False
        if len(fi.byte_runs())>2: return False
        if hasattr(fi.byte_runs()[0],"uncompressed_len"): return False
        if not hasattr(fi.byte_runs()[0],"img_offset"): return False
        return True

    fis = filter(resident_file,fis)

    print "Native order: "
    calc_jumps(fis,"Native Order")
Exemplo n.º 6
0
    ax.format_ydata = price
    ax.grid(True)

    # rotates and right aligns the x labels, and moves the bottom of the
    # axes up to make room for them
    fig.autofmt_xdate()
    plt.savefig("hist.pdf", format='pdf')

    print("dates:", dates)
    print("num dates:", len(dates))


if __name__ == "__main__":
    import sys
    from optparse import OptionParser
    from sys import stdout

    parser = OptionParser()
    parser.usage = '%prog [options] xmlfile '
    (options, args) = parser.parse_args()

    import time
    times = []
    for fi in fiwalk.fileobjects_using_sax(xmlfile=open(args[0])):
        try:
            times.append(fi.mtime())
        except KeyError:
            pass

    version3(times)