diff options
author | Marion <marion.zepf@gmail.com> | 2013-09-13 21:20:43 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-09-13 21:20:43 (GMT) |
commit | c300faeae404de755dfec661863f3b567bea9672 (patch) | |
tree | d6e6b1f01815dbfebe062c200a5376a73d5dba2a | |
parent | b1ed9f3f6f7f3dbf56588c5243093b547ddb18a1 (diff) |
remove obsolete TODOs in the code
-rw-r--r-- | TurtleArt/tabasics.py | 4 | ||||
-rw-r--r-- | TurtleArt/talogo.py | 14 | ||||
-rw-r--r-- | TurtleArt/taprimitive.py | 17 | ||||
-rw-r--r-- | util/codegen.py | 4 |
4 files changed, 4 insertions, 35 deletions
diff --git a/TurtleArt/tabasics.py b/TurtleArt/tabasics.py index a905e37..f450f8b 100644 --- a/TurtleArt/tabasics.py +++ b/TurtleArt/tabasics.py @@ -610,7 +610,6 @@ tasetshade :shade \n') logo_command='sum', help_string=_('adds two alphanumeric inputs')) self.tw.lc.def_prim('plus', 2, - # TODO re-enable use with lists # add up two numbers ... or_(Primitive(Primitive.plus, return_type=TYPE_NUMBER, arg_descs=[ArgSlot(TYPE_NUMBER), ArgSlot(TYPE_NUMBER)]), @@ -627,7 +626,6 @@ tasetshade :shade \n') help_string=_('subtracts bottom numeric input from \ top numeric input')) self.tw.lc.def_prim('minus', 2, - # TODO re-enable use with lists Primitive(Primitive.minus, return_type=TYPE_NUMBER, arg_descs=[ArgSlot(TYPE_NUMBER), ArgSlot(TYPE_NUMBER)])) define_logo_function('taminus', 'to taminus :y :x\noutput sum :x \ @@ -641,7 +639,6 @@ minus :y\nend\n') logo_command='product', help_string=_('multiplies two numeric inputs')) self.tw.lc.def_prim('product', 2, - # TODO re-enable use with lists Primitive(Primitive.multiply, return_type=TYPE_NUMBER, arg_descs=[ArgSlot(TYPE_NUMBER), ArgSlot(TYPE_NUMBER)])) @@ -654,7 +651,6 @@ minus :y\nend\n') help_string=_('divides top numeric input \ (numerator) by bottom numeric input (denominator)')) self.tw.lc.def_prim('division', 2, - # TODO re-enable use with lists Primitive(Primitive.divide, return_type=TYPE_NUMBER, arg_descs=[ArgSlot(TYPE_NUMBER), ArgSlot(TYPE_NUMBER)])) diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py index fff1d4b..76f0d3a 100644 --- a/TurtleArt/talogo.py +++ b/TurtleArt/talogo.py @@ -247,20 +247,6 @@ class LogoCode: for b in blocks: b.unhighlight() - # TODO remove Hidden macro expansions -# for b in blocks: -# if b.name in ['while', 'until']: -# action_blk, new_blocks = self._expand_forever(b, blk, blocks) -# blocks = new_blocks[:] -# if b == blk: -# blk = action_blk -# for b in blocks: -# if b.name in ['forever']: -# action_blk, new_blocks = self._expand_forever(b, blk, blocks) -# blocks = new_blocks[:] -# if b == blk: -# blk = action_blk - for b in blocks: if b.name in ('hat', 'hat1', 'hat2'): stack_name = get_stack_name(b) diff --git a/TurtleArt/taprimitive.py b/TurtleArt/taprimitive.py index 8c52f51..36ad49c 100644 --- a/TurtleArt/taprimitive.py +++ b/TurtleArt/taprimitive.py @@ -262,7 +262,7 @@ class Primitive(object): new_prim = self.fill_slots(runtime_args, runtime_kwargs, convert_to_ast=False) if not new_prim.are_slots_filled(): - raise logoerror('not enough arguments') # TODO find correct error message + raise logoerror("#syntaxerror") if Primitive._DEBUG: debug_output(" new_prim.arg_descs: " + repr(new_prim.arg_descs)) @@ -308,7 +308,7 @@ class Primitive(object): debug_output(" arg_asts: " + repr(arg_asts)) new_prim = self.fill_slots(arg_asts, kwarg_asts, convert_to_ast=True) if not new_prim.are_slots_filled(): - raise PyExportError("not enough arguments") # TODO better msg + raise PyExportError("not enough arguments") if Primitive._DEBUG: debug_output(" new_prim.arg_descs: " + repr(new_prim.arg_descs)) @@ -416,12 +416,6 @@ class Primitive(object): comparators=[right]) else: return ast.BinOp(op=op, left=left, right=right) - else: - # TODO remove - raise ValueError(("operator Primitive.%s got unexpected" - " number of arguments (%d)") - % (str(self.func.__func__.__name__), - len(new_arg_asts))) # square root elif self == Primitive.square_root: @@ -441,12 +435,7 @@ class Primitive(object): # identity elif self == Primitive.identity: - if len(new_arg_asts) == 1: - return new_arg_asts[0] - else: - # TODO remove - raise ValueError("Primitive.identity got unexpected number " - "of arguments (%d)" % (len(new_arg_asts))) + return new_arg_asts[0] # constant elif self == CONSTANTS.get: diff --git a/util/codegen.py b/util/codegen.py index 2390daf..9678ae5 100644 --- a/util/codegen.py +++ b/util/codegen.py @@ -68,7 +68,7 @@ class SourceGenerator(NodeVisitor): """ UNARYOP_SYMBOLS = {Invert: "~", Not: "not", UAdd: "+", USub: "-"} - # TODO avoid turning (-1)**2 into -1**2 + # TODO use parentheses around expressions only where necessary BINOP_SYMBOLS = {Add: "+", Sub: "-", Mult: "*", Div: "/", Mod: "%", LShift: "<<", RShift:">>", BitOr: "|", BitXor: "^", BitAnd: "&", FloorDiv: "//", Pow: "**"} @@ -220,7 +220,6 @@ class SourceGenerator(NodeVisitor): paren_or_comma() self.write('**') self.visit(node.kwargs) - # TODO wtf??? self.write(have_args and '):' or ':') self.body(node.body) @@ -416,7 +415,6 @@ class SourceGenerator(NodeVisitor): if idx: self.write(', ') self.visit(item) - # TODO wtf??? self.write(idx and ')' or ',)') def sequence_visit(left, right): |