Пример #1
0
def shutdown_servers(scenario):
    for world_attr in dir(world):
        if not world_attr.startswith('_'):
            obj = world.__getattribute__(world_attr)
            if isinstance(obj, Server):
                obj.go_down()
Пример #2
0
def shutdown_servers(scenario):
    for world_attr in dir(world):
        if not world_attr.startswith('_'):
            obj = world.__getattribute__(world_attr)
            if isinstance(obj, Server):
                obj.go_down()
Пример #3
0
 def save_world(self, filepath):
     with open(filepath, 'w') as f:
         for var in dir(world):
             if not var.startswith('_') and var not in ('absorb', 'spew'):
                 pickle.dump((var, world.__getattribute__(var)), f)
Пример #4
0
 def save_world(self, filepath):
     with open(filepath, 'w') as f:
         for var in dir(world):
             if not var.startswith('_') and var not in ('absorb', 'spew'):
                 pickle.dump((var, world.__getattribute__(var)), f)