diff options
author | Marion <marion.zepf@gmail.com> | 2013-09-16 15:37:43 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-09-16 15:37:43 (GMT) |
commit | 32dc3dc0eb910223c33b0b57e76ec9aa5c6899f8 (patch) | |
tree | facd1c119217b04d4bf97cecb140394a78b8c6ce | |
parent | 5164a35bd525279f411430526e7df25b68c11be0 (diff) |
clean up taprimitive and tatype
-rw-r--r-- | TurtleArt/taprimitive.py | 11 | ||||
-rw-r--r-- | TurtleArt/tatype.py | 4 |
2 files changed, 6 insertions, 9 deletions
diff --git a/TurtleArt/taprimitive.py b/TurtleArt/taprimitive.py index 05a44ad..2eb4a90 100644 --- a/TurtleArt/taprimitive.py +++ b/TurtleArt/taprimitive.py @@ -346,8 +346,8 @@ class Primitive(object): condition_ast = ast.UnaryOp(op=ast.Not, operand=pos_cond_ast) else: - raise ValueError("unknown loop controller: " + - repr(controller)) + raise PyExportError("unknown loop controller: " + + repr(controller)) loop_ast = ast.While(test=condition_ast, body=new_arg_asts[1], orelse=[]) @@ -619,7 +619,7 @@ class Primitive(object): return wrapper # no controller found - raise ValueError("found no loop controller for " + repr(self)) + raise PyExportError("found no loop controller for " + repr(self)) @staticmethod def do_nothing(): @@ -976,8 +976,7 @@ class ArgSlot(object): raise error else: raise TATypeError(bad_value=bad_value, bad_type=old_type, - req_type=new_type, - message="filling slot " + repr(self)) + req_type=new_type) class ArgSlotDisjunction(Disjunction,ArgSlot): @@ -1090,7 +1089,7 @@ def value_to_ast(value, *args_for_prim, **kwargs_for_prim): return get_call_ast('Media', args, return_type=TYPE_MEDIA) # unknown else: - raise ValueError("unknown type of raw value: " + repr(type(value))) + raise PyExportError("unknown type of raw value: " + repr(type(value))) def ast_yield_true(): diff --git a/TurtleArt/tatype.py b/TurtleArt/tatype.py index 46c5921..78cbcc3 100644 --- a/TurtleArt/tatype.py +++ b/TurtleArt/tatype.py @@ -21,7 +21,6 @@ """ type system for Primitives and their arguments """ import ast -from gettext import gettext as _ from tablock import Media from taconstants import (Color, CONSTANTS) @@ -43,8 +42,7 @@ class Type(object): if other is None: return False if not isinstance(other, Type): - raise TypeError("cannot compare Type to object of type " + - repr(type(other))) + return False return self.value == other.value def __str__(self): |