Ignore:
Timestamp:
Feb 5, 2012 7:29:57 PM (13 years ago)
Author:
Ted Faber <faber@…>
Branches:
compt_changes, master
Children:
25930db
Parents:
e8979e2
Message:

Initial benito plug in. Fixed bug pickling topdl as well

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/deter/topdl.py

    re8979e2 r6a50b78  
    250250        return rv
    251251
     252    def __getstate__(self):
     253        d = self.__dict__.copy()
     254        del d['interfaces']
     255        return d
     256
     257    def __setstate__(self, d):
     258        # Import everything from the pickle dict (except what we excluded in
     259        # __getstate__)
     260        self.__dict__.update(d)
     261        self.interfaces = []
     262
    252263class CPU(base):
    253264    def __init__(self, type, attribute=[]):
     
    417428                    for a in self.attribute], "")
    418429        return rv
     430
     431    def __getstate__(self):
     432        d = self.__dict__.copy()
     433        del d['subs']
     434        return d
     435
     436    def __setstate__(self, d):
     437        # Import everything from the pickle dict (except what we excluded in
     438        # __getstate__)
     439        self.__dict__.update(d)
     440        self.subs = []
    419441
    420442
     
    813835        return rv
    814836
     837    def __setstate__(self, d):
     838        # Import everything from the pickle dict and call incorporate to
     839        # connect them.
     840        self.__dict__.update(d)
     841        self.incorporate_elements()
     842
    815843
    816844def topology_from_xml(string=None, file=None, filename=None, top="topology"):
     
    891919        xp.ParseFile(file)
    892920    elif string:
    893         xp.Parse(string, isfinal=True)
     921        xp.Parse(string, True)
    894922    else:
    895923        return None
Note: See TracChangeset for help on using the changeset viewer.