@@ -34,29 +34,27 @@ use crate::pyobject::PyObjectRef;
34
34
pub type StdlibInitFunc = Box < dyn Fn ( & VirtualMachine ) -> PyObjectRef > ;
35
35
36
36
pub fn get_module_inits ( ) -> HashMap < String , StdlibInitFunc > {
37
- let mut modules = HashMap :: new ( ) ;
38
- modules. insert (
39
- "ast" . to_string ( ) ,
40
- Box :: new ( ast:: make_module) as StdlibInitFunc ,
41
- ) ;
42
- modules. insert ( "binascii" . to_string ( ) , Box :: new ( binascii:: make_module) ) ;
43
- modules. insert ( "dis" . to_string ( ) , Box :: new ( dis:: make_module) ) ;
44
- modules. insert ( "itertools" . to_string ( ) , Box :: new ( itertools:: make_module) ) ;
45
- modules. insert ( "json" . to_string ( ) , Box :: new ( json:: make_module) ) ;
46
- modules. insert ( "keyword" . to_string ( ) , Box :: new ( keyword:: make_module) ) ;
47
- modules. insert ( "marshal" . to_string ( ) , Box :: new ( marshal:: make_module) ) ;
48
- modules. insert ( "math" . to_string ( ) , Box :: new ( math:: make_module) ) ;
49
- modules. insert ( "platform" . to_string ( ) , Box :: new ( platform:: make_module) ) ;
50
- modules. insert ( "re" . to_string ( ) , Box :: new ( re:: make_module) ) ;
51
- modules. insert ( "random" . to_string ( ) , Box :: new ( random:: make_module) ) ;
52
- modules. insert ( "string" . to_string ( ) , Box :: new ( string:: make_module) ) ;
53
- modules. insert ( "struct" . to_string ( ) , Box :: new ( pystruct:: make_module) ) ;
54
- modules. insert ( "_thread" . to_string ( ) , Box :: new ( thread:: make_module) ) ;
55
- modules. insert ( "time" . to_string ( ) , Box :: new ( time_module:: make_module) ) ;
56
- modules. insert ( "tokenize" . to_string ( ) , Box :: new ( tokenize:: make_module) ) ;
57
- modules. insert ( "_weakref" . to_string ( ) , Box :: new ( weakref:: make_module) ) ;
58
- modules. insert ( "_imp" . to_string ( ) , Box :: new ( imp:: make_module) ) ;
59
- modules. insert ( "_warnings" . to_string ( ) , Box :: new ( warnings:: make_module) ) ;
37
+ let mut modules = hashmap ! {
38
+ "ast" . to_string( ) => Box :: new( ast:: make_module) as StdlibInitFunc ,
39
+ "binascii" . to_string( ) => Box :: new( binascii:: make_module) ,
40
+ "dis" . to_string( ) => Box :: new( dis:: make_module) ,
41
+ "itertools" . to_string( ) => Box :: new( itertools:: make_module) ,
42
+ "json" . to_string( ) => Box :: new( json:: make_module) ,
43
+ "keyword" . to_string( ) => Box :: new( keyword:: make_module) ,
44
+ "marshal" . to_string( ) => Box :: new( marshal:: make_module) ,
45
+ "math" . to_string( ) => Box :: new( math:: make_module) ,
46
+ "platform" . to_string( ) => Box :: new( platform:: make_module) ,
47
+ "re" . to_string( ) => Box :: new( re:: make_module) ,
48
+ "random" . to_string( ) => Box :: new( random:: make_module) ,
49
+ "string" . to_string( ) => Box :: new( string:: make_module) ,
50
+ "struct" . to_string( ) => Box :: new( pystruct:: make_module) ,
51
+ "_thread" . to_string( ) => Box :: new( thread:: make_module) ,
52
+ "time" . to_string( ) => Box :: new( time_module:: make_module) ,
53
+ "tokenize" . to_string( ) => Box :: new( tokenize:: make_module) ,
54
+ "_weakref" . to_string( ) => Box :: new( weakref:: make_module) ,
55
+ "_imp" . to_string( ) => Box :: new( imp:: make_module) ,
56
+ "_warnings" . to_string( ) => Box :: new( warnings:: make_module) ,
57
+ } ;
60
58
61
59
// disable some modules on WASM
62
60
#[ cfg( not( target_arch = "wasm32" ) ) ]
0 commit comments