Relativize some imports, remove unnecessary typing

This commit is contained in:
Steven Robertson 2011-12-17 09:22:27 -05:00
parent f5e4443004
commit ed885534d6
2 changed files with 2 additions and 8 deletions

View File

@ -4,7 +4,6 @@ import numpy as np
import tempita
from cuburn.code.util import HunkOCode, Template
from cuburn.genome import SplEval
class GenomePackerName(str):
"""Class to indicate that a property is precalculated on the device"""
@ -54,11 +53,8 @@ class GenomePackerView(object):
# allocate things. This makes for neater embedded code, which is where
# the real complexity lies, but it also means printf() debugging when
# templating will screw with the allocation tables!
if isinstance(self.wrapped, SplEval):
if not isinstance(self.wrapped, GenomePackerName):
self.packer._require(self.prefix)
elif not isinstance(self.wrapped, GenomePackerName):
raise TypeError("Tried to pack something that wasn't a spline or "
"a precalculated value")
# TODO: verify namespace stomping, etc
return '%s.%s' % (self.ptr_name, '_'.join(self.prefix))
@ -217,8 +213,6 @@ class GenomePacker(HunkOCode):
attr = self.ns[gname[0]]
for g in gname[1:]:
attr = getattr(attr, g)
if not isinstance(attr, SplEval):
raise TypeError("%s isn't a spline" % '.'.join(gname))
out[0][idx][:len(attr.knots[0])] = attr.knots[0]
out[1][idx][:len(attr.knots[1])] = attr.knots[1]
return out

View File

@ -1,6 +1,6 @@
import numpy as np
from cuburn.code.util import Template
from util import Template
var_code = {}
var_params = {}