Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
Merge d8d4206 into 2bcdcca
Browse files Browse the repository at this point in the history
  • Loading branch information
hal0x2328 committed Oct 12, 2017
2 parents 2bcdcca + d8d4206 commit d69bd09
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
19 changes: 9 additions & 10 deletions boa/code/builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,14 @@ def concat(str1, str2):
# pass


# @TODO this currently does not work
#def take(source, count):
# """
# take(source, count) -> list object
#
# Return a subset of a string or list `source`, starting
# at index 0 and of length `count`
# """
# pass
def take(source, count):
"""
take(source, count) -> list object
Return a subset of a string or list `source`, starting
at index 0 and of length `count`
"""
pass


def range(start, stop):
Expand Down Expand Up @@ -160,4 +159,4 @@ def verify_signature(signature, pubkey):
pass

def verify_signatures(signatures, pubkeys):
pass
pass
4 changes: 2 additions & 2 deletions boa/code/vmtoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,8 @@ def convert_method_call(self, pytoken):
if param_len <= 1:
pass
elif param_len == 2:
# if we are using concat, we don't want to swap
if pytoken.func_name != 'concat':
# if we are using concat or take, we don't want to swap
if pytoken.func_name != 'concat' and pytoken.func_name != 'take':
self.insert1(VMOp.SWAP)

elif param_len == 3:
Expand Down
9 changes: 9 additions & 0 deletions boa/tests/src/TakeTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from boa.code.builtins import take

def Main():

str1 = 'helloworld'

str2 = take(str1,5)

return str2

0 comments on commit d69bd09

Please sign in to comment.