|
@@ -145,210 +145,11 @@ extern class FileDescriptor {
|
|
|
//}
|
|
|
|
|
|
//@:native("set")
|
|
|
-extern class Set <T>
|
|
|
-{
|
|
|
-
|
|
|
- @:overload(function (?array:Array<T>):Void {})
|
|
|
- public function new (?iterable:python.lib.Types.PyIterable<T>):Void;
|
|
|
-
|
|
|
- public inline function length ():Int
|
|
|
- {
|
|
|
- return python.lib.Builtin.len(this);
|
|
|
- }
|
|
|
-
|
|
|
- public inline function has (v:T):Bool
|
|
|
- {
|
|
|
- return python.Syntax.isIn(v, this);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public inline function minus (other:Set<T>):Set<T>
|
|
|
- {
|
|
|
- return python.Syntax.binop(this, "-", other);
|
|
|
- }
|
|
|
- public inline function plus (other:Set<T>):Set<T>
|
|
|
- {
|
|
|
- return python.Syntax.binop(this, "+", other);
|
|
|
- }
|
|
|
-
|
|
|
- static function __init__ ():Void
|
|
|
- {
|
|
|
- Syntax.importFromAs("builtins", "set", "python.lib.Set");
|
|
|
- }
|
|
|
-
|
|
|
- function __iter__ ():PyIterator<T>;
|
|
|
-
|
|
|
- public inline function iterator ():Iterator<T>
|
|
|
- {
|
|
|
- return __iter__();
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-extern class DictView<T> {
|
|
|
- public inline function iter ():PyIterator<T>
|
|
|
- {
|
|
|
- return Builtin.iter(this);
|
|
|
- }
|
|
|
- public inline function length ():Int
|
|
|
- {
|
|
|
- return Builtin.len(this);
|
|
|
- }
|
|
|
-
|
|
|
- public inline function iterator ():Iterator<T>
|
|
|
- {
|
|
|
- return iter();
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-//@:native("dict")
|
|
|
-extern class Dict <K, V>
|
|
|
-{
|
|
|
- public function new ():Void;
|
|
|
-
|
|
|
- public inline function length ():Int
|
|
|
- {
|
|
|
- return python.lib.Builtin.len(this);
|
|
|
- }
|
|
|
-
|
|
|
- public inline function hasKey (k:K):Bool {
|
|
|
- return DictImpl.hasKey(this,k);
|
|
|
- }
|
|
|
-
|
|
|
- public function clear ():Void;
|
|
|
- public function copy ():Dict<K,V>;
|
|
|
- public function get (key:K, def:V):V;
|
|
|
-
|
|
|
- public function update (d:Dict<K,V>):Void;
|
|
|
-
|
|
|
- public function keys ():DictView<K>;
|
|
|
- public function values ():DictView<V>;
|
|
|
- public function items ():DictView<Tup2<K,V>>;
|
|
|
-
|
|
|
- public static inline function fromObject (x:{}):Dict<String,Dynamic> {
|
|
|
- return DictImpl.fromObject(x);
|
|
|
- }
|
|
|
- public inline function set (key:K, val:V):Void {
|
|
|
- DictImpl.set(this, key, val);
|
|
|
- }
|
|
|
|
|
|
- public inline function remove (key:K):Void
|
|
|
- {
|
|
|
- DictImpl.remove(this, key);
|
|
|
- }
|
|
|
-
|
|
|
- public inline function iterator ():Iterator<V>
|
|
|
- {
|
|
|
- return values().iter();
|
|
|
- }
|
|
|
- public function __iter__():PyIterator<K>;
|
|
|
-
|
|
|
- static function __init__ ():Void
|
|
|
- {
|
|
|
- Syntax.importFromAs("builtins", "dict", "python.lib.Dict");
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-class DictImpl {
|
|
|
- public static inline function fromObject (x:{}) {
|
|
|
- var d = new Dict();
|
|
|
- for (f in Reflect.fields(x)) {
|
|
|
- d.set(f, Reflect.field(x,f));
|
|
|
- }
|
|
|
- return d;
|
|
|
- }
|
|
|
- public static inline function hasKey <X>(d:Dict<X, Dynamic>, key:X) {
|
|
|
- return python.Syntax.isIn(key, d);
|
|
|
- }
|
|
|
-
|
|
|
- public static inline function remove <X>(d:Dict<X, Dynamic>, key:X) {
|
|
|
- python.Syntax.delete(python.Syntax.arrayAccess(d, key));
|
|
|
- }
|
|
|
-
|
|
|
- public static inline function set <K,V>(d:Dict<K, V>, key:K, val:V) {
|
|
|
- python.Syntax.arraySet(d, key, val);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-extern class Tuple<X> implements ArrayAccess<X> {
|
|
|
-
|
|
|
- public static inline function empty<X>():Tuple<X> {
|
|
|
- return Builtin.tuple();
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
- public static inline function fromArray<X>(a:Array<X>):Tuple<X> {
|
|
|
- return Builtin.tuple(a);
|
|
|
- }
|
|
|
-
|
|
|
- public var length(get_length, null):Int;
|
|
|
-
|
|
|
- inline function get_length():Int {
|
|
|
- return Builtin.len(this);
|
|
|
- }
|
|
|
-
|
|
|
- public inline function at (i:Int):X {
|
|
|
- return python.Syntax.arrayAccess(this, i);
|
|
|
- }
|
|
|
-
|
|
|
- public inline function toArray ():Array<X>
|
|
|
- {
|
|
|
- return Builtin.list(this);
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-extern class Tup2 <A,B> extends Tuple<Dynamic>
|
|
|
-{
|
|
|
- public static inline function create <A,B>(a:A, b:B):Tup2<A,B> return python.Syntax.tuple(a,b);
|
|
|
- public var _1(get, null):A;
|
|
|
- public inline function get__1():A return python.Syntax.arrayAccess(this, 0);
|
|
|
- public var _2(get, null):B;
|
|
|
- public inline function get__2():B return python.Syntax.arrayAccess(this, 1);
|
|
|
-}
|
|
|
-
|
|
|
-extern class Tup3 <A,B,C> extends Tuple<Dynamic>
|
|
|
-{
|
|
|
- public static inline function create <A,B,C>(a:A, b:B,c:C):Tup3<A,B,C> return python.Syntax.tuple(a,b,c);
|
|
|
- public var _1(get, null):A;
|
|
|
- public inline function get__1():A return python.Syntax.arrayAccess(this, 0);
|
|
|
- public var _2(get, null):B;
|
|
|
- public inline function get__2():B return python.Syntax.arrayAccess(this, 1);
|
|
|
- public var _3(get, null):C;
|
|
|
- public inline function get__3():C return python.Syntax.arrayAccess(this, 2);
|
|
|
-}
|
|
|
-
|
|
|
-extern class Tup4 <A,B,C,D> extends Tuple<Dynamic>
|
|
|
-{
|
|
|
- public static inline function create <A,B,C,D>(a:A, b:B,c:C,d:D):Tup4<A,B,C,D> return python.Syntax.tuple(a,b,c,d);
|
|
|
- public var _1(get, null):A;
|
|
|
- public inline function get__1():A return python.Syntax.arrayAccess(this, 0);
|
|
|
- public var _2(get, null):B;
|
|
|
- public inline function get__2():B return python.Syntax.arrayAccess(this, 1);
|
|
|
- public var _3(get, null):C;
|
|
|
- public inline function get__3():C return python.Syntax.arrayAccess(this, 2);
|
|
|
- public var _4(get, null):D;
|
|
|
- public inline function get__4():D return python.Syntax.arrayAccess(this, 3);
|
|
|
-}
|
|
|
|
|
|
-extern class Tup5 <A,B,C,D,E> extends Tuple<Dynamic>
|
|
|
-{
|
|
|
- public static inline function create <A,B,C,D,E>(a:A, b:B,c:C,d:D,e:E):Tup5<A,B,C,D,E> return python.Syntax.tuple(a,b,c,d,e);
|
|
|
- public var _1(get, null):A;
|
|
|
- public inline function get__1():A return python.Syntax.arrayAccess(this, 0);
|
|
|
- public var _2(get, null):B;
|
|
|
- public inline function get__2():B return python.Syntax.arrayAccess(this, 1);
|
|
|
- public var _3(get, null):C;
|
|
|
- public inline function get__3():C return python.Syntax.arrayAccess(this, 2);
|
|
|
- public var _4(get, null):D;
|
|
|
- public inline function get__4():D return python.Syntax.arrayAccess(this, 3);
|
|
|
- public var _5(get, null):E;
|
|
|
- public inline function get__5():E return python.Syntax.arrayAccess(this, 4);
|
|
|
-}
|
|
|
|
|
|
|
|
|
@:native("BaseException")
|