Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
z1 = int(match.group("z1"))
x1 = int(match.group("x1"))
if match.group("starx"):
x2 = 1 << z1
elif match.group("plusx"):
x2 = x1 + int(match.group("x2"))
else:
x2 = int(match.group("x2"))
y1 = int(match.group("y1"))
if match.group("stary"):
y2 = 1 << z1
elif match.group("plusy"):
y2 = y1 + int(match.group("y2"))
else:
y2 = int(match.group("y2"))
result = cls({z1: (Bounds(x1, x2), Bounds(y1, y2))})
if match.group("z2"):
z2 = int(match.group("z2"))
if match.group("plusz"):
z2 += z1
if z1 < z2:
result.fill_down(z2)
elif z1 > z2:
result.fill_up(z2)
return result
def add(self, tilecoord):
"""Extends self to include tilecoord"""
if tilecoord.z in self.bounds:
xbounds, ybounds = self.bounds[tilecoord.z]
xbounds.add(tilecoord.x)
ybounds.add(tilecoord.y)
else:
self.bounds[tilecoord.z] = (Bounds(tilecoord.x), Bounds(tilecoord.y))
return self
def full(cls, zmin=None, zmax=None):
assert zmax is not None
zs = (zmax,) if zmin is None else range(zmin, zmax + 1)
return cls(dict((z, (Bounds(0, 1 << z), Bounds(0, 1 << z))) for z in zs))
def union(self, other):
"""Returns a new Bounds which is the union of self and other"""
if self and other:
return Bounds(min(self.start, other.start), max(self.stop, other.stop))
elif self:
return Bounds(self.start, self.stop)
elif other:
return Bounds(other.start, other.stop)
else:
return Bounds()
def union(self, other):
"""Returns a new Bounds which is the union of self and other"""
if self and other:
return Bounds(min(self.start, other.start), max(self.stop, other.stop))
elif self:
return Bounds(self.start, self.stop)
elif other:
return Bounds(other.start, other.stop)
else:
return Bounds()
def union(self, other):
"""Returns a new Bounds which is the union of self and other"""
if self and other:
return Bounds(min(self.start, other.start), max(self.stop, other.stop))
elif self:
return Bounds(self.start, self.stop)
elif other:
return Bounds(other.start, other.stop)
else:
return Bounds()
def union(self, other):
"""Returns a new Bounds which is the union of self and other"""
if self and other:
return Bounds(min(self.start, other.start), max(self.stop, other.stop))
elif self:
return Bounds(self.start, self.stop)
elif other:
return Bounds(other.start, other.stop)
else:
return Bounds()