Browse Source

[python] move types from Codecs module into subpackage codecs

frabbit 10 years ago
parent
commit
ca92fe7b7d

+ 1 - 41
std/python/lib/Codecs.hx

@@ -1,47 +1,7 @@
-
 package python.lib;
 
-import python.lib.io.IOBase;
-import python.lib.io.RawIOBase;
-import python.lib.io.TextIOBase;
 import python.lib.Bytes;
-import python.lib.FileObject;
-import python.lib.Tuple.Tup2;
-
-extern interface Codec {
-	public function encode(input:Dynamic, ?errors:String = "strict"):Tup2<String, Int>;
-	public function decode(input:Dynamic, ?errors:String = "strict"):Tup2<Bytes, Int>;
-}
-
-extern interface StreamReader extends Codec {
-	public function read(?size:Int, ?chars:Int, ?firstline:Bool):String;
-	public function readline(?size:Int, ?keepsend:Bool = false):String;
-	public function readlines(?sizehint:Int, ?keepsend:Bool = false):Array<String>;
-	public function reset():Void;
-
-}
-
-extern interface StreamWriter extends Codec {
-	public function write(object:Dynamic):Void;
-	public function writelines(list:Array<String>):Void;
-	public function reset():Void;
-}
-
-extern class StreamReaderWriterText implements StreamReader implements StreamWriter  {
-	public function read(?size:Int, ?chars:Int, ?firstline:Bool):String;
-	public function readline(?size:Int, ?keepsend:Bool = false):String;
-	public function readlines(?sizehint:Int, ?keepsend:Bool = false):Array<String>;
-	public function reset():Void;
-
-	public function write(object:Dynamic):Void;
-	public function writelines(list:Array<String>):Void;
-
-	public function close():Void;
-
-	public function encode(input:Dynamic, ?errors:String = "strict"):Tup2<String, Int>;
-	public function decode(input:Dynamic, ?errors:String = "strict"):Tup2<Bytes, Int>;
-}
-
+import python.lib.codecs.StreamReaderWriterText;
 
 @:pythonImport("codecs")
 extern class Codecs {

+ 9 - 0
std/python/lib/codecs/Codec.hx

@@ -0,0 +1,9 @@
+package python.lib.codecs;
+
+import python.lib.Bytes;
+import python.lib.Tuple.Tup2;
+
+extern interface Codec {
+	public function encode(input:Dynamic, ?errors:String = "strict"):Tup2<String, Int>;
+	public function decode(input:Dynamic, ?errors:String = "strict"):Tup2<Bytes, Int>;
+}

+ 11 - 0
std/python/lib/codecs/StreamReader.hx

@@ -0,0 +1,11 @@
+package python.lib.codecs;
+
+import python.lib.codecs.Codec;
+
+extern interface StreamReader extends Codec {
+	public function read(?size:Int, ?chars:Int, ?firstline:Bool):String;
+	public function readline(?size:Int, ?keepsend:Bool = false):String;
+	public function readlines(?sizehint:Int, ?keepsend:Bool = false):Array<String>;
+	public function reset():Void;
+
+}

+ 21 - 0
std/python/lib/codecs/StreamReaderWriterText.hx

@@ -0,0 +1,21 @@
+package python.lib.codecs;
+
+import python.lib.Bytes;
+import python.lib.Tuple.Tup2;
+import python.lib.codecs.StreamReader;
+import python.lib.codecs.StreamWriter;
+
+extern class StreamReaderWriterText implements StreamReader implements StreamWriter  {
+	public function read(?size:Int, ?chars:Int, ?firstline:Bool):String;
+	public function readline(?size:Int, ?keepsend:Bool = false):String;
+	public function readlines(?sizehint:Int, ?keepsend:Bool = false):Array<String>;
+	public function reset():Void;
+
+	public function write(object:Dynamic):Void;
+	public function writelines(list:Array<String>):Void;
+
+	public function close():Void;
+
+	public function encode(input:Dynamic, ?errors:String = "strict"):Tup2<String, Int>;
+	public function decode(input:Dynamic, ?errors:String = "strict"):Tup2<Bytes, Int>;
+}

+ 9 - 0
std/python/lib/codecs/StreamWriter.hx

@@ -0,0 +1,9 @@
+package python.lib.codecs;
+
+import python.lib.codecs.Codec;
+
+extern interface StreamWriter extends Codec {
+	public function write(object:Dynamic):Void;
+	public function writelines(list:Array<String>):Void;
+	public function reset():Void;
+}