Permalink
Browse files

Cleaned up commit conflicts and replaced bugfix

Changing region.py to use os.remove() was good for Windows, but it
needed to catch OSError.  Fixed that.  Also apparently memoize changed
between releases.  Fixed that too.
  • Loading branch information...
mathuin committed Oct 16, 2012
1 parent d7eec59 commit 3d79077cfb898c950df4e3588bfda334b9c1ad70
Showing with 8 additions and 21 deletions.
  1. +0 −19 memoize.py
  2. +8 −2 region.py
View
@@ -1,22 +1,4 @@
# http://askawizard.blogspot.com/2008/09/decorators-python-saga-part-2_28.html
-<<<<<<< HEAD
-class memoize(object):
- def __init__(self, cache = None):
- self.cache = cache
- def __call__(self, function):
- return Memoized(function, self.cache)
-
-class Memoized(object):
- def __init__(self, function, cache = None):
- if cache is None: cache = {}
- self.function = function
- self.cache = cache
- def __call__(self, *args):
- if args not in self.cache:
- self.cache[args] = self.function(*args)
- return self.cache[args]
-
-=======
class memoize:
def __init__(self, cache = None):
self.cache = cache
@@ -32,4 +14,3 @@ def __call__(self, *args):
if args not in self.cache:
self.cache[args] = self.function(*args)
return self.cache[args]
->>>>>>> release/1.0
View
@@ -517,7 +517,10 @@ def buildmap(self, wantCL=True):
elextents = self.albersextents['elevation']
warpcmd = 'gdalwarp -q -multi -t_srs "%s" -tr %d %d -te %d %d %d %d -r cubic %s %s' % (Region.t_srs, self.scale, self.scale, elextents['xmin'], elextents['ymin'], elextents['xmax'], elextents['ymax'], elvrt, elfile)
- os.remove(elfile)
+ try:
+ os.remove(elfile)
+ except OSError:
+ pass
# NB: make this work on Windows too!
os.system("%s" % warpcmd)
@@ -638,7 +641,10 @@ def buildmap(self, wantCL=True):
else:
warpcmd = 'gdalwarp -q -multi -t_srs "%s" -tr %d %d -te %d %d %d %d -r near %s %s' % (Region.t_srs, self.scale, self.scale, lcextents['xmin'], lcextents['ymin'], lcextents['xmax'], lcextents['ymax'], lcvrt, lcfile)
- os.remove(lcfile)
+ try:
+ os.remove(lcfile)
+ except OSError:
+ pass
# NB: make this work on Windows too!
os.system("%s" % warpcmd)
lcds = gdal.Open(lcfile, GA_ReadOnly)

0 comments on commit 3d79077

Please sign in to comment.