Selaa lähdekoodia

restructure python lib

frabbit 11 vuotta sitten
vanhempi
commit
71bf40620e

+ 6 - 6
genpy.ml

@@ -956,8 +956,8 @@ module Printer = struct
 		let sl = List.map (fun (v,cto) ->
 			let name = handle_keywords v.v_name in
 			let arg_string = match follow v.v_type with
-				| TAbstract({a_path = ["python"; "lib"],"KwArgs"},_) -> "**" ^ name
-				| TAbstract({a_path = ["python"; "lib"],"VarArgs"},_) -> "*" ^ name
+				| TAbstract({a_path = ["python"],"KwArgs"},_) -> "**" ^ name
+				| TAbstract({a_path = ["python"],"VarArgs"},_) -> "*" ^ name
 				| _ -> name
 			in
 			let arg_value = match cto with
@@ -1311,10 +1311,10 @@ module Printer = struct
 		let print_arg pctx i x =
 			let prefix = match e1.eexpr, follow x.etype with
 				(* the should not apply for the instance methods of the abstract itself *)
-				| TField(_, FStatic({cl_path = ["python"; "lib"; "_Types"],"KwArgs_Impl_"},f)), _ when i == 0 && Meta.has Meta.Impl f.cf_meta -> ""
-				| TField(_, FStatic({cl_path = ["python"; "lib"; "_Types"],"VarArgs_Impl_"},f)), _ when i == 0 && Meta.has Meta.Impl f.cf_meta -> ""
-				| _, TAbstract({a_path = ["python"; "lib"],"KwArgs"},_) -> "**"
-				| _, TAbstract({a_path = ["python"; "lib"],"VarArgs"},_) -> "*"
+				| TField(_, FStatic({cl_path = ["python"; "_KwArgs"],"KwArgs_Impl_"},f)), _ when i == 0 && Meta.has Meta.Impl f.cf_meta -> ""
+				| TField(_, FStatic({cl_path = ["python"; "_VarArgs"],"VarArgs_Impl_"},f)), _ when i == 0 && Meta.has Meta.Impl f.cf_meta -> ""
+				| _, TAbstract({a_path = ["python"],"KwArgs"},_) -> "**"
+				| _, TAbstract({a_path = ["python"],"VarArgs"},_) -> "*"
 				| _, _ -> ""
 			in
 			prefix ^ (print_expr pctx x)

+ 1 - 1
std/haxe/io/BytesData.hx

@@ -35,7 +35,7 @@ package haxe.io;
 #elseif cs
 	typedef BytesData = cs.NativeArray<cs.StdTypes.UInt8>;
 #elseif python
-	typedef BytesData = python.lib.Types.ByteArray;
+	typedef BytesData = python.lib.ByteArray;
 #else
 	typedef BytesData = Array<Int>;
 #end

+ 1 - 1
std/python/HaxeIterable.hx

@@ -4,7 +4,7 @@ import python.lib.Types;
 
 class HaxeIterable<T> {
 
-	var x :NativeIterable<T>;
+	var x : NativeIterable<T>;
 
 	public inline function new (x:NativeIterable<T>) {
 		this.x = x;

+ 3 - 1
std/python/HaxeIterator.hx

@@ -1,6 +1,8 @@
 package python;
 
-import python.lib.Types;
+import python.lib.Exceptions.StopIteration;
+import python.lib.Types.NativeIterator;
+
 
 class HaxeIterator<T>
 {

+ 23 - 0
std/python/KwArgs.hx

@@ -0,0 +1,23 @@
+
+package python;
+
+import python.lib.Dict;
+
+abstract KwArgs (Dict<String, Dynamic>)
+{
+	inline function new (d:Dict<String, Dynamic>) this = d;
+
+	@:to inline function toDict ():Dict<String, Dynamic>
+	{
+		return this;
+	}
+	@:from static inline function fromDict (d:Dict<String, Dynamic>):KwArgs
+	{
+		return new KwArgs(d);
+	}
+
+	public function get <V>(key:String, def:V):V
+	{
+		return this.get(key, def);
+	}
+}

+ 1 - 1
std/python/Lib.hx

@@ -31,7 +31,7 @@ class Lib {
 					if (it1.hasNext()) {
 						return it1.next();
 					} else {
-						throw new python.lib.Types.StopIteration();
+						throw new python.lib.Exceptions.StopIteration();
 					}
 				},
 				__iter__ : function () return self

+ 16 - 0
std/python/VarArgs.hx

@@ -0,0 +1,16 @@
+
+package python;
+
+abstract VarArgs (Array<Dynamic>)
+{
+	inline function new (d:Array<Dynamic>) this = d;
+
+	@:to inline function toArray ():Array<Dynamic>
+	{
+		return this;
+	}
+	@:from static inline function fromArray (d:Array<Dynamic>):VarArgs
+	{
+		return new VarArgs(d);
+	}
+}

+ 1 - 0
std/python/_std/Reflect.hx

@@ -28,6 +28,7 @@ import python.lib.Builtin;
 import python.lib.Inspect;
 import python.lib.Types;
 import python.Syntax;
+import python.VarArgs;
 
 @:access(python.Boot)
 @:coreApi

+ 1 - 1
std/python/internal/HxException.hx

@@ -2,7 +2,7 @@ package python.internal;
 
 @:keep
 @:native("_HxException")
-class HxException extends python.lib.Types.Exception {
+class HxException extends python.lib.Exceptions.Exception {
 	public var val:Dynamic;
 	public function new(val) {
 		var message = Std.string(val);

+ 4 - 4
std/python/lib/Builtin.hx

@@ -84,10 +84,10 @@ extern class Builtin {
 	//public static function range():Void;
 
 	public static function type():Void;
-	@:overload(function (it:Array<Int>):python.lib.Types.ByteArray {})
-	@:overload(function (it:PyIterable<Int>):python.lib.Types.ByteArray {})
-	@:overload(function (size:Int):python.lib.Types.ByteArray {})
-	public static function bytearray(source:String,encoding:String,?errors:Dynamic):python.lib.Types.ByteArray;
+	@:overload(function (it:Array<Int>):python.lib.ByteArray {})
+	@:overload(function (it:PyIterable<Int>):python.lib.ByteArray {})
+	@:overload(function (size:Int):python.lib.ByteArray {})
+	public static function bytearray(source:String,encoding:String,?errors:Dynamic):python.lib.ByteArray;
 	public static function float(x:Dynamic):Float;
 
 	@:overload(function <T>(f:Array<T>):Array<T> {})

+ 23 - 0
std/python/lib/ByteArray.hx

@@ -0,0 +1,23 @@
+package python.lib;
+
+import python.lib.Builtin;
+import python.Syntax;
+
+extern class ByteArray implements ArrayAccess<Int> {
+	public var length(get, null):Int;
+	public inline function get_length ():Int {
+		return Builtin.len(this);
+	}
+
+	public inline function get(i:Int):Int {
+		return Syntax.arrayAccess(this, i);
+	}
+
+	public inline function set(i:Int,v:Int):Void {
+        this.__setitem__(i,v);
+    }
+
+    public function __setitem__(i:Int,v:Int):Void;
+
+	public function decode(encoding:String="utf-8", errors:String="strict"):String;
+}

+ 16 - 0
std/python/lib/Bytes.hx

@@ -0,0 +1,16 @@
+
+package python.lib;
+
+import python.lib.ByteArray;
+
+extern class Bytes extends ByteArray {
+
+	//public function decode(encoding:String="utf-8", errors:String="strict"):String;
+
+	static function __init__ ():Void
+	{
+		Syntax.importFromAs("builtins", "bytes", "python.lib.Bytes");
+	}
+
+
+}

+ 2 - 2
std/python/lib/Codecs.hx

@@ -4,9 +4,9 @@ package python.lib;
 import python.lib.io.IOBase;
 import python.lib.io.RawIOBase;
 import python.lib.io.TextIOBase;
-import python.lib.Types.Bytes;
+import python.lib.Bytes;
 import python.lib.Types.FileObject;
-import python.lib.Types.Tup2;
+import python.lib.Tuple.Tup2;
 
 extern interface Codec {
 	public function encode(input:Dynamic, ?errors:String = "strict"):Tup2<String, Int>;

+ 355 - 0
std/python/lib/Exceptions.hx

@@ -0,0 +1,355 @@
+
+package python.lib;
+
+
+@:native("BaseException")
+extern class BaseException
+{
+	public function new (msg:String):Void;
+}
+
+
+
+@:native("BufferError")
+extern class BufferError extends BaseException
+{
+
+}
+
+@:native("GeneratorExit")
+extern class GeneratorExit extends BaseException
+{
+
+}
+
+@:native("KeyboardInterrupt")
+extern class KeyboardInterrupt extends BaseException
+{
+
+}
+
+@:native("Exception")
+extern class Exception extends BaseException
+{
+
+}
+
+@:native("SyntaxError")
+extern class SyntaxError extends Exception
+{
+
+}
+
+@:native("StopIteration")
+extern class StopIteration extends Exception
+{
+	public function new (?message:String);
+}
+
+@:native("RuntimeError")
+extern class RuntimeError extends Exception
+{
+
+}
+
+@:native("NotImplementedError")
+extern class NotImplementedError extends RuntimeError
+{
+
+}
+
+@:native("IndentationError")
+extern class IndentationError extends SyntaxError
+{
+
+}
+
+@:native("EnvironmentError")
+extern class EnvironmentError extends Exception
+{
+
+}
+
+@:native("OSError")
+extern class OSError extends EnvironmentError
+{
+
+}
+
+@:native("BlockingIOError")
+extern class BlockingIOError extends OSError
+{
+
+}
+
+@:native("ChildProcessError")
+extern class ChildProcessError extends OSError
+{
+
+}
+
+@:native("ConnectionError")
+extern class ConnectionError extends OSError
+{
+
+}
+
+@:native("BrokenPipeError")
+extern class BrokenPipeError extends ConnectionError
+{
+
+}
+
+@:native("ConnectionAbortedError")
+extern class ConnectionAbortedError extends ConnectionError
+{
+
+}
+@:native("ConnectionRefusedError")
+extern class ConnectionRefusedError extends ConnectionError
+{
+
+}
+@:native("ConnectionResetError")
+extern class ConnectionResetError extends ConnectionError
+{
+
+}
+
+@:native("FileExistsError")
+extern class FileExistsError extends OSError
+{
+
+}
+@:native("FileNotFoundError")
+extern class FileNotFoundError extends OSError
+{
+
+}
+@:native("InterruptedError")
+extern class InterruptedError extends OSError
+{
+
+}
+@:native("IsADirectoryError")
+extern class IsADirectoryError extends OSError
+{
+
+}
+@:native("NotADirectoryError")
+extern class NotADirectoryError extends OSError
+{
+
+}
+@:native("PermissionError")
+extern class PermissionError extends OSError
+{
+
+}
+@:native("ProcessLookupError")
+extern class ProcessLookupError extends OSError
+{
+
+}
+@:native("TimeoutError")
+extern class TimeoutError extends OSError
+{
+
+}
+
+
+@:native("NameError")
+extern class NameError extends Exception
+{
+
+}
+
+@:native("UnboundLocalError")
+extern class UnboundLocalError extends NameError
+{
+
+}
+
+@:native("MemoryError")
+extern class MemoryError extends Exception
+{
+
+}
+
+@:native("AssertionError")
+extern class AssertionError extends Exception
+{
+
+}
+
+@:native("AttributeError")
+extern class AttributeError extends Exception
+{
+
+}
+
+@:native("EOFError")
+extern class EOFError extends Exception
+{
+
+}
+
+@:native("ArithmeticError")
+extern class ArithmeticError extends Exception
+{
+
+}
+
+
+
+@:native("FloatingPointError")
+extern class FloatingPointError extends ArithmeticError
+{
+
+}
+
+@:native("OverflowError")
+extern class OverflowError extends ArithmeticError
+{
+
+}
+
+
+@:native("ZeroDivisionError")
+extern class ZeroDivisionError extends ArithmeticError
+{
+
+}
+
+
+
+@:native("ImportError")
+extern class ImportError extends Exception
+{
+
+}
+
+@:native("LookupError")
+extern class LookupError extends Exception
+{
+
+}
+
+@:native("IndexError")
+extern class IndexError extends LookupError
+{
+
+}
+
+@:native("KeyError")
+extern class KeyError extends LookupError
+{
+
+}
+
+@:native("IOError")
+extern class IOError extends EnvironmentError
+{
+
+}
+
+@:native("VMSError")
+extern class VMSError extends OSError
+{
+
+}
+
+@:native("WindowsError")
+extern class WindowsError extends OSError
+{
+
+}
+
+
+
+
+
+
+@:native("ValueError")
+extern class ValueError extends Exception
+{
+
+}
+
+@:native("UnicodeError")
+extern class UnicodeError extends ValueError
+{
+
+}
+@:native("UnicodeDecodeError")
+extern class UnicodeDecodeError extends UnicodeError
+{
+
+}
+@:native("UnicodeEncodeError")
+extern class UnicodeEncodeError extends UnicodeError
+{
+
+}
+@:native("UnicodeTranslateError")
+extern class UnicodeTranslateError extends UnicodeError
+{
+
+}
+
+@:native("Warning")
+extern class Warning extends Exception
+{
+
+}
+
+@:native("DeprecationWarning")
+extern class DeprecationWarning extends Warning
+{
+
+}
+@:native("PendingDeprecationWarning")
+extern class PendingDeprecationWarning extends Warning
+{
+
+}
+@:native("RuntimeWarning")
+extern class RuntimeWarning extends Warning
+{
+
+}
+@:native("SyntaxWarning")
+extern class SyntaxWarning extends Warning
+{
+
+}
+@:native("UserWarning")
+extern class UserWarning extends Warning
+{
+
+}
+@:native("FutureWarning")
+extern class FutureWarning extends Warning
+{
+
+}
+@:native("ImportWarning")
+extern class ImportWarning extends Warning
+{
+
+}
+@:native("UnicodeWarning")
+extern class UnicodeWarning extends Warning
+{
+
+}
+@:native("BytesWarning")
+extern class BytesWarning extends Warning
+{
+
+}
+@:native("ResourceWarning")
+extern class ResourceWarning extends Warning
+{
+
+}

+ 1 - 1
std/python/lib/Json.hx

@@ -1,7 +1,7 @@
 
 package python.lib;
 
-import python.lib.Types.Dict;
+import python.lib.Dict;
 
 extern class Json {
 

+ 3 - 0
std/python/lib/List.hx

@@ -0,0 +1,3 @@
+package python.lib;
+
+typedef List<T> = Array<T>;

+ 1 - 1
std/python/lib/Msvcrt.hx

@@ -3,7 +3,7 @@ package python.lib;
 
 extern class Msvcrt {
 
-	public static function getch ():python.lib.Types.Bytes;
+	public static function getch ():python.lib.Bytes;
 
 	static function __init__ ():Void
 	{

+ 1 - 0
std/python/lib/Os.hx

@@ -2,6 +2,7 @@
 package python.lib;
 
 
+import python.lib.Exceptions.OSError;
 import python.lib.Tuple;
 import python.lib.Types;
 

+ 1 - 2
std/python/lib/ShUtil.hx

@@ -1,12 +1,11 @@
 
 package python.lib;
 
-import python.lib.Types;
 
 
 extern class ShUtil {
 
-	public static function rmtree(path:String, ?ignore_errors:Bool=false, ?onerror:BaseException->Void):Void;
+	public static function rmtree(path:String, ?ignore_errors:Bool=false, ?onerror:python.lib.Exceptions.BaseException->Void):Void;
 
 	public static function copyfile (src:String, dst:String):Void;
 

+ 1 - 1
std/python/lib/StringTools.hx

@@ -1,7 +1,7 @@
 
 package python.lib;
 
-import python.lib.Types.Bytes;
+import python.lib.Bytes;
 import python.lib.Tuple;
 
 class StringTools {

+ 1 - 0
std/python/lib/Sys.hx

@@ -1,5 +1,6 @@
 package python.lib;
 
+import python.lib.Exceptions.BaseException;
 import python.lib.io.FileIO;
 import python.lib.io.RawIOBase;
 import python.lib.io.TextIOBase;

+ 1 - 1
std/python/lib/ThreadLowLevel.hx

@@ -1,7 +1,7 @@
 
 package python.lib;
 
-import python.lib.Types.Tuple;
+import python.lib.Tuple;
 
 private typedef TODO = Dynamic;
 

+ 4 - 419
std/python/lib/Types.hx

@@ -10,70 +10,13 @@ abstract Choice <A,B>(Dynamic) {
 	@:from public static inline function fromB <A,B>(x:B):Choice<A,B> return cast x;
 }
 
-abstract KwArgs (Dict<String, Dynamic>)
-{
-	inline function new (d:Dict<String, Dynamic>) this = d;
 
-	@:to inline function toDict ():Dict<String, Dynamic>
-	{
-		return this;
-	}
-	@:from static inline function fromDict (d:Dict<String, Dynamic>):KwArgs
-	{
-		return new KwArgs(d);
-	}
-
-	public function get <V>(key:String, def:V):V
-	{
-		return this.get(key, def);
-	}
-}
-
-abstract VarArgs (Array<Dynamic>)
-{
-	inline function new (d:Array<Dynamic>) this = d;
-
-	@:to inline function toArray ():Array<Dynamic>
-	{
-		return this;
-	}
-	@:from static inline function fromArray (d:Array<Dynamic>):VarArgs
-	{
-		return new VarArgs(d);
-	}
-}
 
 
-extern class ByteArray implements ArrayAccess<Int> {
-	public var length(get, null):Int;
-	public inline function get_length ():Int {
-		return Builtin.len(this);
-	}
 
-	public inline function get(i:Int):Int {
-		return python.Syntax.arrayAccess(this, i);
-	}
 
-	public inline function set(i:Int,v:Int):Void {
-        this.__setitem__(i,v);
-    }
-
-    public function __setitem__(i:Int,v:Int):Void;
-
-	public function decode(encoding:String="utf-8", errors:String="strict"):String;
-}
 
-extern class Bytes extends ByteArray {
 
-	//public function decode(encoding:String="utf-8", errors:String="strict"):String;
-
-	static function __init__ ():Void
-	{
-		Syntax.importFromAs("builtins", "bytes", "python.lib.Bytes");
-	}
-
-
-}
 
 typedef Variant<A,B> = Dynamic;
 typedef Variant3<A,B,C> = Dynamic;
@@ -111,22 +54,21 @@ typedef NativeIterator<T> = {
 
 typedef NativeIterable<T> = {
 	function __iter__():PyIterator<T>;
-
 }
 
-typedef List<T> = Array<T>;
 
 
 
-typedef Hashable = {
+
+typedef NativeHashable = {
 	public function __hash__():Int;
 }
 
-typedef Equal = {
+typedef NativeEqual = {
 	public function __eq__(other:Dynamic):Int;
 }
 
-typedef Comparable = {
+typedef NativeComparable = {
 
 	public function __cmp__(other:Dynamic):Int;
 }
@@ -152,363 +94,6 @@ extern class FileDescriptor {
 
 
 
-@:native("BaseException")
-extern class BaseException
-{
-	public function new (msg:String):Void;
-}
-
-
-
-@:native("BufferError")
-extern class BufferError extends BaseException
-{
-
-}
-
-@:native("GeneratorExit")
-extern class GeneratorExit extends BaseException
-{
-
-}
-
-@:native("KeyboardInterrupt")
-extern class KeyboardInterrupt extends BaseException
-{
-
-}
-
-@:native("Exception")
-extern class Exception extends BaseException
-{
-
-}
-
-@:native("SyntaxError")
-extern class SyntaxError extends Exception
-{
-
-}
-
-@:native("StopIteration")
-extern class StopIteration extends Exception
-{
-	public function new (?message:String);
-}
-
-@:native("RuntimeError")
-extern class RuntimeError extends Exception
-{
-
-}
-
-@:native("NotImplementedError")
-extern class NotImplementedError extends RuntimeError
-{
-
-}
-
-@:native("IndentationError")
-extern class IndentationError extends SyntaxError
-{
-
-}
-
-@:native("EnvironmentError")
-extern class EnvironmentError extends Exception
-{
-
-}
-
-@:native("OSError")
-extern class OSError extends EnvironmentError
-{
-
-}
-
-@:native("BlockingIOError")
-extern class BlockingIOError extends OSError
-{
-
-}
-
-@:native("ChildProcessError")
-extern class ChildProcessError extends OSError
-{
-
-}
-
-@:native("ConnectionError")
-extern class ConnectionError extends OSError
-{
-
-}
-
-@:native("BrokenPipeError")
-extern class BrokenPipeError extends ConnectionError
-{
-
-}
-
-@:native("ConnectionAbortedError")
-extern class ConnectionAbortedError extends ConnectionError
-{
-
-}
-@:native("ConnectionRefusedError")
-extern class ConnectionRefusedError extends ConnectionError
-{
-
-}
-@:native("ConnectionResetError")
-extern class ConnectionResetError extends ConnectionError
-{
-
-}
-
-@:native("FileExistsError")
-extern class FileExistsError extends OSError
-{
-
-}
-@:native("FileNotFoundError")
-extern class FileNotFoundError extends OSError
-{
-
-}
-@:native("InterruptedError")
-extern class InterruptedError extends OSError
-{
-
-}
-@:native("IsADirectoryError")
-extern class IsADirectoryError extends OSError
-{
-
-}
-@:native("NotADirectoryError")
-extern class NotADirectoryError extends OSError
-{
-
-}
-@:native("PermissionError")
-extern class PermissionError extends OSError
-{
-
-}
-@:native("ProcessLookupError")
-extern class ProcessLookupError extends OSError
-{
-
-}
-@:native("TimeoutError")
-extern class TimeoutError extends OSError
-{
-
-}
-
-
-@:native("NameError")
-extern class NameError extends Exception
-{
-
-}
-
-@:native("UnboundLocalError")
-extern class UnboundLocalError extends NameError
-{
-
-}
-
-@:native("MemoryError")
-extern class MemoryError extends Exception
-{
-
-}
-
-@:native("AssertionError")
-extern class AssertionError extends Exception
-{
-
-}
-
-@:native("AttributeError")
-extern class AttributeError extends Exception
-{
-
-}
-
-@:native("EOFError")
-extern class EOFError extends Exception
-{
-
-}
-
-@:native("ArithmeticError")
-extern class ArithmeticError extends Exception
-{
-
-}
-
-
-
-@:native("FloatingPointError")
-extern class FloatingPointError extends ArithmeticError
-{
-
-}
-
-@:native("OverflowError")
-extern class OverflowError extends ArithmeticError
-{
-
-}
-
-
-@:native("ZeroDivisionError")
-extern class ZeroDivisionError extends ArithmeticError
-{
-
-}
-
-
-
-@:native("ImportError")
-extern class ImportError extends Exception
-{
-
-}
-
-@:native("LookupError")
-extern class LookupError extends Exception
-{
-
-}
-
-@:native("IndexError")
-extern class IndexError extends LookupError
-{
-
-}
-
-@:native("KeyError")
-extern class KeyError extends LookupError
-{
-
-}
-
-
-
-
-
-
-
-@:native("IOError")
-extern class IOError extends EnvironmentError
-{
-
-}
-
-@:native("VMSError")
-extern class VMSError extends OSError
-{
-
-}
-
-@:native("WindowsError")
-extern class WindowsError extends OSError
-{
-
-}
-
-
-
-
-
-
-@:native("ValueError")
-extern class ValueError extends Exception
-{
-
-}
-
-@:native("UnicodeError")
-extern class UnicodeError extends ValueError
-{
-
-}
-@:native("UnicodeDecodeError")
-extern class UnicodeDecodeError extends UnicodeError
-{
-
-}
-@:native("UnicodeEncodeError")
-extern class UnicodeEncodeError extends UnicodeError
-{
-
-}
-@:native("UnicodeTranslateError")
-extern class UnicodeTranslateError extends UnicodeError
-{
-
-}
-
-@:native("Warning")
-extern class Warning extends Exception
-{
-
-}
-
-@:native("DeprecationWarning")
-extern class DeprecationWarning extends Warning
-{
-
-}
-@:native("PendingDeprecationWarning")
-extern class PendingDeprecationWarning extends Warning
-{
-
-}
-@:native("RuntimeWarning")
-extern class RuntimeWarning extends Warning
-{
-
-}
-@:native("SyntaxWarning")
-extern class SyntaxWarning extends Warning
-{
-
-}
-@:native("UserWarning")
-extern class UserWarning extends Warning
-{
-
-}
-@:native("FutureWarning")
-extern class FutureWarning extends Warning
-{
-
-}
-@:native("ImportWarning")
-extern class ImportWarning extends Warning
-{
-
-}
-@:native("UnicodeWarning")
-extern class UnicodeWarning extends Warning
-{
-
-}
-@:native("BytesWarning")
-extern class BytesWarning extends Warning
-{
-
-}
-@:native("ResourceWarning")
-extern class ResourceWarning extends Warning
-{
-
-}
 
 extern class TB {}
 extern class Frame {}

+ 1 - 1
std/python/lib/io/BufferedIOBase.hx

@@ -2,7 +2,7 @@
 package python.lib.io;
 
 import python.lib.io.RawIOBase;
-import python.lib.Types.ByteArray;
+import python.lib.ByteArray;
 
 extern class BufferedIOBase extends IOBase {
 

+ 1 - 1
std/python/lib/net/Address.hx

@@ -1,4 +1,4 @@
 
 package python.lib.net;
 
-typedef Address = python.lib.Types.Tup2<String,Int>;
+typedef Address = python.lib.Tuple.Tup2<String,Int>;

+ 1 - 0
std/python/lib/net/Socket.hx

@@ -23,6 +23,7 @@ package python.lib.net;
 
 import haxe.io.BytesData;
 import python.lib.Types;
+import python.lib.Tuple;
 
 /**
     A TCP socket class : allow you to both connect to a given server and exchange messages or start your own server and wait for connections.

+ 0 - 10
std/python/lib/types/ClassType.hx

@@ -1,10 +0,0 @@
-
-package python.lib.types;
-
-extern class ClassType {
-
-	static function __init__ ():Void {
-		Syntax.importFromAs("types", "ClassType", "python.lib.types.ClassType");
-	}
-
-}

+ 1 - 1
std/python/lib/xml/etree/ElementTree.hx

@@ -1,7 +1,7 @@
 
 package python.lib.xml.etree;
 
-import python.lib.Types.Tup2;
+import python.lib.Tuple.Tup2;
 
 import python.lib.Types;
 

+ 61 - 3
tests/unit/TestPython.hx

@@ -1,9 +1,67 @@
 package unit;
 
-import python.lib.Types.KwArgs;
+import python.KwArgs;
+import python.VarArgs;
 import sys.io.File;
 import sys.io.Process;
 
+// check compilation of libs
+import python.lib.Codecs;
+import python.lib.FuncTools;
+import python.lib.Glob;
+import python.lib.Inspect;
+import python.lib.Json;
+import python.lib.List;
+import python.lib.Math;
+import python.lib.Msvcrt;
+import python.lib.Os;
+import python.lib.PPrint;
+import python.lib.Random;
+import python.lib.Re;
+import python.lib.Set;
+import python.lib.ShUtil;
+import python.lib.Subprocess;
+import python.lib.Sys;
+import python.lib.Tempfile;
+import python.lib.Termios;
+import python.lib.ThreadLowLevel;
+import python.lib.Time;
+import python.lib.Traceback;
+import python.lib.Tty;
+import python.lib.Tuple;
+import python.lib.Types;
+
+import python.lib.datetime.DateTime;
+import python.lib.datetime.TimeDelta;
+import python.lib.datetime.Timezone;
+import python.lib.datetime.TzInfo;
+
+import python.lib.io.BufferedIOBase;
+import python.lib.io.BufferedRWPair;
+import python.lib.io.BufferedRandom;
+import python.lib.io.BufferedReader;
+import python.lib.io.BufferedWriter;
+import python.lib.io.BytesIO;
+import python.lib.io.FileIO;
+import python.lib.io.IOBase;
+import python.lib.io.RawIOBase;
+import python.lib.io.StringIO;
+import python.lib.io.TextIOBase;
+
+import python.lib.net.Address;
+import python.lib.net.Socket;
+
+import python.lib.subprocess.Popen;
+
+import python.lib.threading.Thread;
+
+import python.lib.xml.etree.ElementTree;
+
+
+
+
+
+
 private typedef T = {
 	var value:Int;
 	@:optional var maybeValue:Int;
@@ -155,14 +213,14 @@ class TestPython extends Test {
 	}
 
 	function testKwArgs () {
-		function x (args:python.lib.Types.KwArgs) {
+		function x (args:KwArgs) {
 			var a = args.get("a", 0);
 			var b = args.get("b", 0);
 			return a + b;
 		}
 
 
-		var res = x( python.lib.Types.Dict.fromObject({ "a" : 1, "b" : 2}) );
+		var res = x( python.lib.Dict.fromObject({ "a" : 1, "b" : 2}) );
 
 
 		eq(3, res);