本文整理汇总了Python中transform.Transform类的典型用法代码示例。如果您正苦于以下问题:Python Transform类的具体用法?Python Transform怎么用?Python Transform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Transform类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent_transform = None,
rename = False,
recursive = False):
Transform.__init__(self)
self.rename = rename
self.recursive = recursive
self.parent_transform = parent_transform
示例2: __init__
def __init__(self, pi_creature, *args, **kwargs):
blinked = deepcopy(pi_creature).blink()
Transform.__init__(
self, pi_creature, blinked,
alpha_func = squish_alpha_func(there_and_back),
*args, **kwargs
)
示例3: transform_expr
def transform_expr(self, expr):
if self.is_simple(expr):
return Transform.transform_expr(self, expr)
stored = self.available_expressions.get(expr)
if stored is not None:
return stored
return Transform.transform_expr(self, expr)
示例4: post_apply
def post_apply(self, fn):
type_env = {}
for (name,t) in fn.type_env.iteritems():
if self.is_live(name):
type_env[name] = t
fn.type_env = type_env
Transform.post_apply(self, fn)
return fn
示例5: transform
def transform(args, x_queue, datadir, fname_index, joint_index, o_queue):
trans = Transform(args)
while True:
x = x_queue.get()
if x is None:
break
x, t = trans.transform(x.split(','), datadir, fname_index, joint_index)
o_queue.put((x.transpose((2, 0, 1)), t))
示例6: __init__
class Entity:
def __init__(self):
self._type = ''
self._id = ''
self._category = ''
self._level = ''
self.guid = guid()
self.transform = Transform()
def loadDb3(self, db3File, guid):
self.guid = guid
self._category = db3File.queryEntityData(guid, '_Category')
self._level = db3File.queryEntityData(guid, '_Level')
self.transform.matrix.set([float(i) for i in db3File.queryEntityData(guid, 'Transform').split(',')])
self.transform.setMatrix()
def saveDb3(self, db3File):
if self._id:
db3File.updateEntityData(self.guid, '_ID', self._id + ' (' + self._level + ')')
if self._category:
db3File.updateEntityData(self.guid, '_Category', self._category)
if self._level:
db3File.updateEntityData(self.guid, '_Level', self._level)
if self.transform:
db3File.updateEntityData(self.guid, 'Transform', ', '.join([str(i) for i in self.transform.matrix.get()]))
def setAttributes(self, attrs):
if 'name' in attrs:
self._id = attrs['name']
if 'pos' in attrs:
self.transform.position = [float(i) for i in attrs['pos'].split()]
if 'rot' in attrs:
self.transform.rotation = [float(i) for i in attrs['rot'].split()]
if 'scale' in attrs:
self.transform.scale = [float(i) for i in attrs['scale'].split()]
self.transform.getMatrix()
def getAttributes(self):
attrs = {}
if self._id:
attrs['name'] = self._id
if len(self.transform.position):
attrs['pos'] = ' '.join([str(i) for i in self.transform.position])
if len(self.transform.rotation):
attrs['rot'] = ' '.join([str(i) for i in self.transform.rotation])
if len(self.transform.scale):
attrs['scale'] = ' '.join([str(i) for i in self.transform.scale])
return attrs
#-------------------------------------------------------------------------------
# Eof
#-------------------------------------------------------------------------------
示例7: __init__
def __init__(self):
Transform.__init__(self)
self.adverbs_visited = []
self.adverb_args = []
self.expansions = {}
self.exp_stack = []
self.type_env_stack = []
self.dl_tile_estimates = []
self.ml_tile_estimates = []
# For now, we'll assume that no closure variables have the same name.
self.closure_vars = {}
self.num_tiles = 0
示例8: deserialize
def deserialize(cls, obj):
transformations = []
for transform in obj['transformations']:
transformations.append(Transform.deserialize(transform))
return cls(obj['width'], obj['height'],
obj['seed'], obj['points'], obj['iterations'],
transformations)
示例9: transform_expr
def transform_expr(self, expr):
if not isinstance(expr, syntax.Expr):
expr = ast_conversion.value_to_syntax(expr)
result = Transform.transform_expr(self, expr)
assert result.type is not None, \
"Unsupported expression encountered during type inference: %s" % (expr,)
return result
示例10: __init__
def __init__(self,
nesting_idx = -1,
fixed_idx = -1,
tile_sizes_param = None,
fixed_tile_sizes = None,
preallocate_output = False):
Transform.__init__(self)
self.nesting_idx = nesting_idx
self.fixed_idx = fixed_idx
self.tiling = False
self.tile_sizes_param = tile_sizes_param
self.fixed_tile_sizes = fixed_tile_sizes
self.output_var = None
self.preallocate_output = preallocate_output
# For now, we'll assume that no closure variables have the same name.
self.closure_vars = {}
示例11: transform_block
def transform_block(self, stmts, keep_bindings = False):
self.available_expressions.push()
self.bindings.push()
new_stmts = Transform.transform_block(self, stmts)
self.available_expressions.pop()
if not keep_bindings:
self.bindings.pop()
return new_stmts
示例12: tuple_proj
def tuple_proj(self, tup, idx, explicit_struct = False):
if tup.__class__ is Var and tup.name in self.bindings:
stored = self.bindings[tup.name]
if stored.__class__ is Tuple:
return stored.elts[idx]
else:
return stored.args[idx]
else:
return Transform.tuple_proj(self, tup, idx,
explicit_struct = explicit_struct)
示例13: __init__
def __init__(self, start_anim, end_anim, **kwargs):
digest_config(self, kwargs, locals())
if "run_time" in kwargs:
self.run_time = kwargs.pop("run_time")
else:
self.run_time = max(start_anim.run_time, end_anim.run_time)
for anim in start_anim, end_anim:
anim.set_run_time(self.run_time)
if start_anim.starting_mobject.get_num_points() != end_anim.starting_mobject.get_num_points():
Mobject.align_data(start_anim.starting_mobject, end_anim.starting_mobject)
for anim in start_anim, end_anim:
if hasattr(anim, "ending_mobject"):
Mobject.align_data(anim.starting_mobject, anim.ending_mobject)
Transform.__init__(self, start_anim.mobject, end_anim.mobject, **kwargs)
#Rewire starting and ending mobjects
start_anim.mobject = self.starting_mobject
end_anim.mobject = self.ending_mobject
示例14: attr
def attr(self, obj, field):
if obj.__class__ is Var and obj.name in self.bindings:
stored = self.bindings[obj.name]
stored_class = stored.__class__
if stored_class is Struct:
pos = stored.type.field_pos(field)
return stored.args[pos]
elif stored_class is Slice or stored_class is ArrayView:
return getattr(stored, field)
return Transform.attr(self, obj, field)
示例15: transform_Assign
def transform_Assign(self, stmt):
"""
If you encounter an adverb being written to an output location,
then why not just use that as the output directly?
"""
if stmt.lhs.__class__ is Index:
rhs_class = stmt.rhs.__class__
if rhs_class is Map:
self.transform_Map(stmt.rhs, output=stmt.lhs)
return None
elif rhs_class is OuterMap:
self.transform_OuterMap(stmt.rhs, output=stmt.lhs)
return Transform.transform_Assign(self, stmt)