Commit Graph

204 Commits

Author SHA1 Message Date
Windel Bouwman
946df53077 Merge pull request #237 from johndaniels/add-star-import
Add 'from x import *' syntax.
2018-12-23 17:55:34 +01:00
Gitea
ac3da8b453 Add 'from x import *' syntax.
This is a separate opcode in CPython so I added it as such here.
2018-12-22 22:40:02 -05:00
Windel Bouwman
366f3e2b13 Merge pull request #236 from coolreader18/proper-dict
Make `dict()` work like it does in cpython
2018-12-22 16:05:31 +01:00
coolreader18
427ce4347e Add test for dicts 2018-12-22 00:04:13 -06:00
Windel Bouwman
bbe333d6c7 Merge pull request #233 from rossjones/232-impl-mul-for-list
Implements __mul__ for lists
2018-12-17 11:55:44 +01:00
Windel Bouwman
8aaadb16c0 Merge pull request #234 from johndaniels/indentation
Handle mixed spaces and tabs.
2018-12-17 11:55:20 +01:00
Gitea
c74cd90d8e Handle mixed spaces and tabs.
This allows the parser to handle tabs and spaces. Currently it
requires that spaces come after any tabs, which is slightly more
strict than python3. It also requires that neighboring indentation
levels have either both more spaces and tabs or less spaces and
tabs so that tab size can't make perception of indentation
differ from what the parser interprets.

I didn't opt to implement PartialOrd on IndentationLevel because I
wasn't sure that the comparison logic would meet the logical
requirements for that trait. One could easily switch to having it
implement PartialOrd though. This would necessitate switching to
manually implementing PartialEq so that it's behavior 'matches'.
It's unclear from the docs what 'matches' exactly means so for
now I'm avoiding implementing the traits.
2018-12-16 17:11:37 -05:00
Gitea
95d4073dd8 Add newline to end of file.
The parser currently doesn't handle missing newline gracefully.
2018-12-16 16:21:40 -05:00
Gitea
bbe4844f6c Fix snippet to not use tab.
We should add support for '\t', but that should probably be a separate ticket.
2018-12-16 15:43:07 -05:00
Ross Jones
ae2f7ed1cb Implements __mul__ for lists
Implements __mul__ for lists so that it is possible to do things like

```
s = [1, 2,] * 3
s == [1, 2, 1, 2, 1, 2]
```
2018-12-16 12:22:31 +00:00
Gitea
b726e675ff Add format builtin and String formatting stuff.
This includes everything needed to call str.format with integers
as positional and keyword parameters.
2018-12-15 19:46:09 -05:00
Adam Kelly
a1b7c61fcf Implement sys._getframe() to the point where we can use it to get locals. 2018-11-11 17:54:30 +00:00
Windel Bouwman
c4cbedae2f Extend min builtin function to support key and default. 2018-11-07 19:25:18 +01:00
Windel Bouwman
99af466a88 Move max function test cases to snippet dir. Implement key and default argument on max function. 2018-11-07 17:26:18 +01:00
Windel Bouwman
df0400dffb Add filter and zip builtins 2018-11-07 09:41:16 +01:00
Windel Bouwman
3c4aaa0d3c Merge pull request #188 from RustPython/sub
Implement __sub__/__rsub__.
2018-11-06 22:33:40 +01:00
Windel Bouwman
c69b43d13b Add frozenset class, callable function and enumerate function. 2018-11-06 21:42:42 +01:00
Windel Bouwman
ce5bb72ed0 Minor delta on super class. 2018-11-05 20:46:32 +01:00
Adam Kelly
7bf8378a18 type.__getattribute__ should be bound to type! 2018-11-04 18:43:39 +00:00
Windel Bouwman
a389b55ec1 Initial version of property class. 2018-11-04 17:14:07 +01:00
Windel Bouwman
6746784db8 Add classmethod and staticmethod classes. 2018-11-04 13:27:50 +01:00
Windel Bouwman
5ffb20b26e Add builtin oct function. Add weakref.ref class. 2018-11-04 12:07:53 +01:00
Adam Kelly
60f29149ef Add test for class with sub and rsub. 2018-11-04 10:17:07 +00:00
Adam Kelly
ff4e8da07e Merge branch 'master' into newinit 2018-11-03 22:42:40 +00:00
Adam Kelly
bcdb2089d5 Add logic for inheriting metaclass from bases. 2018-11-03 18:09:32 +00:00
Windel Bouwman
0199137fb0 Add sum builtin function. 2018-11-03 15:45:50 +01:00
Windel Bouwman
b6a88cc3d5 Add test script for bytearray 2018-11-03 11:32:21 +01:00
Windel Bouwman
810ef7df1c Add bytearray object 2018-11-03 11:09:15 +01:00
Windel Bouwman
a6f64eefee Change int __pow__ to use bigint pow. 2018-11-03 10:30:17 +01:00
Windel Bouwman
081a33f41a Merge pull request #185 from RustPython/prepare
Add support for __prepare__.
2018-11-03 10:25:59 +01:00
Adam Kelly
008c36466e Add support for __prepare__. 2018-11-02 22:09:12 +00:00
Windel Bouwman
039b5bbbb7 Implement dict __setitem__ 2018-11-02 22:04:18 +01:00
Adam Kelly
dce628dfad Simple metaclass snippet demoing call and new. 2018-11-02 17:16:46 +00:00
Windel Bouwman
bddaf3e77e Implement while-else and for-else. Call __neg__ and __invert__ methods on unary operation. 2018-10-31 21:50:00 +01:00
Windel Bouwman
cb4d66bd48 Added bit length method on int type. 2018-10-30 22:08:10 +01:00
Windel Bouwman
f6cced5d65 Change integer type into bigint 2018-10-30 21:01:31 +01:00
Windel Bouwman
1e3b45ee0d Add complex basic type 2018-10-29 21:55:58 +01:00
Windel Bouwman
5053d6d167 Add bytes literal support. 2018-10-28 21:15:46 +01:00
Windel Bouwman
7e1067168b Add list.extend method 2018-10-28 20:16:24 +01:00
Windel Bouwman
e6fd9fb0a0 Add double star arguments in function calls 2018-10-28 20:05:05 +01:00
Windel Bouwman
3f6c716b37 Implement star expand argument in function call. 2018-10-28 19:16:21 +01:00
Windel Bouwman
851d263878 Merge branch 'master' of https://github.com/RustPython/RustPython 2018-10-28 14:16:15 +01:00
Windel Bouwman
4187a6ee39 Add support for star expanded argument in list and tuple constructions. 2018-10-28 14:16:11 +01:00
Windel Bouwman
abe6abadf3 Merge pull request #181 from BojanKogoj/bojan/objfloat-__ge__
Added __ge__ to float
2018-10-28 13:35:26 +01:00
Windel Bouwman
6190914540 Merge pull request #176 from cauebs/master
Implement `bin` and `hex` builtin functions
2018-10-28 13:33:24 +01:00
Bojan
59417ea451 Added __ge__ to float 2018-10-28 00:36:51 +02:00
CauĂȘ Baasch de Souza
1de31053e9 Fix tests for bin and hex builtin functions 2018-10-27 19:33:04 -03:00
Windel Bouwman
afea338c08 Merge branch 'master' of https://github.com/RustPython/RustPython 2018-10-28 00:26:30 +02:00
Windel Bouwman
1f30693718 Allow unpack in assignment of list as well as trailing comma for 1 sized tuples 2018-10-28 00:26:24 +02:00
Bojan
ec006ae6b9 Added __gt__ to float 2018-10-27 22:45:22 +02:00