Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,156 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import haxe.extern.Rest;
import python.lib.io.FileIO;
import python.Dict;
import python.lib.io.IOBase;
import python.NativeIterable;
import python.NativeIterator;
@:pythonImport("builtins")
extern class Builtins {
@:overload(function(f:Int):Int {})
static function abs(x:Float):Float;
static function all(i:Iterable<Bool>):Bool;
static function any(i:Iterable<Bool>):Bool;
static function bool(x:Dynamic):Bool;
static function issubclass(x:Class<Dynamic>, from:Class<Dynamic>):Bool;
static function callable(x:Dynamic):Bool;
@:overload(function(obj:Dynamic, f:Tuple<Dynamic>):Bool {})
static function isinstance(obj:Dynamic, cl:Dynamic):Bool;
static function hasattr(obj:Dynamic, attr:String):Bool;
static function getattr(obj:Dynamic, attr:String):Dynamic;
@:overload(function(f:Set<Dynamic>):Int {})
@:overload(function(f:StringBuf):Int {})
@:overload(function(f:Array<Dynamic>):Int {})
@:overload(function(f:Dict<Dynamic, Dynamic>):Int {})
@:overload(function(f:Bytes):Int {})
@:overload(function(f:DictView<Dynamic>):Int {})
@:overload(function(f:Bytearray):Int {})
@:overload(function(f:Tuple<Dynamic>):Int {})
static function len(x:String):Int;
static function open(file:String, mode:String, ?buffering:Int = -1, ?encoding:String = null, ?errors:String, ?newline:String, ?closefd:Bool,
?opener:String->Int->FileDescriptor):IOBase;
// static function divmod():Void;
// static function input():Void;
// static function staticmethod():Void;
// static function enumerate():Void;
@:overload(function(x:Dynamic, base:Int):Int {})
static function int(x:Dynamic):Int;
static function ord(s:String):Int;
static function str(o:Dynamic):String;
// static function eval():Void;
// static function pow():Void;
// static function sum():Void;
// static function basestring():Void;
// static function execfile():Void;
static function print(o:Dynamic):Void;
// static function super():Void;
// static function bin():Void;
// static function file():Void;
static function iter<X>(d:DictView<X>):NativeIterator<X>;
// static function property():Void;
/*
@:overload(function <X>():Tuple<X> {})
static function tuple<X>(a:Array<X>):Tuple<X>;
*/
// static function range():Void;
static function type():Void;
/*
@:overload(function (it:Array<Int>):python.Bytearray {})
@:overload(function (it:NativeIterable<Int>):python.Bytearray {})
@:overload(function (size:Int):python.Bytearray {})
static function bytearray(source:String,encoding:String,?errors:Dynamic):python.Bytearray;
*/
static function float(x:Dynamic):Float;
@:overload(function<T>(f:Array<T>):Array<T> {})
@:overload(function<T>(f:Tuple<T>):Array<T> {})
@:overload(function<T>(f:Dict.DictView<T>):Array<T> {})
@:overload(function(f:String):Array<String> {})
static function list<T>(i:NativeIterable<T>):Array<T>;
@:overload(function<A>(f:A->Bool, i:NativeIterable<A>):NativeIterator<A> {})
static function filter<A>(f:A->Bool, i:Array<A>):NativeIterator<A>;
// static function raw_input():Void;
// static function unichr():Void;
// static function format():Void;
// static function locals():Void;
// static function reduce():Void;
// static function unicode():Void;
static function chr(c:Int):String;
// static function frozenset():Void;
// static function long():Void;
// static function reload():Void;
// static function vars():Void;
// static function classmethod():Void;
static function map<A, B>(fn:A->B, it:NativeIterable<A>):NativeIterator<B>;
static function repr(o:Dynamic):String;
// static function xrange():Void;
// static function cmp():Void;
// static function globals():Void;
@:overload(function(a1:Float, a2:Float, rest:Rest<Float>):Float {})
static function max(a1:Int, a2:Int, rest:Rest<Int>):Int;
// static function reversed():Void;
// static function zip():Void;
// static function compile():Void;
// static function memoryview():Void;
static function round(f:Float):Int;
// static function __import__():Void;
// static function complex():Void;
// static function hash():Void;
@:overload(function(a1:Float, a2:Float, rest:Rest<Float>):Float {})
static function min(a1:Int, a2:Int, rest:Rest<Int>):Int;
// static function set():Void;
// static function apply():Void;
static function delattr(o:Dynamic, attr:String):Void;
// static function help():Void;
// static function next():Void;
static function setattr(o:Dynamic, attr:String, val:Dynamic):Void;
// static function buffer():Void;
// static function dict():Void;
// static function hex():Void;
// static function object():Void;
// static function slice():Void;
// static function coerce():Void;
// static function dir():Void;
static function id(x:{}):Int;
// static function oct():Void;
// static function sorted():Void;
// static function intern():Void;
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.Bytes;
import python.lib.codecs.StreamReaderWriter;
@:pythonImport("codecs")
extern class Codecs {
static function open(filename:String, mode:String, ?encoding:String, ?errors:String, ?buffering:Bool):StreamReaderWriter;
static function encode(obj:String, ?encoding:String = "utf-8", errors:String = "strict"):Bytes;
static function decode(obj:Bytes, ?encoding:String = "utf-8", errors:String = "strict"):String;
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
extern class FileDescriptor {}

View File

@ -0,0 +1,27 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.lib.io.IOBase;
typedef FileObject = IOBase;

View File

@ -0,0 +1,28 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
@:pythonImport("functools")
extern class Functools {
static function cmp_to_key<A>(f:A->A->Int):Dynamic;
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.NativeIterator;
@:pythonImport("glob")
extern class Glob {
static function glob(pathname:String):Array<String>;
static function iglob(pathname:String):NativeIterator<String>;
}

View File

@ -0,0 +1,106 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.Bytes;
import python.Set;
@:pythonImport("hashlib")
extern class Hashlib {
/**
A set containing the names of the hash algorithms guaranteed to be supported by this module on all platforms.
Note that md5 is in this list despite some upstream vendors offering an odd “FIPS compliant” Python build that excludes it.
**/
static var algorithms_guaranteed(default, null):Set<String>;
/**
A set containing the names of the hash algorithms that are available in the running Python interpreter.
These names will be recognized when passed to new(). algorithms_guaranteed will always be a subset.
The same algorithm may appear multiple times in this set under different names (thanks to OpenSSL).
**/
static var algorithms_available(default, null):Set<String>;
/**
A generic constructor that takes the string name of the desired algorithm as its first parameter.
It also exists to allow access to the above listed hashes as well as any other algorithms that your OpenSSL library may offer.
The named constructors are much faster than new() and should be preferred.
**/
@:native("new")
static function new_(name:String, ?data:Bytes):HashlibHash;
static function sha1():HashlibHash;
static function sha224():HashlibHash;
static function sha256():HashlibHash;
static function sha384():HashlibHash;
static function sha512():HashlibHash;
static function blake2b():HashlibHash;
static function blake2s():HashlibHash;
static function md5():HashlibHash;
static function sha3_224():HashlibHash;
static function sha3_256():HashlibHash;
static function sha3_384():HashlibHash;
static function sha3_512():HashlibHash;
static function shake_128():HashlibHash;
static function shake_256():HashlibHash;
}
extern class HashlibHash {
/**
The size of the resulting hash in bytes.
**/
var digest_size(default, null):Int;
/**
The internal block size of the hash algorithm in bytes.
**/
var block_size(default, null):Int;
/**
The canonical name of this hash, always lowercase and always suitable as a parameter to new() to create another hash of this type.
**/
var name:String;
/**
Update the hash object with the object arg, which must be interpretable as a buffer of bytes.
Repeated calls are equivalent to a single call with the concatenation of all the arguments: m.update(a); m.update(b) is equivalent to m.update(a+b).
**/
function update(a:Bytes):Void;
/**
Return the digest of the data passed to the update() method so far.
This is a bytes object of size digest_size which may contain bytes in the whole range from 0 to 255.
**/
function digest():Bytes;
/**
Like digest() except the digest is returned as a string object of double length, containing only hexadecimal digits.
This may be used to exchange the value safely in email or other non-binary environments.
**/
function hexdigest():String;
/**
Return a copy (“clone”) of the hash object.
This can be used to efficiently compute the digests of data sharing a common initial substring.
**/
function copy():HashlibHash;
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.Tuple.Tuple2;
@:pythonImport("inspect")
extern class Inspect {
static function getmembers(object:Dynamic, ?predicate:Dynamic->Bool):Array<Tuple2<String, Dynamic>>;
static function ismethod(object:Dynamic):Bool;
static function isclass(object:Dynamic):Bool;
static function isfunction(object:Dynamic):Bool;
static function getsourcefile(object:Dynamic):String;
static inline function isInterface(cls:Class<Dynamic>):Bool {
return untyped __define_feature__("python._hx_is_interface", c._hx_is_interface);
}
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.lib.io.IOBase;
@:pythonImport("io")
extern class Io {
static var DEFAULT_BUFFER_SIZE:Int;
static function open(file:String, mode:String, ?buffering:Int = -1, ?encoding:String = null, ?errors:String, ?newline:String, ?closefd:Bool,
?opener:String->Int->FileDescriptor):IOBase;
}

View File

@ -0,0 +1,52 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.KwArgs;
import python.Dict;
import python.lib.json.JSONEncoder;
import python.Tuple.Tuple2;
typedef JsonDumpsOptions = {
var ?skipkeys:Bool;
var ?ensure_ascii:Bool;
var ?check_circular:Bool;
var ?allow_nan:Bool;
var ?cls:Dynamic;
var ?indent:String;
var ?separators:Tuple2<String, String>;
@:native("default") var ?def:Dynamic->String;
var ?sort_keys:Bool;
}
typedef JsonLoadsOptions = {
var ?encoding:String;
var ?cls:Dynamic;
var ?object_hook:Dict<String, Dynamic>->Dynamic;
}
@:pythonImport("json")
extern class Json {
static function loads(s:String, ?options:KwArgs<JsonLoadsOptions>):Dict<String, Dynamic>;
static function dumps(x:Dynamic, ?options:KwArgs<JsonDumpsOptions>):String;
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
@:pythonImport("math")
extern class Math {
static function isnan(f:Float):Bool;
static var pi:Float;
static function sqrt(f:Float):Float;
static function log(f:Float):Float;
static function cos(f:Float):Float;
static function sin(f:Float):Float;
static function tan(f:Float):Float;
static function asin(v:Float):Float;
static function acos(v:Float):Float;
static function atan(v:Float):Float;
static function atan2(y:Float, x:Float):Float;
}

View File

@ -0,0 +1,29 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
@:pythonImport("msvcrt", ignoreError = true)
extern class Msvcrt {
static function getch():python.Bytes;
static function getwch():String;
}

View File

@ -0,0 +1,92 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.Exceptions.OSError;
import python.Tuple;
import python.Dict;
extern class Stat {
var st_mode:Int;
var st_ino:Int;
var st_dev:Int;
var st_nlink:Int;
var st_uid:Int;
var st_gid:Int;
var st_size:Int;
var st_atime:Int;
var st_mtime:Int;
var st_ctime:Int;
@:optional var st_blocks:Int;
@:optional var st_blksize:Int;
@:optional var st_rdev:Int;
@:optional var st_flags:Int;
@:optional var st_gen:Int;
@:optional var st_birthtime:Int;
@:optional var st_rsize:Int;
@:optional var st_creator:Int;
@:optional var st_type:Int;
}
@:pythonImport("os")
extern class Os {
static var environ:Dict<String, String>;
static function putenv(name:String, value:String):Void;
static function chdir(path:String):Void;
static function unlink(path:String):Void;
static function remove(path:String):Void;
static function getcwd():String;
static function getcwdb():Bytes;
static function removedirs(path:String):Void;
static function rename(src:String, dest:String):Void;
static function renames(oldName:String, newName:String):Void;
static function rmdir(path:String):Void;
static function stat(path:String):Stat;
static function fchdir(fd:FileDescriptor):Void;
static function listdir(path:String = "."):Array<String>;
static function walk(top:String, topdown:Bool = true, onerror:OSError->Void = null,
followlinks:Bool = false):Tuple3<String, Array<String>, Array<String>>;
static var sep(default, null):String;
static var pathsep(default, null):String;
static function makedirs(path:String, mode:Int = 511 /* Oktal 777 */, exist_ok:Bool = false):Void;
static function mkdir(path:String, mode:Int = 511 /* Oktal 777 */):Void;
}

View File

@ -0,0 +1,30 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
@:pythonImport("pprint")
extern class Pprint {
static function pprint(x:Dynamic):Void;
static function pformat(object:Dynamic, indent:Int = 1, width:Int = 80, depth:Int = null):String;
}

View File

@ -0,0 +1,153 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
@:pythonImport("random")
extern class Random {
/**
Initialize the random number generator.
If `a` is omitted or `null`, the current system time is used.
If randomness sources are provided by the operating system,
they are used instead of the system time (see the os.urandom()
function for details on availability).
If `a` is an int, it is used directly.
With `version` 2 (the default), a str, bytes, or bytearray object
gets converted to an int and all of its bits are used.
With version 1, the hash() of a is used instead.
**/
static function seed(?a:Int, ?version:Int):Float;
/**
Return an object capturing the current internal state of the generator.
This object can be passed to setstate() to restore the state.
**/
static function getstate():RandomState;
/**
`state` should have been obtained from a previous call to `getstate`(),
and `setstate`() restores the internal state of the generator to what
it was at the time `getstate`() was called.
**/
static function setstate(state:RandomState):Void;
/**
Returns a Python integer with `k` random bits.
This method is supplied with the `MersenneTwister` generator and
some other generators may also provide it as an optional part of the API.
When available, `getrandbits`() enables `randrange`() to handle arbitrarily large ranges.
**/
static function getrandbits(k:Int):Int;
/**
Return a randomly selected element from `range(start, stop, step)`.
This is equivalent to `choice(range(start, stop, step))`,
but doesnt actually build a range object.
**/
@:overload(function(stop:Int):Int {})
static function randrange(start:Int, stop:Int, ?step:Int):Int;
/**
Return a random integer N such that `a <= N <= b`. Alias for `randrange(a, b+1)`.
**/
static function randint(a:Int, b:Int):Int;
/**
Return the next random floating point number in the range [0.0, 1.0).
**/
static function random():Float;
/**
Return a random floating point number N such that
`a <= N <= b` for `a <= b` and `b <= N <= a` for `b < a`.
**/
static function uniform(a:Float, b:Float):Float;
/**
Return a random floating point number N such that
`low <= N <= high` and with the specified `mode` between those bounds.
The `low` and `high` bounds default to zero and one.
The `mode` argument defaults to the midpoint between the bounds,
giving a symmetric distribution.
**/
static function triangular(?low:Float, ?high:Float, ?mode:Float):Float;
/**
Beta distribution. Conditions on the parameters are `alpha > 0` and `beta > 0`.
Returned values range between 0 and 1.
**/
static function betavariate(alpha:Float, beta:Float):Float;
/**
Exponential distribution. `lambd` is 1.0 divided by the desired mean.
It should be nonzero. Returned values range from 0 to positive infinity if `lambd` is positive,
and from negative infinity to 0 if `lambd` is negative.
**/
static function expovariate(lambd:Float):Float;
/**
Gamma distribution. (Not the gamma function!)
Conditions on the parameters are `alpha > 0` and `beta > 0`.
**/
static function gammavariate(alpha:Float, beta:Float):Float;
/**
Gaussian distribution. `mu` is the mean, and `sigma` is the standard deviation.
This is slightly faster than the `normalvariate` function defined below.
**/
static function gauss(mu:Float, sigma:Float):Float;
/**
Log normal distribution. If you take the natural logarithm of this distribution,
youll get a normal distribution with mean `mu` and standard deviation `sigma`.
`mu` can have any value, and `sigma` must be greater than zero.
**/
static function lognormvariate(mu:Float, sigma:Float):Float;
/**
Normal distribution. `mu` is the mean, and `sigma` is the standard deviation.
**/
static function normalvariate(mu:Float, sigma:Float):Float;
/**
`mu` is the mean angle, expressed in radians between 0 and 2*pi,
and `kappa` is the concentration parameter, which must be greater than or equal to zero.
If `kappa` is equal to zero, this distribution reduces to a uniform random angle
over the range 0 to 2*pi.
**/
static function vonmisesvariate(mu:Float, kappa:Float):Float;
/**
Pareto distribution. alpha is the `shape` parameter.
**/
static function paretovariate(alpha:Float):Float;
/**
Weibull distribution. `alpha` is the scale parameter and `beta` is the shape parameter.
**/
static function weibullvariate(alpha:Float, beta:Float):Float;
}
abstract RandomState({}) {}

View File

@ -0,0 +1,179 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.Tuple;
private abstract Choice<A, B>(Dynamic) {
@:from public static inline function fromA<A, B>(x:A):Choice<A, B>
return cast x;
@:from public static inline function fromB<A, B>(x:B):Choice<A, B>
return cast x;
}
typedef Pattern = Choice<String, Regex>;
typedef Repl = Choice<String, MatchObject->String>;
extern class MatchObject {
var pos(default, null):Int;
var endpos(default, null):Int;
var lastindex(default, null):Int;
var lastgroup(default, null):Int;
var re(default, null):Regex;
var string(default, null):String;
function expand(template:String):String;
@:overload(function(x:String):String {})
function group(?i:Int = 0):String;
function groups(defaultVal:String = null):Tuple<String>;
function groupdict(defaultVal:Dict<String, String> = null):Dict<String, String>;
@:overload(function(x:String):Int {})
function start(?i:Int = 0):Int;
@:overload(function(x:String):Int {})
function end(?i:Int = 0):Int;
function span(?i:Int):Tuple2<Int, Int>;
inline function groupById(s:String):String {
return group(s);
}
inline function startById(s:String):Int {
return start(s);
}
inline function endById(s:String):Int {
return end(s);
}
}
private class RegexHelper {
public static function findallDynamic(r:Regex, string:String, ?pos:Int, ?endpos:Int):Array<Dynamic> {
if (endpos == null) {
if (pos == null) {
return python.Syntax.field(r, "findall")(string);
} else {
return python.Syntax.field(r, "findall")(string, pos);
}
} else {
return python.Syntax.field(r, "findall")(string, pos, endpos);
}
}
}
extern class Regex {
function search(string:String, pos:Int = 0, ?endpos:Int):Null<MatchObject>;
function match(string:String, pos:Int = 0, ?endpos:Int):Null<MatchObject>;
function split(string:String, maxsplit:Int = 0):Array<String>;
inline function findallString(string:String, ?pos:Int, ?endpos:Int):Array<String> {
return cast this.findallDynamic(string, pos, endpos);
}
inline function findallDynamic(string:String, ?pos:Int, ?endpos:Int):Array<Dynamic> {
return RegexHelper.findallDynamic(this, string, pos, endpos);
}
inline function findallTuple(string:String, ?pos:Int, ?endpos:Int):Array<Tuple<String>> {
return cast this.findallDynamic(string, pos, endpos);
}
inline function findallArray(string:String, ?pos:Int, ?endpos:Int):Array<Array<String>> {
return findallTuple(string, pos, endpos).map(function(t) return t.toArray());
}
function finditer(string:String, ?pos:Int, ?endpos:Int):NativeIterator<MatchObject>;
function sub(repl:Repl, string:String, count:Int = 0):String;
function subn(repl:Repl, string:String, count:Int = 0):String;
var flags(default, null):Int;
var groups(default, null):Int;
var groupindex(default, null):Dict<String, Int>;
var pattern(default, null):String;
}
@:pythonImport("re")
extern class Re {
static var A:Int;
static var ASCII:Int;
static var DEBUG:Int;
static var I:Int;
static var IGNORECASE:Int;
static var L:Int;
static var LOCALE:Int;
static var M:Int;
static var MULTILINE:Int;
static var S:Int;
static var DOTALL:Int;
static var X:Int;
static var VERBOSE:Int;
static var U:Int;
static var UNICODE:Int;
static function compile(pattern:String, ?flags:Int = 0):Regex;
static function match(pattern:Pattern, string:String, flags:Int = 0):Null<MatchObject>;
static function search(pattern:Pattern, string:String, flags:Int = 0):Null<MatchObject>;
static function split(pattern:Pattern, string:String, maxsplit:Int = 0, flags:Int = 0):Array<String>;
static inline function findallDynamic(pattern:Pattern, string:String, flags:Int = 0):Array<Dynamic> {
return python.Syntax.field(pattern, "findall")(string, flags);
}
static inline function findallString(pattern:Pattern, string:String, flags:Int = 0):Array<String> {
return python.Syntax.field(pattern, "findall")(string, flags);
}
static inline function findallTuple(pattern:Pattern, string:String, flags:Int = 0):Array<Tuple<String>> {
return python.Syntax.field(pattern, "findall")(string, flags);
}
static inline function findallArray(pattern:Pattern, string:String, flags:Int = 0):Array<Array<String>> {
return findallTuple(pattern, string, flags).map(function(t) return t.toArray());
}
static function finditer(pattern:Pattern, string:String, flags:Int = 0):NativeIterator<MatchObject>;
@:overload(function(pattern:Pattern, repl:String, string:String, ?count:Int = 0, ?flags:Int = 0):String {})
static function sub(pattern:Pattern, repl:MatchObject->String, string:String, ?count:Int = 0, ?flags:Int = 0):String;
static function subn(pattern:Pattern, repl:Repl, string:String, count:Int = 0, flags:Int = 0):String;
static function escape(string:String):String;
static function purge():Void;
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import haxe.io.BytesData;
import python.Tuple;
private typedef Selectable = haxe.extern.EitherType<Int, {function fileno():Int;}>;
@:pythonImport("select")
extern class Select {
static function select<T>(rlist:Array<T>, wlist:Array<T>, xlist:Array<T>, ?timeout:Float):Tuple3<Array<T>, Array<T>, Array<T>>;
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
@:pythonImport("shutil")
extern class Shutil {
static function rmtree(path:String, ?ignore_errors:Bool = false, ?onerror:python.Exceptions.BaseException->Void):Void;
static function copyfile(src:String, dst:String):Void;
static function copy(src:String, dst:String):Void;
static function copy2(src:String, dst:String):Void;
}

View File

@ -0,0 +1,288 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
@:pythonImport("socket")
extern class Socket {
static var AF_APPLETALK:Int;
static var AF_ASH:Int;
static var AF_ATMPVC:Int;
static var AF_ATMSVC:Int;
static var AF_AX25:Int;
static var AF_BLUETOOTH:Int;
static var AF_BRIDGE:Int;
static var AF_CAN:Int;
static var AF_ECONET:Int;
static var AF_INET:Int;
static var AF_INET6:Int;
static var AF_IPX:Int;
static var AF_IRDA:Int;
static var AF_KEY:Int;
static var AF_LLC:Int;
static var AF_NETBEUI:Int;
static var AF_NETLINK:Int;
static var AF_NETROM:Int;
static var AF_PACKET:Int;
static var AF_PPPOX:Int;
static var AF_RDS:Int;
static var AF_ROSE:Int;
static var AF_ROUTE:Int;
static var AF_SECURITY:Int;
static var AF_SNA:Int;
static var AF_TIPC:Int;
static var AF_UNIX:Int;
static var AF_UNSPEC:Int;
static var AF_WANPIPE:Int;
static var AF_X25:Int;
static var AI_ADDRCONFIG:Int;
static var AI_ALL:Int;
static var AI_CANONNAME:Int;
static var AI_NUMERICHOST:Int;
static var AI_NUMERICSERV:Int;
static var AI_PASSIVE:Int;
static var AI_V4MAPPED:Int;
static var BDADDR_ANY:Int;
static var BDADDR_LOCAL:Int;
static var BTPROTO_HCI:Int;
static var BTPROTO_L2CAP:Int;
static var BTPROTO_RFCOMM:Int;
static var BTPROTO_SCO:Int;
static var CAN_EFF_FLAG:Int;
static var CAN_EFF_MASK:Int;
static var CAN_ERR_FLAG:Int;
static var CAN_ERR_MASK:Int;
static var CAN_RAW:Int;
static var CAN_RAW_ERR_FILTER:Int;
static var CAN_RAW_FILTER:Int;
static var CAN_RAW_LOOPBACK:Int;
static var CAN_RAW_RECV_OWN_MSGS:Int;
static var CAN_RTR_FLAG:Int;
static var CAN_SFF_MASK:Int;
static var CAPI:Int;
static var CMSG_LEN:Int;
static var CMSG_SPACE:Int;
static var EAGAIN:Int;
static var EAI_ADDRFAMILY:Int;
static var EAI_AGAIN:Int;
static var EAI_BADFLAGS:Int;
static var EAI_FAIL:Int;
static var EAI_FAMILY:Int;
static var EAI_MEMORY:Int;
static var EAI_NODATA:Int;
static var EAI_NONAME:Int;
static var EAI_OVERFLOW:Int;
static var EAI_SERVICE:Int;
static var EAI_SOCKTYPE:Int;
static var EAI_SYSTEM:Int;
static var EBADF:Int;
static var EWOULDBLOCK:Int;
static var HCI_DATA_DIR:Int;
static var HCI_FILTER:Int;
static var HCI_TIME_STAMP:Int;
static var INADDR_ALLHOSTS_GROUP:Int;
static var INADDR_ANY:Int;
static var INADDR_BROADCAST:Int;
static var INADDR_LOOPBACK:Int;
static var INADDR_MAX_LOCAL_GROUP:Int;
static var INADDR_NONE:Int;
static var INADDR_UNSPEC_GROUP:Int;
static var IPPORT_RESERVED:Int;
static var IPPORT_USERRESERVED:Int;
static var IPPROTO_AH:Int;
static var IPPROTO_DSTOPTS:Int;
static var IPPROTO_EGP:Int;
static var IPPROTO_ESP:Int;
static var IPPROTO_FRAGMENT:Int;
static var IPPROTO_GRE:Int;
static var IPPROTO_HOPOPTS:Int;
static var IPPROTO_ICMP:Int;
static var IPPROTO_ICMPV6:Int;
static var IPPROTO_IDP:Int;
static var IPPROTO_IGMP:Int;
static var IPPROTO_IP:Int;
static var IPPROTO_IPIP:Int;
static var IPPROTO_IPV6:Int;
static var IPPROTO_NONE:Int;
static var IPPROTO_PIM:Int;
static var IPPROTO_PUP:Int;
static var IPPROTO_RAW:Int;
static var IPPROTO_ROUTING:Int;
static var IPPROTO_RSVP:Int;
static var IPPROTO_SCTP:Int;
static var IPPROTO_TCP:Int;
static var IPPROTO_TP:Int;
static var IPPROTO_UDP:Int;
static var IPV6_CHECKSUM:Int;
static var IPV6_DSTOPTS:Int;
static var IPV6_HOPLIMIT:Int;
static var IPV6_HOPOPTS:Int;
static var IPV6_JOIN_GROUP:Int;
static var IPV6_LEAVE_GROUP:Int;
static var IPV6_MULTICAST_HOPS:Int;
static var IPV6_MULTICAST_IF:Int;
static var IPV6_MULTICAST_LOOP:Int;
static var IPV6_NEXTHOP:Int;
static var IPV6_PKTINFO:Int;
static var IPV6_RECVDSTOPTS:Int;
static var IPV6_RECVHOPLIMIT:Int;
static var IPV6_RECVHOPOPTS:Int;
static var IPV6_RECVPKTINFO:Int;
static var IPV6_RECVRTHDR:Int;
static var IPV6_RECVTCLASS:Int;
static var IPV6_RTHDR:Int;
static var IPV6_RTHDRDSTOPTS:Int;
static var IPV6_RTHDR_TYPE_0:Int;
static var IPV6_TCLASS:Int;
static var IPV6_UNICAST_HOPS:Int;
static var IPV6_V6ONLY:Int;
static var IP_ADD_MEMBERSHIP:Int;
static var IP_DEFAULT_MULTICAST_LOOP:Int;
static var IP_DEFAULT_MULTICAST_TTL:Int;
static var IP_DROP_MEMBERSHIP:Int;
static var IP_HDRINCL:Int;
static var IP_MAX_MEMBERSHIPS:Int;
static var IP_MULTICAST_IF:Int;
static var IP_MULTICAST_LOOP:Int;
static var IP_MULTICAST_TTL:Int;
static var IP_OPTIONS:Int;
static var IP_RECVOPTS:Int;
static var IP_RECVRETOPTS:Int;
static var IP_RETOPTS:Int;
static var IP_TOS:Int;
static var IP_TRANSPARENT:Int;
static var IP_TTL:Int;
static var MSG_CMSG_CLOEXEC:Int;
static var MSG_CONFIRM:Int;
static var MSG_CTRUNC:Int;
static var MSG_DONTROUTE:Int;
static var MSG_DONTWAIT:Int;
static var MSG_EOR:Int;
static var MSG_ERRQUEUE:Int;
static var MSG_MORE:Int;
static var MSG_NOSIGNAL:Int;
static var MSG_OOB:Int;
static var MSG_PEEK:Int;
static var MSG_TRUNC:Int;
static var MSG_WAITALL:Int;
static var NETLINK_DNRTMSG:Int;
static var NETLINK_FIREWALL:Int;
static var NETLINK_IP6_FW:Int;
static var NETLINK_NFLOG:Int;
static var NETLINK_ROUTE:Int;
static var NETLINK_USERSOCK:Int;
static var NETLINK_XFRM:Int;
static var NI_DGRAM:Int;
static var NI_MAXHOST:Int;
static var NI_MAXSERV:Int;
static var NI_NAMEREQD:Int;
static var NI_NOFQDN:Int;
static var NI_NUMERICHOST:Int;
static var NI_NUMERICSERV:Int;
static var PACKET_BROADCAST:Int;
static var PACKET_FASTROUTE:Int;
static var PACKET_HOST:Int;
static var PACKET_LOOPBACK:Int;
static var PACKET_MULTICAST:Int;
static var PACKET_OTHERHOST:Int;
static var PACKET_OUTGOING:Int;
static var PF_CAN:Int;
static var PF_PACKET:Int;
static var PF_RDS:Int;
static var SCM_CREDENTIALS:Int;
static var SCM_RIGHTS:Int;
static var SHUT_RD:Int;
static var SHUT_RDWR:Int;
static var SHUT_WR:Int;
static var SOCK_CLOEXEC:Int;
static var SOCK_DGRAM:Int;
static var SOCK_NONBLOCK:Int;
static var SOCK_RAW:Int;
static var SOCK_RDM:Int;
static var SOCK_SEQPACKET:Int;
static var SOCK_STREAM:Int;
static var SOL_CAN_BASE:Int;
static var SOL_CAN_RAW:Int;
static var SOL_HCI:Int;
static var SOL_IP:Int;
static var SOL_SOCKET:Int;
static var SOL_TCP:Int;
static var SOL_TIPC:Int;
static var SOL_UDP:Int;
static var SOMAXCONN:Int;
static var SO_ACCEPTCONN:Int;
static var SO_BINDTODEVICE:Int;
static var SO_BROADCAST:Int;
static var SO_DEBUG:Int;
static var SO_DONTROUTE:Int;
static var SO_ERROR:Int;
static var SO_KEEPALIVE:Int;
static var SO_LINGER:Int;
static var SO_OOBINLINE:Int;
static var SO_PASSCRED:Int;
static var SO_PEERCRED:Int;
static var SO_RCVBUF:Int;
static var SO_RCVLOWAT:Int;
static var SO_RCVTIMEO:Int;
static var SO_REUSEADDR:Int;
static var SO_REUSEPORT:Int;
static var SO_SNDBUF:Int;
static var SO_SNDLOWAT:Int;
static var SO_SNDTIMEO:Int;
static var SO_TYPE:Int;
static var TCP_CORK:Int;
static var TCP_DEFER_ACCEPT:Int;
static var TCP_INFO:Int;
static var TCP_KEEPCNT:Int;
static var TCP_KEEPIDLE:Int;
static var TCP_KEEPINTVL:Int;
static var TCP_LINGER2:Int;
static var TCP_MAXSEG:Int;
static var TCP_NODELAY:Int;
static var TCP_QUICKACK:Int;
static var TCP_SYNCNT:Int;
static var TCP_WINDOW_CLAMP:Int;
static var TIPC_ADDR_ID:Int;
static var TIPC_ADDR_NAME:Int;
static var TIPC_ADDR_NAMESEQ:Int;
static var TIPC_CFG_SRV:Int;
static var TIPC_CLUSTER_SCOPE:Int;
static var TIPC_CONN_TIMEOUT:Int;
static var TIPC_CRITICAL_IMPORTANCE:Int;
static var TIPC_DEST_DROPPABLE:Int;
static var TIPC_HIGH_IMPORTANCE:Int;
static var TIPC_IMPORTANCE:Int;
static var TIPC_LOW_IMPORTANCE:Int;
static var TIPC_MEDIUM_IMPORTANCE:Int;
static var TIPC_NODE_SCOPE:Int;
static var TIPC_PUBLISHED:Int;
static var TIPC_SRC_DROPPABLE:Int;
static var TIPC_SUBSCR_TIMEOUT:Int;
static var TIPC_SUB_CANCEL:Int;
static var TIPC_SUB_PORTS:Int;
static var TIPC_SUB_SERVICE:Int;
static var TIPC_TOP_SRV:Int;
static var TIPC_WAIT_FOREVER:Int;
static var TIPC_WITHDRAWN:Int;
static var TIPC_ZONE_SCOPE:Int;
static var _GLOBAL_DEFAULT_TIMEOUT:Int;
}

View File

@ -0,0 +1,63 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.lib.ssl.SSLContext;
@:pythonImport("ssl")
extern class Ssl {
@:require(python_version >= 3.4)
static function create_default_context(purpose:String):SSLContext;
/**
Prevents a TLSv1 connection. This option is only applicable in conjunction
with PROTOCOL_TLS. It prevents the peers from choosing TLSv1 as the
protocol version.
**/
static var OP_NO_TLSv1:Int;
/**
Prevents a TLSv1.1 connection. This option is only applicable in conjunction
with PROTOCOL_TLS. It prevents the peers from choosing TLSv1.1 as the
protocol version. Available only with openssl version 1.0.1+.
since python 3.4
**/
@:require(python_version >= 3.4)
static var OP_NO_TLSv1_1:Int;
static var OP_NO_SSLv3:Int;
static var OP_NO_SSLv2:Int;
static var OP_NO_COMPRESSION:Int;
#if (python_version >= 3.6)
@:deprecated("deprecated, use PROTOCOL_TLS instead")
#end
static var PROTOCOL_SSLv23:String;
@:require(python_version >= 3.6)
static var PROTOCOL_TLS:String;
static var CERT_REQUIRED:Int;
}

View File

@ -0,0 +1,52 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import haxe.extern.EitherType;
extern class StartupInfo {
var dwFlags:Int;
var wShowWindow:Int;
}
@:pythonImport("subprocess")
extern class Subprocess {
static function STARTUPINFO():StartupInfo;
static var STD_INPUT_HANDLE:Int;
static var STD_OUTPUT_HANDLE:Int;
static var STD_ERROR_HANDLE:Int;
static var SW_HIDE:Int;
static var STARTF_USESTDHANDLES:Int;
static var STARTF_USESHOWWINDOW:Int;
static var CREATE_NEW_CONSOLE:Int;
static var CREATE_NEW_PROCESS_GROUP:Int;
static var PIPE:Int;
static var STDOUT:Int;
static function call(args:EitherType<String, Array<String>>, ?kwArgs:python.KwArgs<Dynamic>):Int;
}

View File

@ -0,0 +1,58 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.Exceptions.BaseException;
import python.lib.io.FileIO;
import python.lib.io.RawIOBase;
import python.lib.io.TextIOBase;
import python.Tuple;
extern class TB {}
extern class Frame {}
@:pythonImport("sys")
extern class Sys {
static var argv(default, never):Array<String>;
static var executable(default, never):String;
static function exit(x:Int):Void;
static function getfilesystemencoding():String;
static var version:String;
static var platform:String;
static var stdout(default, never):TextIOBase;
static var stdin(default, never):TextIOBase;
static var stderr(default, never):TextIOBase;
static function getsizeof(t:Dynamic):Int;
static var maxsize:Int;
static function exc_info<T:BaseException>():Tuple3<Class<T>, T, TB>;
static var version_info:Tuple5<Int, Int, Int, String, Int>;
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
@:pythonImport("tempfile")
extern class Tempfile {
static function gettempdir():String;
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
abstract TermiosSettings(Dynamic) {}
@:pythonImport("termios", ignoreError = true)
extern class Termios {
static var TCSADRAIN:Int;
static var ECHO:Int;
static function tcgetattr(fileNo:Int):TermiosSettings;
static function tcsetattr(fileNo:Int, when:Int, settings:TermiosSettings):Void;
}

View File

@ -0,0 +1,30 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.Tuple;
@:pythonImport("_thread")
extern class ThreadLowLevel {
static function start_new_thread(f:Void->Void, args:Tuple<Dynamic>):Dynamic;
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.lib.threading.Thread;
@:pythonImport("threading")
extern class Threading {
static function active_count():Int;
static function current_thread():Thread;
static function get_ident():Int;
static function enumerate():Array<Thread>;
static function main_thread():Thread;
static function settrace(func:Dynamic):Void;
static function setprofile(func:Dynamic):Void;
static function stack_size(?size:Int):Int;
static function local():Dynamic;
static var TIMEOUT_MAX:Float;
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.lib.time.StructTime;
@:pythonImport("time")
extern class Time {
static function time():Float;
static function clock():Float;
static function sleep(t:Float):Void;
static function mktime(s:StructTime):Float;
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
@:pythonImport("timeit")
extern class Timeit {
static function default_timer():Float;
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
import python.lib.Sys;
import python.lib.Sys.Frame;
import python.Tuple;
@:pythonImport("traceback")
extern class Traceback {
static function extract_stack(?f:Frame, ?limit:Int):Array<StackItem>;
static function extract_tb(tb:Sys.TB, ?limit:Int):Array<StackItem>;
}
private typedef StackItem = Tuple4<String, Int, String, String>;

View File

@ -0,0 +1,28 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib;
@:pythonImport("tty", ignoreError = true)
extern class Tty {
static function setraw(fileNo:Int):Void;
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.codecs;
import python.Bytes;
import python.Tuple.Tuple2;
@:pythonImport("codecs", "Codec")
extern class Codec implements ICodec {
function encode(input:Dynamic, ?errors:String = "strict"):Tuple2<String, Int>;
function decode(input:Dynamic, ?errors:String = "strict"):Tuple2<Bytes, Int>;
}
@:remove extern interface ICodec {
function encode(input:Dynamic, ?errors:String = "strict"):Tuple2<String, Int>;
function decode(input:Dynamic, ?errors:String = "strict"):Tuple2<Bytes, Int>;
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.codecs;
import python.lib.codecs.Codec;
@:pythonImport("codecs", "StreamReader")
extern class StreamReader extends Codec implements IStreamReader {
function read(?size:Int, ?chars:Int, ?firstline:Bool):String;
function readline(?size:Int, ?keepsend:Bool = false):String;
function readlines(?sizehint:Int, ?keepsend:Bool = false):Array<String>;
function reset():Void;
}
@:remove extern interface IStreamReader extends ICodec {
function read(?size:Int, ?chars:Int, ?firstline:Bool):String;
function readline(?size:Int, ?keepsend:Bool = false):String;
function readlines(?sizehint:Int, ?keepsend:Bool = false):Array<String>;
function reset():Void;
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.codecs;
import python.lib.codecs.Codec;
import python.lib.codecs.StreamReader;
import python.lib.codecs.StreamWriter;
@:pythonImport("codecs", "StreamReaderWriter")
extern class StreamReaderWriter extends StreamReader implements IStreamWriter {
function write(object:Dynamic):Void;
function writelines(list:Array<String>):Void;
}
@:remove extern interface IStreamReaderWriter extends IStreamReader extends IStreamWriter {}

View File

@ -0,0 +1,38 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.codecs;
import python.lib.codecs.Codec;
@:pythonImport("codecs", "StreamWriter")
extern class StreamWriter extends Codec implements ICodec {
function write(object:Dynamic):Void;
function writelines(list:Array<String>):Void;
function reset():Void;
}
@:remove extern interface IStreamWriter extends ICodec {
function write(object:Dynamic):Void;
function writelines(list:Array<String>):Void;
function reset():Void;
}

View File

@ -0,0 +1,72 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.datetime;
import python.lib.time.StructTime;
@:pythonImport("datetime", "datetime")
extern class Datetime {
function new(year:Int, month:Int, day:Int, hour:Int = 0, minute:Int = 0, second:Int = 0, microsecond:Int = 0, tzinfo:Tzinfo = null);
static var min:Datetime;
static var max:Datetime;
static var resolution:Timedelta;
var year:Int;
var month:Int;
var day:Int;
var hour:Int;
var minute:Int;
var second:Int;
var microsecond:Int;
var tzinfo:Tzinfo;
static function today():Datetime;
static function now(?tzinfo:Tzinfo):Datetime;
static function utcnow():Datetime;
static function fromtimestamp(timestamp:Float, tzInfo:Tzinfo = null):Datetime;
static function utcfromtimestamp(timestamp:Int):Datetime;
static function fromordinal(ordinal:Int):Datetime;
function timetuple():StructTime;
function strftime(format:String):String;
function replace(kwargs:python.KwArgs<{
?year:Int,
?month:Int,
?day:Int,
?hour:Int,
?minute:Int,
?second:Int,
?microsecond:Int,
?tzinfo:Tzinfo
}>):Datetime;
/* 0-6 */
function weekday():Int;
/* 1-7 */
function isoweekday():Int;
function utcoffset():Int;
// python 3.3
function timestamp():Float;
function astimezone(?tz:Tzinfo):Datetime;
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.datetime;
@:pythonImport("datetime", "timedelta")
extern class Timedelta {
static var min:Timedelta;
static var max:Timedelta;
static var resolution:Timedelta;
var days:Int;
var seconds:Int;
var microseconds:Int;
function new(days:Int = 0, seconds:Int = 0, microseconds:Int = 0, milliseconds:Int = 0, minutes:Int = 0, hours:Int = 0, weeks:Int = 0):Void;
function total_seconds():Float;
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.datetime;
@:pythonImport("datetime", "timezone")
extern class Timezone extends Tzinfo {
static var utc(default, never):Tzinfo;
}

View File

@ -0,0 +1,26 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.datetime;
@:pythonImport("datetime", "tzinfo")
extern class Tzinfo {}

View File

@ -0,0 +1,30 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.io;
import python.Exceptions.IOError;
@:pythonImport("io", "BlockingIOError")
class BlockingIOError extends IOError {
var characters_written:Int;
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.io;
import python.lib.io.IOBase;
import python.lib.io.RawIOBase;
import python.Bytearray;
@:pythonImport("io", "BufferedIOBase")
extern class BufferedIOBase extends IOBase implements IBufferedIOBase {
/* not always available */
var raw:RawIOBase;
function write(b:Bytearray):Int;
function readinto(b:Bytearray):Int;
function detach():RawIOBase;
function read(n:Int = -1):Null<Bytes>;
function read1(n:Int = -1):Null<Bytes>;
}
@:remove extern interface IBufferedIOBase extends IIOBase {
var raw:RawIOBase;
function write(b:Bytearray):Int;
function readinto(b:Bytearray):Int;
function detach():RawIOBase;
function read(n:Int = -1):Null<Bytes>;
function read1(n:Int = -1):Null<Bytes>;
}

View File

@ -0,0 +1,26 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.io;
@:pythonImport("io", "BufferedRWPair")
extern class BufferedRWPair extends BufferedIOBase {}

View File

@ -0,0 +1,29 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.io;
import python.lib.io.BufferedReader;
import python.lib.io.BufferedWriter;
@:pythonImport("io", "BufferedRandom")
extern class BufferedRandom extends BufferedReader implements IBufferedWriter {}

View File

@ -0,0 +1,37 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.io;
import python.Bytes;
import python.lib.io.BufferedIOBase;
@:pythonImport("io", "BufferedReader")
extern class BufferedReader extends BufferedIOBase implements IBufferedReader {
function new(raw:RawIOBase):Void;
function peek(?n:Int):Null<Bytes>;
}
@:remove extern interface IBufferedReader extends IBufferedIOBase {
function peek(?n:Int):Null<Bytes>;
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.io;
import python.Bytearray;
import python.lib.io.BufferedIOBase;
@:pythonImport("io", "BufferedWriter")
extern class BufferedWriter extends BufferedIOBase implements IBufferedWriter {
function new(raw:RawIOBase):Void;
}
@:remove extern interface IBufferedWriter extends IBufferedIOBase {
function flush():Void;
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.io;
@:pythonImport("io", "BytesIO")
extern class BytesIO extends python.lib.io.BufferedIOBase {
function new(base:python.lib.io.IOBase);
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.io;
import python.lib.io.RawIOBase;
@:pythonImport("io", "FileIO")
extern class FileIO extends RawIOBase {
/**
The mode as given in the constructor.
**/
var mode:String;
/**
The file name. This is the file descriptor of the file when no name is given in the constructor.
**/
var name:String;
}

View File

@ -0,0 +1,60 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.io;
enum abstract SeekSet(Int) {
var SeekSet = 0;
var SeekCur = 1;
var SeekEnd = 2;
}
@:pythonImport("io", "IOBase")
extern class IOBase implements IIOBase {
function close():Void;
function flush():Void;
function readline(limit:Int = -1):String;
function readable():Bool;
var closed(default, null):Bool;
function readlines(hint:Int = -1):Array<String>;
function tell():Int;
function writable():Bool;
function seekable():Bool;
function fileno():Int;
function seek(offset:Int, whence:SeekSet):Int;
function truncate(size:Int):Int;
}
@:remove extern interface IIOBase {
function close():Void;
function flush():Void;
function readline(limit:Int = -1):String;
function readable():Bool;
var closed(default, null):Bool;
function readlines(hint:Int = -1):Array<String>;
function tell():Int;
function writable():Bool;
function seekable():Bool;
function fileno():Int;
function seek(offset:Int, whence:SeekSet):Int;
function truncate(size:Int):Int;
}

View File

@ -0,0 +1,41 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.io;
import python.lib.io.FileIO;
import python.lib.io.IOBase;
@:pythonImport("io", "RawIOBase")
extern class RawIOBase extends IOBase implements IRawIOBase {
function readall():Bytes;
function read(n:Int = -1):Null<Bytes>;
function write(b:Bytearray):Null<Int>;
function readinto(b:Bytearray):Null<Int>;
}
@:remove extern interface IRawIOBase extends IIOBase {
function readall():Bytes;
function read(n:Int = -1):Null<Bytes>;
function write(b:Bytearray):Null<Int>;
function readinto(b:Bytearray):Null<Int>;
}

View File

@ -0,0 +1,32 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.io;
import python.lib.io.TextIOBase;
import python.Syntax;
@:pythonImport("io", "StringIO")
extern class StringIO extends TextIOBase {
function new(?s:String):Void;
function getvalue():String;
}

View File

@ -0,0 +1,56 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.io;
import haxe.extern.EitherType;
import python.lib.io.BufferedIOBase;
import python.lib.io.IOBase;
@:pythonImport("io", "TextIOBase")
extern class TextIOBase extends IOBase implements ITextIOBase {
var encoding:String;
var error:String;
var newlines:Null<EitherType<String, Tuple<String>>>;
function detach():BufferedIOBase;
function write(s:String):Int;
function read(n:Int):String;
var buffer:BufferedIOBase;
}
@:remove extern interface ITextIOBase extends IIOBase {
var encoding:String;
var error:String;
var newlines:Null<EitherType<String, Tuple<String>>>;
var buffer:BufferedIOBase;
function detach():BufferedIOBase;
function write(s:String):Int;
function read(n:Int):String;
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.io;
import python.lib.io.BufferedIOBase;
import python.lib.io.TextIOBase;
import python.Syntax;
import python.KwArgs;
typedef TextIOWrapperOptions = {
?encoding:String,
?errors:String,
?newline:String,
?line_buffering:Bool,
?write_through:Bool
};
@:pythonImport("io", "TextIOWrapper")
extern class TextIOWrapper extends TextIOBase {
function new(buffer:BufferedIOBase, ?options:KwArgs<TextIOWrapperOptions>):Void;
var line_buffering:Bool;
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.io;
import python.Exceptions.IOError;
@:pythonImport("io", "UnsupportedOperation")
class UnsupportedOperation extends IOError {}

View File

@ -0,0 +1,42 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.json;
import python.Tuple;
typedef JSONDecoderOptions = {
var ?object_hook:Dict<String, Dynamic>->Dynamic;
var ?parse_float:String->Float;
var ?parse_int:String->Int;
var ?parse_constant:String->Dynamic;
var ?strict:Bool;
var ?object_pairs_hook:Array<Tuple2<String, String>>->Dict<String, Dynamic>;
}
@:pythonImport("json", "JSONDecoder")
extern class JSONDecoder {
function new(?options:KwArgs<JSONDecoderOptions>):Void;
function decode(o:String):Dynamic;
function raw_decode(o:String):Tuple2<Dynamic, Int>;
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.json;
import python.Tuple;
typedef JSONEncoderOptions = {
var ?skipkeys:Bool;
var ?ensure_ascii:Bool;
var ?check_circular:Bool;
var ?allow_nan:Bool;
var ?sort_keys:Bool;
var ?indent:String;
var ?separators:Tuple2<String, String>;
@:native("default") var ?def:Dynamic->String;
}
@:pythonImport("json", "JSONEncoder")
extern class JSONEncoder {
function new(?options:KwArgs<JSONEncoderOptions>):Void;
@:native("default") function def(o:Dynamic):Dynamic;
function encode(o:Dynamic):String;
}

View File

@ -0,0 +1,26 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.net;
@:deprecated("Use python.lib.socket.Adress instead")
typedef Address = python.lib.socket.Address;

View File

@ -0,0 +1,32 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.net;
/**
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.
**/
@:deprecated("Use python.lib.socket.Socket instead")
typedef Socket = python.lib.socket.Socket;
@:deprecated("Use python.lib.Socket instead")
typedef SocketModule = python.lib.Socket;

View File

@ -0,0 +1,82 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.os;
import haxe.extern.Rest;
import python.Tuple;
@:pythonImport("os", "path")
extern class Path {
static var sep:String;
static function exists(path:String):Bool;
static function abspath(path:String):String;
static function basename(path:String):String;
static function commonprefix(paths:Array<String>):String;
static function lexists(path:String):Bool;
static function expanduser(path:String):String;
static function expandvars(path:String):String;
static function getmtime(path:String):Float;
static function getatime(path:String):Float;
static function getctime(path:String):Float;
static function getsize(path:String):Int;
static function isabs(path:String):Bool;
static function isfile(path:String):Bool;
static function isdir(path:String):Bool;
static function dirname(path:String):String;
static function islink(path:String):Bool;
static function ismount(path:String):Bool;
static function join(path:String, paths:Rest<String>):String;
static function normpath(path:String):String;
static function realpath(path:String):String;
static function relpath(path:String):String;
static function samefile(path1:String, path2:String):String;
static function split(path:String):Tuple2<String, String>;
static function splitdrive(path:String):Tuple2<String, String>;
static function splitext(path:String):Tuple2<String, String>;
static function supports_unicode_filenames():Bool;
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.socket;
typedef Address = python.Tuple.Tuple2<String, Int>;

View File

@ -0,0 +1,113 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.socket;
import haxe.io.BytesData;
import python.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.
**/
@:pythonImport("socket", "socket")
extern class Socket {
function send(d:BytesData, flags:Int):Int;
function recv(n:Int, flags:Int):BytesData;
/**
Creates a new unconnected socket.
**/
function new():Void;
/**
Closes the socket : make sure to properly close all your sockets or you will crash when you run out of file descriptors.
**/
function close():Void;
/**
Connect to the given server host/port. Throw an exception in case we couldn't successfully connect.
**/
function connect(addr:python.lib.socket.Address):Void;
// function create_connection() :
/**
Allow the socket to listen for incoming questions. The parameter tells how many pending connections we can have until they get refused. Use `accept()` to accept incoming connections.
**/
function listen(connections:Int):Void;
/**
Shutdown the socket, either for reading or writing.
**/
function shutdown(how:Int):Void;
/**
Bind the socket to the given host/port so it can afterwards listen for connections there.
**/
function bind(address:python.lib.socket.Address):Void;
/**
Accept a new connected client. This will return a connected socket on which you can read/write some data.
**/
function accept():Tuple2<Socket, Address>;
/**
Return the information about the other side of a connected socket.
**/
function getpeername():python.lib.socket.Address;
/**
Return the information about our side of a connected socket.
**/
function getsockname():python.lib.socket.Address;
/**
Gives a timeout after which blocking socket operations (such as reading and writing) will abort and throw an exception.
**/
function settimeout(timeout:Float):Void;
/**
Block until some data is available for read on the socket.
**/
function waitForRead():Void;
/**
Change the blocking mode of the socket. A blocking socket is the default behavior. A non-blocking socket will abort blocking operations immediately by throwing a haxe.io.Error.Blocked value.
**/
function setblocking(b:Bool):Void;
/**
**/
function setsockopt(family:Int, option:Int, value:Bool):Void;
function fileno():Int;
/**
Wait until one of the sockets groups is ready for the given operation :
- `read` contains sockets on which we want to wait for available data to be read,
- `write` contains sockets on which we want to wait until we are allowed to write some data to their output buffers,
- `others` contains sockets on which we want to wait for exceptional conditions.
- `select` will block until one of the condition is met, in which case it will return the sockets for which the condition was true.
In case a `timeout` (in seconds) is specified, select might wait at worse until the timeout expires.
**/
// static function select(read : Array<Socket>, write : Array<Socket>, others : Array<Socket>, ?timeout : Float) : { read: Array<Socket>,write: Array<Socket>,others: Array<Socket> };
}

View File

@ -0,0 +1,30 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.ssl;
@:require(python_version >= 3.4)
@:pythonImport("ssl", "Purpose")
extern class Purpose {
static var SERVER_AUTH:String;
static var CLIENT_AUTH:String;
}

View File

@ -0,0 +1,50 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.ssl;
import python.lib.ssl.SSLSocket;
@:pythonImport("ssl", "SSLContext")
extern class SSLContext {
function new(protocol:String):Void;
#if (python_version >= 3.6)
function wrap_socket(s:python.lib.socket.Socket, server_side:Bool = false, do_handshake_on_connect:Bool = true, suppress_ragged_eofs:Bool = true,
server_hostname:String = null, session:SSLSession = null):python.lib.ssl.SSLSocket;
#else
function wrap_socket(s:python.lib.socket.Socket, server_side:Bool = false, do_handshake_on_connect:Bool = true, suppress_ragged_eofs:Bool = true,
server_hostname:String = null):python.lib.ssl.SSLSocket;
#end
var options:Int;
@:require(python_version >= 3.4)
var check_hostname:Bool;
var verify_mode:Int;
function load_verify_locations(cafile:String = null, capath:String = null, cadata:String = null):Void;
function set_default_verify_paths():Void;
@:require(python_version >= 3.4)
function load_default_certs():Void;
// function load_cert_chain(certfile:String, keyfile:String = null, password:String = null):Void;
// function set_servername_callback(callback:SSLSocket -> String -> SSLContext -> Void ):Void;
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.ssl;
@:require(python_version >= 3.6)
@:pythonImport("ssl", "SSLSession")
extern class SSLSession {}

View File

@ -0,0 +1,26 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.ssl;
@:pythonImport("ssl", "SSLSocket")
extern class SSLSocket extends python.lib.socket.Socket {}

View File

@ -0,0 +1,92 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.subprocess;
import python.lib.io.BufferedReader;
import python.lib.io.FileIO;
import python.lib.io.TextIOBase;
import python.lib.Subprocess.StartupInfo;
import python.Tuple;
import python.Dict;
import haxe.extern.EitherType;
typedef PopenOptions = {
?bufsize:Int,
?executable:String,
?stdin:Dynamic,
?stdout:Dynamic,
?stderr:Dynamic,
?preexec_fn:Void->Void,
?close_fds:Bool,
?shell:Bool,
?cwd:String,
?env:Dict<String, String>,
?universal_newlines:Bool,
?startupinfo:StartupInfo,
?creationflags:Int,
}
@:pythonImport("subprocess", "Popen")
extern class Popen {
static inline function create(args:EitherType<String, Array<String>>, o:PopenOptions):Popen {
o.bufsize = if (Reflect.hasField(o, "bufsize")) o.bufsize else 0;
o.executable = if (Reflect.hasField(o, "executable")) o.executable else null;
o.stdin = if (Reflect.hasField(o, "stdin")) o.stdin else null;
o.stdout = if (Reflect.hasField(o, "stdout")) o.stdout else null;
o.stderr = if (Reflect.hasField(o, "stderr")) o.stderr else null;
o.preexec_fn = if (Reflect.hasField(o, "preexec_fn")) o.preexec_fn else null;
o.close_fds = if (Reflect.hasField(o, "close_fds")) o.close_fds else null;
o.shell = if (Reflect.hasField(o, "shell")) o.shell else null;
o.cwd = if (Reflect.hasField(o, "cwd")) o.cwd else null;
o.env = if (Reflect.hasField(o, "env")) o.env else null;
o.universal_newlines = if (Reflect.hasField(o, "universal_newlines")) o.universal_newlines else null;
o.startupinfo = if (Reflect.hasField(o, "startupinfo")) o.startupinfo else null;
o.creationflags = if (Reflect.hasField(o, "creationflags")) o.creationflags else 0;
if (std.Sys.systemName() == "Windows") {
return new Popen(args, o.bufsize, o.executable, o.stdin, o.stdout, o.stderr, o.preexec_fn, o.close_fds, o.shell, o.cwd, o.env,
o.universal_newlines, o.startupinfo, o.creationflags);
} else {
return new Popen(args, o.bufsize, o.executable, o.stdin, o.stdout, o.stderr, o.preexec_fn, o.close_fds, o.shell, o.cwd, o.env,
o.universal_newlines, o.startupinfo);
}
}
function new(args:Array<String>, bufsize:Int = 0, executable:String = null, stdin:Int = null, stdout:Int = null, stderr:Int = null,
preexec_fn:Void->Void = null, close_fds:Bool = false, shell:Bool = false, cwd:String = null, env:Dict<String, String> = null,
universal_newlines:Bool = false, startupinfo:StartupInfo = null, creationflags:Int = 0):Void;
function kill():Void;
function wait(?timeout:Int):Null<Int>;
function poll():Null<Int>;
function terminate():Void;
var stdout:FileIO;
var stderr:FileIO;
var stdin:FileIO;
var returncode:Int;
var pid:Int;
function communicate(input:Bytes = null, timeout:Null<Int> = null):Tuple2<Bytes, Bytes>;
}

View File

@ -0,0 +1,30 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.threading;
@:pythonImport("threading", "Lock")
extern class Lock {
function new():Void;
function acquire(?blocking:Bool, ?timeout:Float):Bool;
function release():Void;
}

View File

@ -0,0 +1,30 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.threading;
@:pythonImport("threading", "RLock")
extern class RLock {
function new():Void;
function acquire(?blocking:Bool, ?timeout:Float):Bool;
function release():Void;
}

View File

@ -0,0 +1,44 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.threading;
typedef ThreadOptions = {
var ?group:Dynamic;
var ?target:Dynamic;
var ?name:String;
var ?args:Tuple<Dynamic>;
var ?kwargs:Dict<String, Dynamic>;
var ?daemon:Dynamic;
}
@:pythonImport("threading", "Thread")
extern class Thread {
var name:String;
var ident:Int;
var daemon:Bool;
function new(?options:KwArgs<ThreadOptions>):Void;
function start():Void;
function run():Void;
function join(?timeout:Float):Void;
function is_alive():Bool;
}

View File

@ -0,0 +1,26 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.time;
@:pythonImport("time", "struct_time")
extern class StructTime implements ArrayAccess<Int> {}

View File

@ -0,0 +1,29 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.urllib;
@:pythonImport("urllib.parse")
extern class Parse {
static function quote(s:String, ?safe:String):String;
static function unquote(s:String):String;
}

View File

@ -0,0 +1,61 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package python.lib.xml.etree;
import python.Tuple.Tuple2;
import python.NativeIterable;
import python.NativeIterator;
import python.Dict;
extern class XMLParser {}
@:pythonImport("xml.etree.ElementTree", "Element")
extern class Element {
function getroot():ElementTree;
var tag:String;
var attrib:Dict<String, String>;
var text:Null<String>;
function get<T>(key:String, def:T = null):T;
function set(key:String, val:String):Void;
function copy():Element;
function keys():Array<String>;
function items():Array<Tuple2<String, String>>;
function iter(tag:String):NativeIterable<Element>;
function iterfind(tag:String, namespaces:Dict<String, String> = null):NativeIterator<Element>;
function find(match:String, namespaces:Dict<String, String> = null):Null<Element>;
function findall(match:String, namespaces:Dict<String, String> = null):Array<Element>;
}
@:pythonImport("xml.etree.ElementTree")
extern class ElementTree {
static function XML(text:String, ?parser:XMLParser):Element;
static function parse(xml:String):ElementTree;
function iter(tag:String):NativeIterable<Element>;
function find(match:String, namespaces:Dict<String, String> = null):Null<Element>;
function getroot():Element;
}