removed unused imports in world.py. More docstrings
Also added __getstate__ and __setstate__ for pickling RegionSet
This commit is contained in:
@@ -17,20 +17,12 @@ import functools
|
|||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
from glob import glob
|
from glob import glob
|
||||||
import multiprocessing
|
|
||||||
import Queue
|
|
||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
import cPickle
|
|
||||||
import collections
|
import collections
|
||||||
import itertools
|
|
||||||
import time
|
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
|
|
||||||
import nbt
|
import nbt
|
||||||
import textures
|
|
||||||
import util
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This module has routines for extracting information about available worlds
|
This module has routines for extracting information about available worlds
|
||||||
@@ -218,7 +210,16 @@ class RegionSet(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, regiondir):
|
def __init__(self, regiondir, cachesize=16):
|
||||||
|
"""Initialize a new RegionSet to access the region files in the given
|
||||||
|
directory.
|
||||||
|
|
||||||
|
regiondir is a path to a directory containing region files.
|
||||||
|
|
||||||
|
cachesize, if specified, is the number of chunks to keep parsed and
|
||||||
|
in-memory.
|
||||||
|
|
||||||
|
"""
|
||||||
#self.world = worldobj
|
#self.world = worldobj
|
||||||
self.regiondir = regiondir
|
self.regiondir = regiondir
|
||||||
|
|
||||||
@@ -234,6 +235,11 @@ class RegionSet(object):
|
|||||||
self.empty_chunk = [None,None]
|
self.empty_chunk = [None,None]
|
||||||
logging.debug("Done scanning regions")
|
logging.debug("Done scanning regions")
|
||||||
|
|
||||||
|
# Re-initialize upon unpickling
|
||||||
|
def __getstate__(self):
|
||||||
|
return self.regiondir
|
||||||
|
__setstate__ = __init__
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<RegionSet regiondir=%r>" % self.regiondir
|
return "<RegionSet regiondir=%r>" % self.regiondir
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user