Commit Graph

126 Commits

Author SHA1 Message Date
Paul Sokolovsky
bf38e2a03a Implement send() method for generators. 2014-01-26 20:56:08 +02:00
Damien George
7c9c667633 py: Implement iterator support for object that has __getitem__.
Addresses Issue #203.
2014-01-25 00:17:36 +00:00
Paul Sokolovsky
91fb1c9b13 Add basic implementation of bytes type, piggybacking on str.
This reuses as much str implementation as possible, from this we
can make them more separate as needed.
2014-01-24 22:56:26 +02:00
Paul Sokolovsky
c3e72a8cc8 mp_obj_is_callable(): Only object types can be callable.
Fixes segfault on callable("string").
2014-01-23 03:37:21 +02:00
Paul Sokolovsky
1eacefe5bc Implement simplest case of str.startswith(). 2014-01-23 02:47:10 +02:00
Paul Sokolovsky
0b7184dcb8 Implement octal and hex escapes in strings. 2014-01-22 22:48:25 +02:00
Damien George
600ae734cf py: Implement break and continue byte codes, and add tests.
Also fixes a bug in the for-in-range optimiser.

I hope to remove break and continue byte codes in the future and just
use jump (if possible).
2014-01-21 23:48:04 +00:00
Paul Sokolovsky
d30e019459 Add bytearray basic tests. 2014-01-21 23:59:50 +02:00
Paul Sokolovsky
7280f79088 run-tests: Allow to run tests selectively via command line. 2014-01-21 05:02:58 +02:00
Paul Sokolovsky
4c316552c1 Implement str.split(None).
Note that splitting by explicit string is not implemented so far.
2014-01-21 05:01:21 +02:00
Paul Sokolovsky
7380a83780 str: Implement proper string (instead of byte string) indexing.
Also, support negative indexes.
2014-01-21 02:25:59 +02:00
Paul Sokolovsky
545591a696 Implement string multiplication. 2014-01-21 00:39:12 +02:00
Paul Sokolovsky
decd597273 unix io.FileIO: Add iteration support.
A file cannot be iterated concurrently, so we make io.FileIO its own
iterator.
2014-01-20 18:42:08 +02:00
Damien George
7d08935458 Rename unix binary to 'micropython'. 2014-01-20 00:02:39 +00:00
Paul Sokolovsky
fe2690da0a unix: Implement sys.argv. 2014-01-20 01:00:28 +02:00
Paul Sokolovsky
db796ef84d Add README for tests/. 2014-01-19 18:51:59 +02:00
Paul Sokolovsky
9954b4b99d Add directory for I/O tests with basic test for file methods. 2014-01-19 18:46:21 +02:00
Paul Sokolovsky
8c3858b016 Move tests in basic/tests/ up one level preparating to multiple test dirs. 2014-01-19 18:41:55 +02:00
Damien George
ebde0b8a09 Tiny optimisation in objlist.c; a new test for inheritance. 2014-01-19 00:47:40 +00:00
Damien George
aefe79880f Merge branch 'master' of github.com:micropython/micropython 2014-01-18 17:54:35 +00:00
Damien George
f49ba1bd9c Improve method lookup in mp_obj_class_lookup.
Now searches both locals_dict and methods.  Partly addresses Issue #145.
2014-01-18 17:52:41 +00:00
Paul Sokolovsky
b31b5e0b5c Add testcase for subclassing builtin type and calling native method (broken). 2014-01-18 19:12:17 +02:00
Damien George
1d6fc94c16 Implement framework for class-defined built-in operators.
Now working for class-defined methods: __getitem__, __setitem__,
__add__, __sub__.  Easy to add others.
2014-01-18 15:31:13 +00:00
Paul Sokolovsky
10744dd816 Add empty (false) value testing for strings, tuples, lists, dicts. 2014-01-16 23:54:17 +02:00
Paul Sokolovsky
f2b796e7c7 str.format: Don't assume that '}' immediately follows '{', skip insides.
That at least makes stuff like "{:x}".format(1) to produce not completely
broken output.
2014-01-16 03:46:01 +02:00
Damien George
5573f9f150 Merge branch 'str2int' of github.com:xyb/micropython into xyb-str2int
Conflicts:
	py/objint.c
	unix-cpy/Makefile
	unix/Makefile
2014-01-15 22:58:39 +00:00
Damien George
4899ff9470 Merge branch 'str-repr' of github.com:pfalcon/micropython into pfalcon-str-repr
Conflicts:
	tests/basics/tests/exception1.py
2014-01-15 22:39:03 +00:00
Damien George
7a9d0c4540 Merge branch 'builtins' of github.com:chipaca/micropython into chipaca-builtins
Added some checks for number of arguments.

Conflicts:
	py/mpqstrraw.h
2014-01-15 22:27:16 +00:00
Damien George
d02c6d8962 Implement eval. 2014-01-15 22:14:03 +00:00
Damien George
e2fb2baaa4 Implement repr. 2014-01-15 21:40:48 +00:00
xyb
3e4ed25138 add more tests and remove debug code 2014-01-15 20:37:17 +08:00
xyb
3270fb4be6 int() test passed 2014-01-15 19:58:11 +08:00
John R. Lenton
fca456bc3c added filter() 2014-01-15 01:37:08 +00:00
John R. Lenton
39b174e00a Added map 2014-01-15 01:10:09 +00:00
Paul Sokolovsky
76d982ef34 type->print(): Distinguish str() and repr() variety by passing extra param. 2014-01-15 02:15:38 +02:00
John R. Lenton
ff8007c7d6 Merge remote-tracking branch 'upstream/master' into builtins 2014-01-14 23:58:05 +00:00
John R. Lenton
9daa78943e added enumerate() 2014-01-14 23:55:01 +00:00
Damien George
39eab8de96 Merge pull request #161 from pfalcon/exc-more-pythonic
Move towards Python-compliant interface of exceptions
2014-01-14 15:27:59 -08:00
Damien George
66a5bf681d Merge pull request #142 from chipaca/containment
Implemented support for `in` and `not in` operators.
2014-01-14 15:23:09 -08:00
Damien George
6c2401e935 Merge pull request #165 from chipaca/builtins
added zip()
2014-01-14 15:13:40 -08:00
Paul Sokolovsky
8bc96471f0 Implement "is" and "is not" operators.
So far, don't work for strings as expected.
2014-01-15 00:32:09 +02:00
Paul Sokolovsky
ddf2178d83 Refactor exception objects to have better impl of Python-side interface.
This implements internal args tuple of arguments, while still keeping
object useful for reporting C-side errors.

Further elaboration is needed.
2014-01-15 00:03:23 +02:00
xyb
c178ea471e Implemented int(str) in UNIX 2014-01-14 21:39:05 +08:00
John R. Lenton
5c76839559 sorted 2014-01-13 05:12:50 +00:00
John R. Lenton
07205ec323 added zip() 2014-01-13 02:31:00 +00:00
John R. Lenton
13e64f0660 Merge remote-tracking branch 'upstream/master' into containment 2014-01-13 00:41:12 +00:00
Damien George
34f813ee29 Merge pull request #162 from chipaca/str_find
Implement a basic str.find; fixes #67
2014-01-12 16:34:03 -08:00
Damien George
ec3e14e2af Merge pull request #160 from pfalcon/elaborate-int
Elaborate small-int/long-int
2014-01-12 16:32:21 -08:00
John R. Lenton
7244a14439 oops, nasty off-by-one in set_copy 2014-01-12 23:37:45 +00:00
John R. Lenton
be790f94d5 Implemented set binary ops. 2014-01-12 23:09:10 +00:00